From 9d335c3a96b3ca1d6c9aedcd6a5c1408375d4e78 Mon Sep 17 00:00:00 2001 From: v-yadli Date: Sun, 13 Dec 2020 02:11:28 +0800 Subject: [PATCH 001/393] fix #4996 --- native/Avalonia.Native/src/OSX/window.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm index 8419258fe9..9cb5fcbb58 100644 --- a/native/Avalonia.Native/src/OSX/window.mm +++ b/native/Avalonia.Native/src/OSX/window.mm @@ -1590,7 +1590,12 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent if(_parent != nullptr) { - _lastKeyHandled = _parent->BaseEvents->RawKeyEvent(type, timestamp, modifiers, key); + auto handled = _parent->BaseEvents->RawKeyEvent(type, timestamp, modifiers, key); + if (key != LeftCtrl && key != RightCtrl) { + _lastKeyHandled = handled; + } else { + _lastKeyHandled = false; + } } } From c8f029386d88a62a9403c98adb52e519a5529ac3 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sat, 22 Jan 2022 14:01:35 +0300 Subject: [PATCH 002/393] Map devices, add some native api --- src/Avalonia.Input/IPenDevice.cs | 10 + src/Avalonia.Input/ITouchPadDevice.cs | 10 + src/Avalonia.Input/PenDevice.cs | 488 ++++++++++++++++++ src/Avalonia.Input/TouchPadDevice.cs | 488 ++++++++++++++++++ .../Interop/UnmanagedMethods.cs | 64 +++ .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 155 ++++++ 6 files changed, 1215 insertions(+) create mode 100644 src/Avalonia.Input/IPenDevice.cs create mode 100644 src/Avalonia.Input/ITouchPadDevice.cs create mode 100644 src/Avalonia.Input/PenDevice.cs create mode 100644 src/Avalonia.Input/TouchPadDevice.cs diff --git a/src/Avalonia.Input/IPenDevice.cs b/src/Avalonia.Input/IPenDevice.cs new file mode 100644 index 0000000000..1cc0fcf76d --- /dev/null +++ b/src/Avalonia.Input/IPenDevice.cs @@ -0,0 +1,10 @@ +namespace Avalonia.Input +{ + /// + /// Represents a pen/stylus device. + /// + public interface IPenDevice : IPointerDevice + { + + } +} diff --git a/src/Avalonia.Input/ITouchPadDevice.cs b/src/Avalonia.Input/ITouchPadDevice.cs new file mode 100644 index 0000000000..ea6c57f948 --- /dev/null +++ b/src/Avalonia.Input/ITouchPadDevice.cs @@ -0,0 +1,10 @@ +namespace Avalonia.Input +{ + /// + /// Represents a touch pad device. + /// + public interface ITouchPadDevice : IPointerDevice + { + + } +} diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs new file mode 100644 index 0000000000..dd3d60ebb9 --- /dev/null +++ b/src/Avalonia.Input/PenDevice.cs @@ -0,0 +1,488 @@ +using System; +using System.Linq; +using System.Reactive.Linq; +using Avalonia.Input.Raw; +using Avalonia.Interactivity; +using Avalonia.Platform; +using Avalonia.VisualTree; + +namespace Avalonia.Input +{ + /// + /// Represents a pen/stylus device. + /// + public class PenDevice : IPenDevice, IDisposable + { + private int _clickCount; + private Rect _lastClickRect; + private ulong _lastClickTime; + + private readonly Pointer _pointer; + private bool _disposed; + private PixelPoint? _position; + + public PenDevice(Pointer? pointer = null) + { + _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Mouse, true); + } + + /// + /// Gets the control that is currently capturing by the mouse, if any. + /// + /// + /// When an element captures the mouse, it receives mouse input whether the cursor is + /// within the control's bounds or not. To set the mouse capture, call the + /// method. + /// + [Obsolete("Use IPointer instead")] + public IInputElement? Captured => _pointer.Captured; + + /// + /// Gets the mouse position, in screen coordinates. + /// + [Obsolete("Use events instead")] + public PixelPoint Position + { + get => _position ?? new PixelPoint(-1, -1); + protected set => _position = value; + } + + /// + /// Captures mouse input to the specified control. + /// + /// The control. + /// + /// When an element captures the mouse, it receives mouse input whether the cursor is + /// within the control's bounds or not. The current mouse capture control is exposed + /// by the property. + /// + public void Capture(IInputElement? control) + { + _pointer.Capture(control); + } + + /// + /// Gets the mouse position relative to a control. + /// + /// The control. + /// The mouse position in the control's coordinates. + public Point GetPosition(IVisual relativeTo) + { + relativeTo = relativeTo ?? throw new ArgumentNullException(nameof(relativeTo)); + + if (relativeTo.VisualRoot == null) + { + throw new InvalidOperationException("Control is not attached to visual tree."); + } + +#pragma warning disable CS0618 // Type or member is obsolete + var rootPoint = relativeTo.VisualRoot.PointToClient(Position); +#pragma warning restore CS0618 // Type or member is obsolete + var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo); + return rootPoint * transform!.Value; + } + + public void ProcessRawEvent(RawInputEventArgs e) + { + if (!e.Handled && e is RawPointerEventArgs margs) + ProcessRawEvent(margs); + } + + public void TopLevelClosed(IInputRoot root) + { + ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); + } + + public void SceneInvalidated(IInputRoot root, Rect rect) + { + // Pointer is outside of the target area + if (_position == null ) + { + if (root.PointerOverElement != null) + ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); + return; + } + + + var clientPoint = root.PointToClient(_position.Value); + + if (rect.Contains(clientPoint)) + { + if (_pointer.Captured == null) + { + SetPointerOver(this, 0 /* TODO: proper timestamp */, root, clientPoint, + PointerPointProperties.None, KeyModifiers.None); + } + else + { + SetPointerOver(this, 0 /* TODO: proper timestamp */, root, _pointer.Captured, + PointerPointProperties.None, KeyModifiers.None); + } + } + } + + int ButtonCount(PointerPointProperties props) + { + var rv = 0; + if (props.IsLeftButtonPressed) + rv++; + if (props.IsMiddleButtonPressed) + rv++; + if (props.IsRightButtonPressed) + rv++; + if (props.IsXButton1Pressed) + rv++; + if (props.IsXButton2Pressed) + rv++; + return rv; + } + + private void ProcessRawEvent(RawPointerEventArgs e) + { + e = e ?? throw new ArgumentNullException(nameof(e)); + + var mouse = (PenDevice)e.Device; + if(mouse._disposed) + return; + + _position = e.Root.PointToScreen(e.Position); + var props = CreateProperties(e); + var keyModifiers = KeyModifiersUtils.ConvertToKey(e.InputModifiers); + switch (e.Type) + { + case RawPointerEventType.LeaveWindow: + LeaveWindow(mouse, e.Timestamp, e.Root, props, keyModifiers); + break; + case RawPointerEventType.LeftButtonDown: + case RawPointerEventType.RightButtonDown: + case RawPointerEventType.MiddleButtonDown: + case RawPointerEventType.XButton1Down: + case RawPointerEventType.XButton2Down: + if (ButtonCount(props) > 1) + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + else + e.Handled = MouseDown(mouse, e.Timestamp, e.Root, e.Position, + props, keyModifiers); + break; + case RawPointerEventType.LeftButtonUp: + case RawPointerEventType.RightButtonUp: + case RawPointerEventType.MiddleButtonUp: + case RawPointerEventType.XButton1Up: + case RawPointerEventType.XButton2Up: + if (ButtonCount(props) != 0) + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + else + e.Handled = MouseUp(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + break; + case RawPointerEventType.Move: + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + break; + case RawPointerEventType.Wheel: + e.Handled = MouseWheel(mouse, e.Timestamp, e.Root, e.Position, props, ((RawMouseWheelEventArgs)e).Delta, keyModifiers); + break; + } + } + + private void LeaveWindow(IPenDevice device, ulong timestamp, IInputRoot root, PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + _position = null; + ClearPointerOver(this, timestamp, root, properties, inputModifiers); + } + + + PointerPointProperties CreateProperties(RawPointerEventArgs args) + { + + var kind = PointerUpdateKind.Other; + + if (args.Type == RawPointerEventType.LeftButtonDown) + kind = PointerUpdateKind.LeftButtonPressed; + if (args.Type == RawPointerEventType.MiddleButtonDown) + kind = PointerUpdateKind.MiddleButtonPressed; + if (args.Type == RawPointerEventType.RightButtonDown) + kind = PointerUpdateKind.RightButtonPressed; + if (args.Type == RawPointerEventType.XButton1Down) + kind = PointerUpdateKind.XButton1Pressed; + if (args.Type == RawPointerEventType.XButton2Down) + kind = PointerUpdateKind.XButton2Pressed; + if (args.Type == RawPointerEventType.LeftButtonUp) + kind = PointerUpdateKind.LeftButtonReleased; + if (args.Type == RawPointerEventType.MiddleButtonUp) + kind = PointerUpdateKind.MiddleButtonReleased; + if (args.Type == RawPointerEventType.RightButtonUp) + kind = PointerUpdateKind.RightButtonReleased; + if (args.Type == RawPointerEventType.XButton1Up) + kind = PointerUpdateKind.XButton1Released; + if (args.Type == RawPointerEventType.XButton2Up) + kind = PointerUpdateKind.XButton2Released; + + return new PointerPointProperties(args.InputModifiers, kind); + } + + private MouseButton _lastMouseDownButton; + private bool MouseDown(IPenDevice device, ulong timestamp, IInputElement root, Point p, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + + if (hit != null) + { + _pointer.Capture(hit); + var source = GetSource(hit); + if (source != null) + { + var settings = AvaloniaLocator.Current.GetService(); + var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; + var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); + + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) + { + _clickCount = 0; + } + + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) + .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); + _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); + var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); + source.RaiseEvent(e); + return e.Handled; + } + } + + return false; + } + + private bool MouseMove(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + IInputElement? source; + + if (_pointer.Captured == null) + { + source = SetPointerOver(this, timestamp, root, p, properties, inputModifiers); + } + else + { + SetPointerOver(this, timestamp, root, _pointer.Captured, properties, inputModifiers); + source = _pointer.Captured; + } + + if (source is object) + { + var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, + p, timestamp, properties, inputModifiers); + + source.RaiseEvent(e); + return e.Handled; + } + + return false; + } + + private bool MouseUp(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + var source = GetSource(hit); + + if (source is not null) + { + var e = new PointerReleasedEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, + _lastMouseDownButton); + + source?.RaiseEvent(e); + _pointer.Capture(null); + return e.Handled; + } + + return false; + } + + private bool MouseWheel(IPenDevice device, ulong timestamp, IInputRoot root, Point p, + PointerPointProperties props, + Vector delta, KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + var source = GetSource(hit); + + if (source is not null) + { + var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); + + source?.RaiseEvent(e); + return e.Handled; + } + + return false; + } + + private IInteractive? GetSource(IVisual? hit) + { + if (hit is null) + return null; + + return _pointer.Captured ?? + (hit as IInteractive) ?? + hit.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); + } + + private IInputElement? HitTest(IInputElement root, Point p) + { + root = root ?? throw new ArgumentNullException(nameof(root)); + + return _pointer.Captured ?? root.InputHitTest(p); + } + + PointerEventArgs CreateSimpleEvent(RoutedEvent ev, ulong timestamp, IInteractive? source, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + return new PointerEventArgs(ev, source, _pointer, null, default, + timestamp, properties, inputModifiers); + } + + private void ClearPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var element = root.PointerOverElement; + var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, element, properties, inputModifiers); + + if (element!=null && !element.IsAttachedToVisualTree) + { + // element has been removed from visual tree so do top down cleanup + if (root.IsPointerOver) + ClearChildrenPointerOver(e, root,true); + } + while (element != null) + { + e.Source = element; + e.Handled = false; + element.RaiseEvent(e); + element = (IInputElement?)element.VisualParent; + } + + root.PointerOverElement = null; + } + + private void ClearChildrenPointerOver(PointerEventArgs e, IInputElement element,bool clearRoot) + { + foreach (IInputElement el in element.VisualChildren) + { + if (el.IsPointerOver) + { + ClearChildrenPointerOver(e, el, true); + break; + } + } + if(clearRoot) + { + e.Source = element; + e.Handled = false; + element.RaiseEvent(e); + } + } + + private IInputElement? SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, Point p, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var element = root.InputHitTest(p); + + if (element != root.PointerOverElement) + { + if (element != null) + { + SetPointerOver(device, timestamp, root, element, properties, inputModifiers); + } + else + { + ClearPointerOver(device, timestamp, root, properties, inputModifiers); + } + } + + return element; + } + + private void SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, IInputElement element, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + element = element ?? throw new ArgumentNullException(nameof(element)); + + IInputElement? branch = null; + + IInputElement? el = element; + + while (el != null) + { + if (el.IsPointerOver) + { + branch = el; + break; + } + el = (IInputElement?)el.VisualParent; + } + + el = root.PointerOverElement; + + var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, el, properties, inputModifiers); + if (el!=null && branch!=null && !el.IsAttachedToVisualTree) + { + ClearChildrenPointerOver(e,branch,false); + } + + while (el != null && el != branch) + { + e.Source = el; + e.Handled = false; + el.RaiseEvent(e); + el = (IInputElement?)el.VisualParent; + } + + el = root.PointerOverElement = element; + e.RoutedEvent = InputElement.PointerEnterEvent; + + while (el != null && el != branch) + { + e.Source = el; + e.Handled = false; + el.RaiseEvent(e); + el = (IInputElement?)el.VisualParent; + } + } + + public void Dispose() + { + _disposed = true; + _pointer?.Dispose(); + } + } +} diff --git a/src/Avalonia.Input/TouchPadDevice.cs b/src/Avalonia.Input/TouchPadDevice.cs new file mode 100644 index 0000000000..fcd254f588 --- /dev/null +++ b/src/Avalonia.Input/TouchPadDevice.cs @@ -0,0 +1,488 @@ +using System; +using System.Linq; +using System.Reactive.Linq; +using Avalonia.Input.Raw; +using Avalonia.Interactivity; +using Avalonia.Platform; +using Avalonia.VisualTree; + +namespace Avalonia.Input +{ + /// + /// Represents a touch pad device. + /// + public class TouchPadDevice : ITouchPadDevice, IDisposable + { + private int _clickCount; + private Rect _lastClickRect; + private ulong _lastClickTime; + + private readonly Pointer _pointer; + private bool _disposed; + private PixelPoint? _position; + + public TouchPadDevice(Pointer? pointer = null) + { + _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Mouse, true); + } + + /// + /// Gets the control that is currently capturing by the mouse, if any. + /// + /// + /// When an element captures the mouse, it receives mouse input whether the cursor is + /// within the control's bounds or not. To set the mouse capture, call the + /// method. + /// + [Obsolete("Use IPointer instead")] + public IInputElement? Captured => _pointer.Captured; + + /// + /// Gets the mouse position, in screen coordinates. + /// + [Obsolete("Use events instead")] + public PixelPoint Position + { + get => _position ?? new PixelPoint(-1, -1); + protected set => _position = value; + } + + /// + /// Captures mouse input to the specified control. + /// + /// The control. + /// + /// When an element captures the mouse, it receives mouse input whether the cursor is + /// within the control's bounds or not. The current mouse capture control is exposed + /// by the property. + /// + public void Capture(IInputElement? control) + { + _pointer.Capture(control); + } + + /// + /// Gets the mouse position relative to a control. + /// + /// The control. + /// The mouse position in the control's coordinates. + public Point GetPosition(IVisual relativeTo) + { + relativeTo = relativeTo ?? throw new ArgumentNullException(nameof(relativeTo)); + + if (relativeTo.VisualRoot == null) + { + throw new InvalidOperationException("Control is not attached to visual tree."); + } + +#pragma warning disable CS0618 // Type or member is obsolete + var rootPoint = relativeTo.VisualRoot.PointToClient(Position); +#pragma warning restore CS0618 // Type or member is obsolete + var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo); + return rootPoint * transform!.Value; + } + + public void ProcessRawEvent(RawInputEventArgs e) + { + if (!e.Handled && e is RawPointerEventArgs margs) + ProcessRawEvent(margs); + } + + public void TopLevelClosed(IInputRoot root) + { + ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); + } + + public void SceneInvalidated(IInputRoot root, Rect rect) + { + // Pointer is outside of the target area + if (_position == null ) + { + if (root.PointerOverElement != null) + ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); + return; + } + + + var clientPoint = root.PointToClient(_position.Value); + + if (rect.Contains(clientPoint)) + { + if (_pointer.Captured == null) + { + SetPointerOver(this, 0 /* TODO: proper timestamp */, root, clientPoint, + PointerPointProperties.None, KeyModifiers.None); + } + else + { + SetPointerOver(this, 0 /* TODO: proper timestamp */, root, _pointer.Captured, + PointerPointProperties.None, KeyModifiers.None); + } + } + } + + int ButtonCount(PointerPointProperties props) + { + var rv = 0; + if (props.IsLeftButtonPressed) + rv++; + if (props.IsMiddleButtonPressed) + rv++; + if (props.IsRightButtonPressed) + rv++; + if (props.IsXButton1Pressed) + rv++; + if (props.IsXButton2Pressed) + rv++; + return rv; + } + + private void ProcessRawEvent(RawPointerEventArgs e) + { + e = e ?? throw new ArgumentNullException(nameof(e)); + + var mouse = (TouchPadDevice)e.Device; + if(mouse._disposed) + return; + + _position = e.Root.PointToScreen(e.Position); + var props = CreateProperties(e); + var keyModifiers = KeyModifiersUtils.ConvertToKey(e.InputModifiers); + switch (e.Type) + { + case RawPointerEventType.LeaveWindow: + LeaveWindow(mouse, e.Timestamp, e.Root, props, keyModifiers); + break; + case RawPointerEventType.LeftButtonDown: + case RawPointerEventType.RightButtonDown: + case RawPointerEventType.MiddleButtonDown: + case RawPointerEventType.XButton1Down: + case RawPointerEventType.XButton2Down: + if (ButtonCount(props) > 1) + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + else + e.Handled = MouseDown(mouse, e.Timestamp, e.Root, e.Position, + props, keyModifiers); + break; + case RawPointerEventType.LeftButtonUp: + case RawPointerEventType.RightButtonUp: + case RawPointerEventType.MiddleButtonUp: + case RawPointerEventType.XButton1Up: + case RawPointerEventType.XButton2Up: + if (ButtonCount(props) != 0) + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + else + e.Handled = MouseUp(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + break; + case RawPointerEventType.Move: + e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + break; + case RawPointerEventType.Wheel: + e.Handled = MouseWheel(mouse, e.Timestamp, e.Root, e.Position, props, ((RawMouseWheelEventArgs)e).Delta, keyModifiers); + break; + } + } + + private void LeaveWindow(ITouchPadDevice device, ulong timestamp, IInputRoot root, PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + _position = null; + ClearPointerOver(this, timestamp, root, properties, inputModifiers); + } + + + PointerPointProperties CreateProperties(RawPointerEventArgs args) + { + + var kind = PointerUpdateKind.Other; + + if (args.Type == RawPointerEventType.LeftButtonDown) + kind = PointerUpdateKind.LeftButtonPressed; + if (args.Type == RawPointerEventType.MiddleButtonDown) + kind = PointerUpdateKind.MiddleButtonPressed; + if (args.Type == RawPointerEventType.RightButtonDown) + kind = PointerUpdateKind.RightButtonPressed; + if (args.Type == RawPointerEventType.XButton1Down) + kind = PointerUpdateKind.XButton1Pressed; + if (args.Type == RawPointerEventType.XButton2Down) + kind = PointerUpdateKind.XButton2Pressed; + if (args.Type == RawPointerEventType.LeftButtonUp) + kind = PointerUpdateKind.LeftButtonReleased; + if (args.Type == RawPointerEventType.MiddleButtonUp) + kind = PointerUpdateKind.MiddleButtonReleased; + if (args.Type == RawPointerEventType.RightButtonUp) + kind = PointerUpdateKind.RightButtonReleased; + if (args.Type == RawPointerEventType.XButton1Up) + kind = PointerUpdateKind.XButton1Released; + if (args.Type == RawPointerEventType.XButton2Up) + kind = PointerUpdateKind.XButton2Released; + + return new PointerPointProperties(args.InputModifiers, kind); + } + + private MouseButton _lastMouseDownButton; + private bool MouseDown(ITouchPadDevice device, ulong timestamp, IInputElement root, Point p, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + + if (hit != null) + { + _pointer.Capture(hit); + var source = GetSource(hit); + if (source != null) + { + var settings = AvaloniaLocator.Current.GetService(); + var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; + var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); + + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) + { + _clickCount = 0; + } + + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) + .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); + _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); + var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); + source.RaiseEvent(e); + return e.Handled; + } + } + + return false; + } + + private bool MouseMove(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + IInputElement? source; + + if (_pointer.Captured == null) + { + source = SetPointerOver(this, timestamp, root, p, properties, inputModifiers); + } + else + { + SetPointerOver(this, timestamp, root, _pointer.Captured, properties, inputModifiers); + source = _pointer.Captured; + } + + if (source is object) + { + var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, + p, timestamp, properties, inputModifiers); + + source.RaiseEvent(e); + return e.Handled; + } + + return false; + } + + private bool MouseUp(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + var source = GetSource(hit); + + if (source is not null) + { + var e = new PointerReleasedEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, + _lastMouseDownButton); + + source?.RaiseEvent(e); + _pointer.Capture(null); + return e.Handled; + } + + return false; + } + + private bool MouseWheel(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, + PointerPointProperties props, + Vector delta, KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var hit = HitTest(root, p); + var source = GetSource(hit); + + if (source is not null) + { + var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); + + source?.RaiseEvent(e); + return e.Handled; + } + + return false; + } + + private IInteractive? GetSource(IVisual? hit) + { + if (hit is null) + return null; + + return _pointer.Captured ?? + (hit as IInteractive) ?? + hit.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); + } + + private IInputElement? HitTest(IInputElement root, Point p) + { + root = root ?? throw new ArgumentNullException(nameof(root)); + + return _pointer.Captured ?? root.InputHitTest(p); + } + + PointerEventArgs CreateSimpleEvent(RoutedEvent ev, ulong timestamp, IInteractive? source, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + return new PointerEventArgs(ev, source, _pointer, null, default, + timestamp, properties, inputModifiers); + } + + private void ClearPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var element = root.PointerOverElement; + var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, element, properties, inputModifiers); + + if (element!=null && !element.IsAttachedToVisualTree) + { + // element has been removed from visual tree so do top down cleanup + if (root.IsPointerOver) + ClearChildrenPointerOver(e, root,true); + } + while (element != null) + { + e.Source = element; + e.Handled = false; + element.RaiseEvent(e); + element = (IInputElement?)element.VisualParent; + } + + root.PointerOverElement = null; + } + + private void ClearChildrenPointerOver(PointerEventArgs e, IInputElement element,bool clearRoot) + { + foreach (IInputElement el in element.VisualChildren) + { + if (el.IsPointerOver) + { + ClearChildrenPointerOver(e, el, true); + break; + } + } + if(clearRoot) + { + e.Source = element; + e.Handled = false; + element.RaiseEvent(e); + } + } + + private IInputElement? SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, Point p, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + + var element = root.InputHitTest(p); + + if (element != root.PointerOverElement) + { + if (element != null) + { + SetPointerOver(device, timestamp, root, element, properties, inputModifiers); + } + else + { + ClearPointerOver(device, timestamp, root, properties, inputModifiers); + } + } + + return element; + } + + private void SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, IInputElement element, + PointerPointProperties properties, + KeyModifiers inputModifiers) + { + device = device ?? throw new ArgumentNullException(nameof(device)); + root = root ?? throw new ArgumentNullException(nameof(root)); + element = element ?? throw new ArgumentNullException(nameof(element)); + + IInputElement? branch = null; + + IInputElement? el = element; + + while (el != null) + { + if (el.IsPointerOver) + { + branch = el; + break; + } + el = (IInputElement?)el.VisualParent; + } + + el = root.PointerOverElement; + + var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, el, properties, inputModifiers); + if (el!=null && branch!=null && !el.IsAttachedToVisualTree) + { + ClearChildrenPointerOver(e,branch,false); + } + + while (el != null && el != branch) + { + e.Source = el; + e.Handled = false; + el.RaiseEvent(e); + el = (IInputElement?)el.VisualParent; + } + + el = root.PointerOverElement = element; + e.RoutedEvent = InputElement.PointerEnterEvent; + + while (el != null && el != branch) + { + e.Source = el; + e.Handled = false; + el.RaiseEvent(e); + el = (IInputElement?)el.VisualParent; + } + } + + public void Dispose() + { + _disposed = true; + _pointer?.Dispose(); + } + } +} diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index c74c5fbc01..db81e8197f 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -514,6 +514,33 @@ namespace Avalonia.Win32.Interop CS_DROPSHADOW = 0x00020000 } + [Flags] + public enum PointerDeviceChangeFlags + { + PDC_ARRIVAL = 0x001, + PDC_REMOVAL = 0x002, + PDC_ORIENTATION_0 = 0x004, + PDC_ORIENTATION_90 = 0x008, + PDC_ORIENTATION_180 = 0x010, + PDC_ORIENTATION_270 = 0x020, + PDC_MODE_DEFAULT = 0x040, + PDC_MODE_CENTERED = 0x080, + PDC_MAPPING_CHANGE = 0x100, + PDC_RESOLUTION = 0x200, + PDC_ORIGIN = 0x400, + PDC_MODE_ASPECTRATIOPRESERVED = 0x800 + } + + public enum InputType + { + NONE = 0x00000000, + POINTER = 0x00000001, + TOUCH = 0x00000002, + PEN = 0x00000003, + MOUSE = 0x00000004, + TOUCHPAD = 0x00000005 + } + public enum WindowsMessage : uint { WM_NULL = 0x0000, @@ -689,6 +716,25 @@ namespace Avalonia.Win32.Interop WM_EXITSIZEMOVE = 0x0232, WM_DROPFILES = 0x0233, WM_MDIREFRESHMENU = 0x0234, + + WM_POINTERDEVICECHANGE = 0x0238, + WM_POINTERDEVICEINRANGE = 0x239, + WM_POINTERDEVICEOUTOFRANGE = 0x23A, + WM_NCPOINTERUPDATE = 0x0241, + WM_NCPOINTERDOWN = 0x0242, + WM_NCPOINTERUP = 0x0243, + WM_POINTERUPDATE = 0x0245, + WM_POINTERDOWN = 0x0246, + WM_POINTERUP = 0x0247, + WM_POINTERENTER = 0x0249, + WM_POINTERLEAVE = 0x024A, + WM_POINTERACTIVATE = 0x024B, + WM_POINTERCAPTURECHANGED = 0x024C, + WM_TOUCHHITTESTING = 0x024D, + WM_POINTERWHEEL = 0x024E, + WM_POINTERHWHEEL = 0x024F, + WM_POINTERHITTEST = 0x0250, + WM_IME_SETCONTEXT = 0x0281, WM_IME_NOTIFY = 0x0282, WM_IME_CONTROL = 0x0283, @@ -903,6 +949,24 @@ namespace Avalonia.Win32.Interop public const int SizeOf_BITMAPINFOHEADER = 40; + [DllImport("user32.dll", SetLastError = true)] + public static extern int EnableMouseInPointer(bool enable); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetPointerCursorId(uint pointerID, out uint cursorId); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetPointerType(uint pointerID, out InputType pointerType); + + [DllImport("user32.dll", SetLastError = true)] + public static extern void GetUnpredictedMessagePos(); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool IsMouseInPointerEnabled(); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool SkipPointerFrameMessages(uint pointerID); + [DllImport("user32.dll")] public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumDelegate lpfnEnum, IntPtr dwData); diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 88a0744e3e..e16901af2c 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -166,6 +166,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONDOWN: case WindowsMessage.WM_XBUTTONDOWN: { + if (BelowWin8) + { + break; + } shouldTakeFocus = ShouldTakeFocusOnClick; if (ShouldIgnoreTouchEmulatedMessage()) { @@ -195,6 +199,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONUP: case WindowsMessage.WM_XBUTTONUP: { + if (BelowWin8) + { + break; + } if (ShouldIgnoreTouchEmulatedMessage()) { break; @@ -219,11 +227,19 @@ namespace Avalonia.Win32 } // Mouse capture is lost case WindowsMessage.WM_CANCELMODE: + if (BelowWin8) + { + break; + } _mouseDevice.Capture(null); break; case WindowsMessage.WM_MOUSEMOVE: { + if (BelowWin8) + { + break; + } if (ShouldIgnoreTouchEmulatedMessage()) { break; @@ -254,6 +270,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEWHEEL: { + if (BelowWin8) + { + break; + } e = new RawMouseWheelEventArgs( _mouseDevice, timestamp, @@ -265,6 +285,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEHWHEEL: { + if (BelowWin8) + { + break; + } e = new RawMouseWheelEventArgs( _mouseDevice, timestamp, @@ -276,6 +300,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSELEAVE: { + if (BelowWin8) + { + break; + } _trackingMouse = false; e = new RawPointerEventArgs( _mouseDevice, @@ -291,6 +319,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCMBUTTONDOWN: case WindowsMessage.WM_NCXBUTTONDOWN: { + if (BelowWin8) + { + break; + } e = new RawPointerEventArgs( _mouseDevice, timestamp, @@ -311,6 +343,10 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_TOUCH: { + if (BelowWin8) + { + break; + } var touchInputCount = wParam.ToInt32(); var pTouchInputs = stackalloc TOUCHINPUT[touchInputCount]; @@ -338,6 +374,117 @@ namespace Avalonia.Win32 break; } + + + + + + + + + + + + case WindowsMessage.WM_POINTERDEVICECHANGE: + case WindowsMessage.WM_POINTERDEVICEINRANGE: + case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: + { + + break; + } + case WindowsMessage.WM_NCPOINTERUPDATE: + case WindowsMessage.WM_NCPOINTERDOWN: + case WindowsMessage.WM_NCPOINTERUP: + { + + break; + } + case WindowsMessage.WM_POINTERUPDATE: + case WindowsMessage.WM_POINTERDOWN: + case WindowsMessage.WM_POINTERUP: + { + + break; + } + case WindowsMessage.WM_POINTERENTER: + case WindowsMessage.WM_POINTERLEAVE: + { + + break; + } + case WindowsMessage.WM_POINTERACTIVATE: + case WindowsMessage.WM_POINTERCAPTURECHANGED: + { + + break; + } + case WindowsMessage.WM_TOUCHHITTESTING: + { + + break; + } + case WindowsMessage.WM_POINTERWHEEL: + { + var pointerId = ToPointerId(wParam); + GetPointerType(pointerId, out var type); + IInputDevice device = _mouseDevice; + switch (type) + { + case InputType.PEN: + + break; + case InputType.TOUCH: + device = _touchDevice; + break; + case InputType.TOUCHPAD: + + break; + } + + + var delta = GetWheelDelta(wParam); + var point = PointFromLParam(lParam); + e = new RawMouseWheelEventArgs( + _mouseDevice, + timestamp, + _owner, + PointToClient(point), + new Vector(0, delta / wheelDelta), + GetMouseModifiers(wParam)); + break; + } + case WindowsMessage.WM_POINTERHWHEEL: + { + + break; + } + case WindowsMessage.WM_POINTERHITTEST: + { + + break; + } + + + + + + + + + + + + + + + + + + + + + + case WindowsMessage.WM_NCPAINT: { if (!HasFullDecorations) @@ -540,6 +687,14 @@ namespace Avalonia.Win32 } } + public static uint GetWheelDelta(IntPtr wParam) => HIWORD(wParam); + public static uint ToPointerId(IntPtr wParam) => LOWORD(wParam); + public static uint LOWORD(IntPtr param) => (uint)param & 0xffff; + public static uint HIWORD(IntPtr param) => (uint)param >> 16; + + + public bool BelowWin8 => Win32Platform.WindowsVersion < PlatformConstants.Windows8; + private void UpdateInputMethod(IntPtr hkl) { // note: for non-ime language, also create it so that emoji panel tracks cursor From 44fda62a9b93cb0f3f6c0096cbfc654f378ab919 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sat, 22 Jan 2022 16:56:47 +0300 Subject: [PATCH 003/393] Add PointerInfo, TouchInfo and PenInfo --- src/Avalonia.Input/ITouchPadDevice.cs | 10 - src/Avalonia.Input/TouchPadDevice.cs | 488 ------------------ .../Interop/UnmanagedMethods.cs | 166 +++++- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 14 +- src/Windows/Avalonia.Win32/WindowImpl.cs | 2 + 5 files changed, 159 insertions(+), 521 deletions(-) delete mode 100644 src/Avalonia.Input/ITouchPadDevice.cs delete mode 100644 src/Avalonia.Input/TouchPadDevice.cs diff --git a/src/Avalonia.Input/ITouchPadDevice.cs b/src/Avalonia.Input/ITouchPadDevice.cs deleted file mode 100644 index ea6c57f948..0000000000 --- a/src/Avalonia.Input/ITouchPadDevice.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Avalonia.Input -{ - /// - /// Represents a touch pad device. - /// - public interface ITouchPadDevice : IPointerDevice - { - - } -} diff --git a/src/Avalonia.Input/TouchPadDevice.cs b/src/Avalonia.Input/TouchPadDevice.cs deleted file mode 100644 index fcd254f588..0000000000 --- a/src/Avalonia.Input/TouchPadDevice.cs +++ /dev/null @@ -1,488 +0,0 @@ -using System; -using System.Linq; -using System.Reactive.Linq; -using Avalonia.Input.Raw; -using Avalonia.Interactivity; -using Avalonia.Platform; -using Avalonia.VisualTree; - -namespace Avalonia.Input -{ - /// - /// Represents a touch pad device. - /// - public class TouchPadDevice : ITouchPadDevice, IDisposable - { - private int _clickCount; - private Rect _lastClickRect; - private ulong _lastClickTime; - - private readonly Pointer _pointer; - private bool _disposed; - private PixelPoint? _position; - - public TouchPadDevice(Pointer? pointer = null) - { - _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Mouse, true); - } - - /// - /// Gets the control that is currently capturing by the mouse, if any. - /// - /// - /// When an element captures the mouse, it receives mouse input whether the cursor is - /// within the control's bounds or not. To set the mouse capture, call the - /// method. - /// - [Obsolete("Use IPointer instead")] - public IInputElement? Captured => _pointer.Captured; - - /// - /// Gets the mouse position, in screen coordinates. - /// - [Obsolete("Use events instead")] - public PixelPoint Position - { - get => _position ?? new PixelPoint(-1, -1); - protected set => _position = value; - } - - /// - /// Captures mouse input to the specified control. - /// - /// The control. - /// - /// When an element captures the mouse, it receives mouse input whether the cursor is - /// within the control's bounds or not. The current mouse capture control is exposed - /// by the property. - /// - public void Capture(IInputElement? control) - { - _pointer.Capture(control); - } - - /// - /// Gets the mouse position relative to a control. - /// - /// The control. - /// The mouse position in the control's coordinates. - public Point GetPosition(IVisual relativeTo) - { - relativeTo = relativeTo ?? throw new ArgumentNullException(nameof(relativeTo)); - - if (relativeTo.VisualRoot == null) - { - throw new InvalidOperationException("Control is not attached to visual tree."); - } - -#pragma warning disable CS0618 // Type or member is obsolete - var rootPoint = relativeTo.VisualRoot.PointToClient(Position); -#pragma warning restore CS0618 // Type or member is obsolete - var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo); - return rootPoint * transform!.Value; - } - - public void ProcessRawEvent(RawInputEventArgs e) - { - if (!e.Handled && e is RawPointerEventArgs margs) - ProcessRawEvent(margs); - } - - public void TopLevelClosed(IInputRoot root) - { - ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); - } - - public void SceneInvalidated(IInputRoot root, Rect rect) - { - // Pointer is outside of the target area - if (_position == null ) - { - if (root.PointerOverElement != null) - ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); - return; - } - - - var clientPoint = root.PointToClient(_position.Value); - - if (rect.Contains(clientPoint)) - { - if (_pointer.Captured == null) - { - SetPointerOver(this, 0 /* TODO: proper timestamp */, root, clientPoint, - PointerPointProperties.None, KeyModifiers.None); - } - else - { - SetPointerOver(this, 0 /* TODO: proper timestamp */, root, _pointer.Captured, - PointerPointProperties.None, KeyModifiers.None); - } - } - } - - int ButtonCount(PointerPointProperties props) - { - var rv = 0; - if (props.IsLeftButtonPressed) - rv++; - if (props.IsMiddleButtonPressed) - rv++; - if (props.IsRightButtonPressed) - rv++; - if (props.IsXButton1Pressed) - rv++; - if (props.IsXButton2Pressed) - rv++; - return rv; - } - - private void ProcessRawEvent(RawPointerEventArgs e) - { - e = e ?? throw new ArgumentNullException(nameof(e)); - - var mouse = (TouchPadDevice)e.Device; - if(mouse._disposed) - return; - - _position = e.Root.PointToScreen(e.Position); - var props = CreateProperties(e); - var keyModifiers = KeyModifiersUtils.ConvertToKey(e.InputModifiers); - switch (e.Type) - { - case RawPointerEventType.LeaveWindow: - LeaveWindow(mouse, e.Timestamp, e.Root, props, keyModifiers); - break; - case RawPointerEventType.LeftButtonDown: - case RawPointerEventType.RightButtonDown: - case RawPointerEventType.MiddleButtonDown: - case RawPointerEventType.XButton1Down: - case RawPointerEventType.XButton2Down: - if (ButtonCount(props) > 1) - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - else - e.Handled = MouseDown(mouse, e.Timestamp, e.Root, e.Position, - props, keyModifiers); - break; - case RawPointerEventType.LeftButtonUp: - case RawPointerEventType.RightButtonUp: - case RawPointerEventType.MiddleButtonUp: - case RawPointerEventType.XButton1Up: - case RawPointerEventType.XButton2Up: - if (ButtonCount(props) != 0) - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - else - e.Handled = MouseUp(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - break; - case RawPointerEventType.Move: - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - break; - case RawPointerEventType.Wheel: - e.Handled = MouseWheel(mouse, e.Timestamp, e.Root, e.Position, props, ((RawMouseWheelEventArgs)e).Delta, keyModifiers); - break; - } - } - - private void LeaveWindow(ITouchPadDevice device, ulong timestamp, IInputRoot root, PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - _position = null; - ClearPointerOver(this, timestamp, root, properties, inputModifiers); - } - - - PointerPointProperties CreateProperties(RawPointerEventArgs args) - { - - var kind = PointerUpdateKind.Other; - - if (args.Type == RawPointerEventType.LeftButtonDown) - kind = PointerUpdateKind.LeftButtonPressed; - if (args.Type == RawPointerEventType.MiddleButtonDown) - kind = PointerUpdateKind.MiddleButtonPressed; - if (args.Type == RawPointerEventType.RightButtonDown) - kind = PointerUpdateKind.RightButtonPressed; - if (args.Type == RawPointerEventType.XButton1Down) - kind = PointerUpdateKind.XButton1Pressed; - if (args.Type == RawPointerEventType.XButton2Down) - kind = PointerUpdateKind.XButton2Pressed; - if (args.Type == RawPointerEventType.LeftButtonUp) - kind = PointerUpdateKind.LeftButtonReleased; - if (args.Type == RawPointerEventType.MiddleButtonUp) - kind = PointerUpdateKind.MiddleButtonReleased; - if (args.Type == RawPointerEventType.RightButtonUp) - kind = PointerUpdateKind.RightButtonReleased; - if (args.Type == RawPointerEventType.XButton1Up) - kind = PointerUpdateKind.XButton1Released; - if (args.Type == RawPointerEventType.XButton2Up) - kind = PointerUpdateKind.XButton2Released; - - return new PointerPointProperties(args.InputModifiers, kind); - } - - private MouseButton _lastMouseDownButton; - private bool MouseDown(ITouchPadDevice device, ulong timestamp, IInputElement root, Point p, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); - - if (hit != null) - { - _pointer.Capture(hit); - var source = GetSource(hit); - if (source != null) - { - var settings = AvaloniaLocator.Current.GetService(); - var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; - var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); - - if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) - { - _clickCount = 0; - } - - ++_clickCount; - _lastClickTime = timestamp; - _lastClickRect = new Rect(p, new Size()) - .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); - _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); - var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); - source.RaiseEvent(e); - return e.Handled; - } - } - - return false; - } - - private bool MouseMove(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - IInputElement? source; - - if (_pointer.Captured == null) - { - source = SetPointerOver(this, timestamp, root, p, properties, inputModifiers); - } - else - { - SetPointerOver(this, timestamp, root, _pointer.Captured, properties, inputModifiers); - source = _pointer.Captured; - } - - if (source is object) - { - var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, - p, timestamp, properties, inputModifiers); - - source.RaiseEvent(e); - return e.Handled; - } - - return false; - } - - private bool MouseUp(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); - var source = GetSource(hit); - - if (source is not null) - { - var e = new PointerReleasedEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, - _lastMouseDownButton); - - source?.RaiseEvent(e); - _pointer.Capture(null); - return e.Handled; - } - - return false; - } - - private bool MouseWheel(ITouchPadDevice device, ulong timestamp, IInputRoot root, Point p, - PointerPointProperties props, - Vector delta, KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); - var source = GetSource(hit); - - if (source is not null) - { - var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); - - source?.RaiseEvent(e); - return e.Handled; - } - - return false; - } - - private IInteractive? GetSource(IVisual? hit) - { - if (hit is null) - return null; - - return _pointer.Captured ?? - (hit as IInteractive) ?? - hit.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); - } - - private IInputElement? HitTest(IInputElement root, Point p) - { - root = root ?? throw new ArgumentNullException(nameof(root)); - - return _pointer.Captured ?? root.InputHitTest(p); - } - - PointerEventArgs CreateSimpleEvent(RoutedEvent ev, ulong timestamp, IInteractive? source, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - return new PointerEventArgs(ev, source, _pointer, null, default, - timestamp, properties, inputModifiers); - } - - private void ClearPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var element = root.PointerOverElement; - var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, element, properties, inputModifiers); - - if (element!=null && !element.IsAttachedToVisualTree) - { - // element has been removed from visual tree so do top down cleanup - if (root.IsPointerOver) - ClearChildrenPointerOver(e, root,true); - } - while (element != null) - { - e.Source = element; - e.Handled = false; - element.RaiseEvent(e); - element = (IInputElement?)element.VisualParent; - } - - root.PointerOverElement = null; - } - - private void ClearChildrenPointerOver(PointerEventArgs e, IInputElement element,bool clearRoot) - { - foreach (IInputElement el in element.VisualChildren) - { - if (el.IsPointerOver) - { - ClearChildrenPointerOver(e, el, true); - break; - } - } - if(clearRoot) - { - e.Source = element; - e.Handled = false; - element.RaiseEvent(e); - } - } - - private IInputElement? SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, Point p, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var element = root.InputHitTest(p); - - if (element != root.PointerOverElement) - { - if (element != null) - { - SetPointerOver(device, timestamp, root, element, properties, inputModifiers); - } - else - { - ClearPointerOver(device, timestamp, root, properties, inputModifiers); - } - } - - return element; - } - - private void SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, IInputElement element, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - element = element ?? throw new ArgumentNullException(nameof(element)); - - IInputElement? branch = null; - - IInputElement? el = element; - - while (el != null) - { - if (el.IsPointerOver) - { - branch = el; - break; - } - el = (IInputElement?)el.VisualParent; - } - - el = root.PointerOverElement; - - var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, el, properties, inputModifiers); - if (el!=null && branch!=null && !el.IsAttachedToVisualTree) - { - ClearChildrenPointerOver(e,branch,false); - } - - while (el != null && el != branch) - { - e.Source = el; - e.Handled = false; - el.RaiseEvent(e); - el = (IInputElement?)el.VisualParent; - } - - el = root.PointerOverElement = element; - e.RoutedEvent = InputElement.PointerEnterEvent; - - while (el != null && el != branch) - { - e.Source = el; - e.Handled = false; - el.RaiseEvent(e); - el = (IInputElement?)el.VisualParent; - } - } - - public void Dispose() - { - _disposed = true; - _pointer?.Dispose(); - } - } -} diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index db81e8197f..5aecd8e8f0 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -225,20 +225,17 @@ namespace Avalonia.Win32.Interop [Flags] public enum ModifierKeys { - MK_CONTROL = 0x0008, + MK_NONE = 0x0001, MK_LBUTTON = 0x0001, - - MK_MBUTTON = 0x0010, - MK_RBUTTON = 0x0002, - MK_SHIFT = 0x0004, - - MK_ALT = 0x0020, + MK_SHIFT = 0x0004, + MK_CONTROL = 0x0008, + MK_MBUTTON = 0x0010, + MK_ALT = 0x0020, MK_XBUTTON1 = 0x0020, - MK_XBUTTON2 = 0x0040 } @@ -531,14 +528,14 @@ namespace Avalonia.Win32.Interop PDC_MODE_ASPECTRATIOPRESERVED = 0x800 } - public enum InputType + public enum PointerInputType { - NONE = 0x00000000, - POINTER = 0x00000001, - TOUCH = 0x00000002, - PEN = 0x00000003, - MOUSE = 0x00000004, - TOUCHPAD = 0x00000005 + PT_NONE = 0x00000000, + PT_POINTER = 0x00000001, + PT_TOUCH = 0x00000002, + PT_PEN = 0x00000003, + PT_MOUSE = 0x00000004, + PT_TOUCHPAD = 0x00000005 } public enum WindowsMessage : uint @@ -882,6 +879,134 @@ namespace Avalonia.Win32.Interop SCF_ISSECURE = 0x00000001, } + [Flags] + public enum PointerFlags + { + POINTER_FLAG_NONE = 0x00000000, + POINTER_FLAG_NEW = 0x00000001, + POINTER_FLAG_INRANGE = 0x00000002, + POINTER_FLAG_INCONTACT = 0x00000004, + POINTER_FLAG_FIRSTBUTTON = 0x00000010, + POINTER_FLAG_SECONDBUTTON = 0x00000020, + POINTER_FLAG_THIRDBUTTON = 0x00000040, + POINTER_FLAG_FOURTHBUTTON = 0x00000080, + POINTER_FLAG_FIFTHBUTTON = 0x00000100, + POINTER_FLAG_PRIMARY = 0x00002000, + POINTER_FLAG_CONFIDENCE = 0x00000400, + POINTER_FLAG_CANCELED = 0x00000800, + POINTER_FLAG_DOWN = 0x00010000, + POINTER_FLAG_UPDATE = 0x00020000, + POINTER_FLAG_UP = 0x00040000, + POINTER_FLAG_WHEEL = 0x00080000, + POINTER_FLAG_HWHEEL = 0x00100000, + POINTER_FLAG_CAPTURECHANGED = 0x00200000, + POINTER_FLAG_HASTRANSFORM = 0x00400000 + } + + public enum PointerButtonChangeType : ulong + { + POINTER_CHANGE_NONE, + POINTER_CHANGE_FIRSTBUTTON_DOWN, + POINTER_CHANGE_FIRSTBUTTON_UP, + POINTER_CHANGE_SECONDBUTTON_DOWN, + POINTER_CHANGE_SECONDBUTTON_UP, + POINTER_CHANGE_THIRDBUTTON_DOWN, + POINTER_CHANGE_THIRDBUTTON_UP, + POINTER_CHANGE_FOURTHBUTTON_DOWN, + POINTER_CHANGE_FOURTHBUTTON_UP, + POINTER_CHANGE_FIFTHBUTTON_DOWN, + POINTER_CHANGE_FIFTHBUTTON_UP + } + + [Flags] + public enum PenFlags + { + PEN_FLAGS_NONE = 0x00000000, + PEN_FLAGS_BARREL = 0x00000001, + PEN_FLAGS_INVERTED = 0x00000002, + PEN_FLAGS_ERASER = 0x00000004, + } + + [Flags] + public enum PenMask + { + PEN_MASK_NONE = 0x00000000, + PEN_MASK_PRESSURE = 0x00000001, + PEN_MASK_ROTATION = 0x00000002, + PEN_MASK_TILT_X = 0x00000004, + PEN_MASK_TILT_Y = 0x00000008 + } + + [Flags] + public enum TouchFlags + { + TOUCH_FLAG_NONE = 0x00000000 + } + + [Flags] + public enum TouchMask + { + TOUCH_MASK_NONE = 0x00000000, + TOUCH_MASK_CONTACTAREA = 0x00000001, + TOUCH_MASK_ORIENTATION = 0x00000002, + TOUCH_MASK_PRESSURE = 0x00000004, + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POINTER_TOUCH_INFO + { + public POINTER_INFO pointerInfo; + public TouchFlags touchFlags; + public TouchMask touchMask; + public int rcContactLeft; + public int rcContactTop; + public int rcContactRight; + public int rcContactBottom; + public int rcContactRawLeft; + public int rcContactRawTop; + public int rcContactRawRight; + public int rcContactRawBottom; + public uint orientation; + public uint pressure; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POINTER_PEN_INFO + { + public POINTER_INFO pointerInfo; + public PenFlags penFlags; + public PenMask penMask; + public uint pressure; + public uint rotation; + public int tiltX; + public int tiltY; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct POINTER_INFO + { + public PointerInputType pointerType; + public uint pointerId; + public uint frameId; + public PointerFlags pointerFlags; + public IntPtr sourceDevice; + public IntPtr hwndTarget; + public int ptPixelLocationX; + public int ptPixelLocationY; + public int ptHimetricLocationX; + public int ptHimetricLocationY; + public int ptPixelLocationRawX; + public int ptPixelLocationRawY; + public int ptHimetricLocationRawX; + public int ptHimetricLocationRawY; + public uint dwTime; + public uint historyCount; + public int inputData; + public ModifierKeys dwKeyStates; + public UInt64 PerformanceCount; + public PointerButtonChangeType ButtonChangeType; + } + [StructLayout(LayoutKind.Sequential)] public struct RGBQUAD { @@ -956,7 +1081,16 @@ namespace Avalonia.Win32.Interop public static extern bool GetPointerCursorId(uint pointerID, out uint cursorId); [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetPointerType(uint pointerID, out InputType pointerType); + public static extern bool GetPointerType(uint pointerID, out PointerInputType pointerType); + + [DllImport("User32.dll", SetLastError = true)] + public static extern bool GetPointerInfo(uint pointerID, out POINTER_INFO pointerInfo); + + [DllImport("User32.dll", SetLastError = true)] + public static extern bool GetPointerPenInfo(uint pointerID, out POINTER_PEN_INFO penInfo); + + [DllImport("User32.dll", SetLastError = true)] + public static extern bool GetPointerTouchInfo(uint pointerID, out POINTER_TOUCH_INFO touchInfo); [DllImport("user32.dll", SetLastError = true)] public static extern void GetUnpredictedMessagePos(); diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index e16901af2c..8a0654a9ba 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -427,17 +427,17 @@ namespace Avalonia.Win32 { var pointerId = ToPointerId(wParam); GetPointerType(pointerId, out var type); - IInputDevice device = _mouseDevice; + IInputDevice device; switch (type) { - case InputType.PEN: - + case PointerInputType.PT_PEN: + device = _penDevice; break; - case InputType.TOUCH: + case PointerInputType.PT_TOUCH: device = _touchDevice; break; - case InputType.TOUCHPAD: - + default: + device = _mouseDevice; break; } @@ -445,7 +445,7 @@ namespace Avalonia.Win32 var delta = GetWheelDelta(wParam); var point = PointFromLParam(lParam); e = new RawMouseWheelEventArgs( - _mouseDevice, + device, timestamp, _owner, PointToClient(point), diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index e4f5268285..8f6a7e9741 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -64,6 +64,7 @@ namespace Avalonia.Win32 private const WindowStyles WindowStateMask = (WindowStyles.WS_MAXIMIZE | WindowStyles.WS_MINIMIZE); private readonly TouchDevice _touchDevice; private readonly MouseDevice _mouseDevice; + private readonly PenDevice _penDevice; private readonly ManagedDeferredRendererLock _rendererLock; private readonly FramebufferManager _framebuffer; private readonly IGlPlatformSurface _gl; @@ -96,6 +97,7 @@ namespace Avalonia.Win32 { _touchDevice = new TouchDevice(); _mouseDevice = new WindowsMouseDevice(); + _penDevice = new PenDevice(); #if USE_MANAGED_DRAG _managedDrag = new ManagedWindowResizeDragHelper(this, capture => From 1192e86d90f0d6f4df29acc442a21031e7fb0c3e Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sat, 22 Jan 2022 18:39:36 +0300 Subject: [PATCH 004/393] Investigate all the messages and note short comments about them and provide a link to a documentation. In case anyone will need this in the future --- .../Interop/UnmanagedMethods.cs | 2 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 139 ++++++++++++------ src/Windows/Avalonia.Win32/WindowImpl.cs | 2 +- 3 files changed, 99 insertions(+), 44 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index 5aecd8e8f0..93457f7bbd 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -730,7 +730,7 @@ namespace Avalonia.Win32.Interop WM_TOUCHHITTESTING = 0x024D, WM_POINTERWHEEL = 0x024E, WM_POINTERHWHEEL = 0x024F, - WM_POINTERHITTEST = 0x0250, + DM_POINTERHITTEST = 0x0250, WM_IME_SETCONTEXT = 0x0281, WM_IME_NOTIFY = 0x0282, diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 8a0654a9ba..3587eddc85 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -227,10 +227,6 @@ namespace Avalonia.Win32 } // Mouse capture is lost case WindowsMessage.WM_CANCELMODE: - if (BelowWin8) - { - break; - } _mouseDevice.Capture(null); break; @@ -263,7 +259,8 @@ namespace Avalonia.Win32 timestamp, _owner, RawPointerEventType.Move, - DipFromLParam(lParam), GetMouseModifiers(wParam)); + DipFromLParam(lParam), + GetMouseModifiers(wParam)); break; } @@ -279,7 +276,8 @@ namespace Avalonia.Win32 timestamp, _owner, PointToClient(PointFromLParam(lParam)), - new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta), GetMouseModifiers(wParam)); + new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta), + GetMouseModifiers(wParam)); break; } @@ -294,7 +292,8 @@ namespace Avalonia.Win32 timestamp, _owner, PointToClient(PointFromLParam(lParam)), - new Vector(-(ToInt32(wParam) >> 16) / wheelDelta, 0), GetMouseModifiers(wParam)); + new Vector(-(ToInt32(wParam) >> 16) / wheelDelta, 0), + GetMouseModifiers(wParam)); break; } @@ -310,7 +309,8 @@ namespace Avalonia.Win32 timestamp, _owner, RawPointerEventType.LeaveWindow, - new Point(-1, -1), WindowsKeyboardDevice.Instance.Modifiers); + new Point(-1, -1), + WindowsKeyboardDevice.Instance.Modifiers); break; } @@ -386,16 +386,24 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERDEVICECHANGE: + { + //notifies about changes in the settings of a monitor that has a digitizer attached to it. + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdevicechange + break; + } case WindowsMessage.WM_POINTERDEVICEINRANGE: case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: { - + //notifies about proximity of pointer device to the digitizer. + //contains pointer id and proximity. + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdeviceinrange break; } case WindowsMessage.WM_NCPOINTERUPDATE: case WindowsMessage.WM_NCPOINTERDOWN: case WindowsMessage.WM_NCPOINTERUP: { + //NC stands for non-client area - window header and window border break; } @@ -407,60 +415,79 @@ namespace Avalonia.Win32 break; } case WindowsMessage.WM_POINTERENTER: - case WindowsMessage.WM_POINTERLEAVE: { + //this is not handled by WM_MOUSEENTER so I think there is no need to handle this too. + //but we can detect a new pointer by this message and calling IS_POINTER_NEW_WPARAM + //note: by using a pen there can be a pointer leave or enter inside a window coords + //when you are just lift up the pen above the display break; } - case WindowsMessage.WM_POINTERACTIVATE: - case WindowsMessage.WM_POINTERCAPTURECHANGED: + case WindowsMessage.WM_POINTERLEAVE: { + GetDeviceInfo(wParam, out var device, out var info); + var point = PointToClient(PointFromLParam(lParam)); + e = new RawPointerEventArgs( + device, + timestamp, + _owner, + RawPointerEventType.LeaveWindow, + point, + WindowsKeyboardDevice.Instance.Modifiers); break; } - case WindowsMessage.WM_TOUCHHITTESTING: + case WindowsMessage.WM_POINTERACTIVATE: { - + //occurs when a pointer activates an inactive window. + //we should handle this and return PA_ACTIVATE or PA_NOACTIVATE + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointeractivate break; } + case WindowsMessage.WM_POINTERCAPTURECHANGED: + { + _mouseDevice.Capture(null); + return IntPtr.Zero; + } case WindowsMessage.WM_POINTERWHEEL: { - var pointerId = ToPointerId(wParam); - GetPointerType(pointerId, out var type); - IInputDevice device; - switch (type) - { - case PointerInputType.PT_PEN: - device = _penDevice; - break; - case PointerInputType.PT_TOUCH: - device = _touchDevice; - break; - default: - device = _mouseDevice; - break; - } - + GetDeviceInfo(wParam, out var device, out var info); - var delta = GetWheelDelta(wParam); - var point = PointFromLParam(lParam); - e = new RawMouseWheelEventArgs( - device, - timestamp, - _owner, - PointToClient(point), - new Vector(0, delta / wheelDelta), - GetMouseModifiers(wParam)); + var point = PointToClient(PointFromLParam(lParam)); + var modifiers = GetInputModifiers(info.dwKeyStates); + var delta = new Vector(0, GetWheelDelta(wParam) / wheelDelta); + e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); break; } case WindowsMessage.WM_POINTERHWHEEL: { + GetDeviceInfo(wParam, out var device, out var info); + var point = PointToClient(PointFromLParam(lParam)); + var modifiers = GetInputModifiers(info.dwKeyStates); + var delta = new Vector(GetWheelDelta(wParam) / wheelDelta, 0); + e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); break; } - case WindowsMessage.WM_POINTERHITTEST: + case WindowsMessage.DM_POINTERHITTEST: { - + //DM stands for direct manipulation. + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/directmanipulation/direct-manipulation-portal + break; + } + case WindowsMessage.WM_TOUCHHITTESTING: + { + //This is to determine the most probable touch target. + //provides an input bounding box and receives hit proximity + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-touchhittesting + //https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-touch_hit_testing_input + break; + } + case WindowsMessage.WM_PARENTNOTIFY: + { + //This message is sent in a dialog scenarios. Contains mouse position in an old-way, + //but listed in the wm_pointer reference + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-parentnotify break; } @@ -687,13 +714,36 @@ namespace Avalonia.Win32 } } + private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info) + { + var pointerId = ToPointerId(wParam); + GetPointerType(pointerId, out var type);//ToDo we can cache this and invalidate in WM_POINTERDEVICECHANGE + switch (type) + { + case PointerInputType.PT_PEN: + device = _penDevice; + GetPointerPenInfo(pointerId, out var penInfo); + info = penInfo.pointerInfo; + break; + case PointerInputType.PT_TOUCH: + device = _touchDevice; + GetPointerTouchInfo(pointerId, out var touchInfo); + info = touchInfo.pointerInfo; + break; + default: + device = _mouseDevice; + GetPointerInfo(pointerId, out info); + break; + } + } + public static uint GetWheelDelta(IntPtr wParam) => HIWORD(wParam); public static uint ToPointerId(IntPtr wParam) => LOWORD(wParam); public static uint LOWORD(IntPtr param) => (uint)param & 0xffff; public static uint HIWORD(IntPtr param) => (uint)param >> 16; - public bool BelowWin8 => Win32Platform.WindowsVersion < PlatformConstants.Windows8; + public readonly bool BelowWin8 = Win32Platform.WindowsVersion < PlatformConstants.Windows8; private void UpdateInputMethod(IntPtr hkl) { @@ -747,6 +797,11 @@ namespace Avalonia.Win32 private static RawInputModifiers GetMouseModifiers(IntPtr wParam) { var keys = (ModifierKeys)ToInt32(wParam); + return GetInputModifiers(keys); + } + + private static RawInputModifiers GetInputModifiers(ModifierKeys keys) + { var modifiers = WindowsKeyboardDevice.Instance.Modifiers; if (keys.HasAllFlags(ModifierKeys.MK_LBUTTON)) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 8f6a7e9741..0f99252d4d 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -76,7 +76,7 @@ namespace Avalonia.Win32 private bool _multitouch; private IInputRoot _owner; private WindowProperties _windowProperties; - private bool _trackingMouse; + private bool _trackingMouse;//ToDo - there is something missed. Needs investigation @Steven Kirk private bool _topmost; private double _scaling = 1; private WindowState _showWindowState; From 35a55c9a56dca3ccc957a559e0b50e1aa48fdab0 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sat, 22 Jan 2022 21:37:54 +0300 Subject: [PATCH 005/393] Enable WM_Pointer for mouse events, handle up/down events, some fixes --- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 73 +++++++++++++------ src/Windows/Avalonia.Win32/WindowImpl.cs | 5 ++ 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 3587eddc85..5e31bba925 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -166,7 +166,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONDOWN: case WindowsMessage.WM_XBUTTONDOWN: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -199,7 +199,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONUP: case WindowsMessage.WM_XBUTTONUP: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -232,7 +232,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEMOVE: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -267,7 +267,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEWHEEL: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -283,7 +283,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEHWHEEL: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -299,7 +299,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSELEAVE: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -319,7 +319,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCMBUTTONDOWN: case WindowsMessage.WM_NCXBUTTONDOWN: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -343,7 +343,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_TOUCH: { - if (BelowWin8) + if (Win8Plus) { break; } @@ -400,18 +400,53 @@ namespace Avalonia.Win32 break; } case WindowsMessage.WM_NCPOINTERUPDATE: - case WindowsMessage.WM_NCPOINTERDOWN: - case WindowsMessage.WM_NCPOINTERUP: { //NC stands for non-client area - window header and window border - + //As I found above in an old message handling - we dont need to handle NC pointer move/updates. + //All we need is pointer down and up. So this is skipped for now. break; } - case WindowsMessage.WM_POINTERUPDATE: + case WindowsMessage.WM_NCPOINTERDOWN: + case WindowsMessage.WM_NCPOINTERUP: case WindowsMessage.WM_POINTERDOWN: case WindowsMessage.WM_POINTERUP: { + GetDeviceInfo(wParam, out var device, out var info); + var point = PointToClient(PointFromLParam(lParam)); + var modifiers = GetInputModifiers(info.dwKeyStates); + var eventType = info.ButtonChangeType switch + { + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN => RawPointerEventType.LeftButtonDown, + PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_DOWN => RawPointerEventType.RightButtonDown, + PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_DOWN => RawPointerEventType.MiddleButtonDown, + PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_DOWN => RawPointerEventType.XButton1Down, + PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_DOWN => RawPointerEventType.XButton2Down, + + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP => RawPointerEventType.LeftButtonUp, + PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_UP => RawPointerEventType.RightButtonUp, + PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_UP => RawPointerEventType.MiddleButtonUp, + PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_UP => RawPointerEventType.XButton1Up, + PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_UP => RawPointerEventType.XButton2Up, + }; + if (eventType == RawPointerEventType.NonClientLeftButtonDown && + (WindowsMessage)msg == WindowsMessage.WM_NCPOINTERDOWN) + { + eventType = RawPointerEventType.NonClientLeftButtonDown; + } + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); + break; + } + case WindowsMessage.WM_POINTERUPDATE: + { + if (ShouldIgnoreTouchEmulatedMessage()) + { + break; + } + GetDeviceInfo(wParam, out var device, out var info); + var point = PointToClient(PointFromLParam(lParam)); + var modifiers = GetInputModifiers(info.dwKeyStates); + e = new RawPointerEventArgs(device, timestamp, _owner, RawPointerEventType.Move, point, modifiers); break; } case WindowsMessage.WM_POINTERENTER: @@ -455,7 +490,7 @@ namespace Avalonia.Win32 var point = PointToClient(PointFromLParam(lParam)); var modifiers = GetInputModifiers(info.dwKeyStates); - var delta = new Vector(0, GetWheelDelta(wParam) / wheelDelta); + var delta = new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta); e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); break; } @@ -465,7 +500,7 @@ namespace Avalonia.Win32 var point = PointToClient(PointFromLParam(lParam)); var modifiers = GetInputModifiers(info.dwKeyStates); - var delta = new Vector(GetWheelDelta(wParam) / wheelDelta, 0); + var delta = new Vector((ToInt32(wParam) >> 16) / wheelDelta, 0); e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); break; } @@ -716,7 +751,7 @@ namespace Avalonia.Win32 private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info) { - var pointerId = ToPointerId(wParam); + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); GetPointerType(pointerId, out var type);//ToDo we can cache this and invalidate in WM_POINTERDEVICECHANGE switch (type) { @@ -737,13 +772,7 @@ namespace Avalonia.Win32 } } - public static uint GetWheelDelta(IntPtr wParam) => HIWORD(wParam); - public static uint ToPointerId(IntPtr wParam) => LOWORD(wParam); - public static uint LOWORD(IntPtr param) => (uint)param & 0xffff; - public static uint HIWORD(IntPtr param) => (uint)param >> 16; - - - public readonly bool BelowWin8 = Win32Platform.WindowsVersion < PlatformConstants.Windows8; + public readonly bool Win8Plus = Win32Platform.WindowsVersion >= PlatformConstants.Windows8; private void UpdateInputMethod(IntPtr hkl) { diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 0f99252d4d..0ad198e991 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -126,6 +126,11 @@ namespace Avalonia.Win32 egl.Display is AngleWin32EglDisplay angleDisplay && angleDisplay.PlatformApi == AngleOptions.PlatformApi.DirectX11; + if (Win8Plus && !IsMouseInPointerEnabled()) + { + EnableMouseInPointer(true); + } + CreateWindow(); _framebuffer = new FramebufferManager(_hwnd); UpdateInputMethod(GetKeyboardLayout(0)); From 4cea62fd13701931ba7aedbb2b2f6fce9f9477a6 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sat, 22 Jan 2022 23:34:43 +0300 Subject: [PATCH 006/393] PenDevice tuning, Add pen properties to the PointerPointProperties --- src/Avalonia.Input/IKeyboardDevice.cs | 2 + src/Avalonia.Input/IPointer.cs | 3 +- src/Avalonia.Input/PenDevice.cs | 134 +++--------------- src/Avalonia.Input/PointerPoint.cs | 30 +++- src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 8 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 64 +++------ 6 files changed, 72 insertions(+), 169 deletions(-) diff --git a/src/Avalonia.Input/IKeyboardDevice.cs b/src/Avalonia.Input/IKeyboardDevice.cs index 9506dc36fb..b3ea7c5f4f 100644 --- a/src/Avalonia.Input/IKeyboardDevice.cs +++ b/src/Avalonia.Input/IKeyboardDevice.cs @@ -47,6 +47,8 @@ namespace Avalonia.Input MiddleMouseButton = 64, XButton1MouseButton = 128, XButton2MouseButton = 256, + BarrelPenButton = 512, + PenEraser = 1024, KeyboardMask = Alt | Control | Shift | Meta } diff --git a/src/Avalonia.Input/IPointer.cs b/src/Avalonia.Input/IPointer.cs index 7af48cef82..361f3ac370 100644 --- a/src/Avalonia.Input/IPointer.cs +++ b/src/Avalonia.Input/IPointer.cs @@ -13,6 +13,7 @@ namespace Avalonia.Input public enum PointerType { Mouse, - Touch + Touch, + Pen } } diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs index dd3d60ebb9..3c0f3c7709 100644 --- a/src/Avalonia.Input/PenDevice.cs +++ b/src/Avalonia.Input/PenDevice.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Reactive.Linq; using Avalonia.Input.Raw; using Avalonia.Interactivity; -using Avalonia.Platform; using Avalonia.VisualTree; namespace Avalonia.Input @@ -13,17 +12,13 @@ namespace Avalonia.Input /// public class PenDevice : IPenDevice, IDisposable { - private int _clickCount; - private Rect _lastClickRect; - private ulong _lastClickTime; - private readonly Pointer _pointer; private bool _disposed; private PixelPoint? _position; public PenDevice(Pointer? pointer = null) { - _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Mouse, true); + _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Pen, true); } /// @@ -37,16 +32,6 @@ namespace Avalonia.Input [Obsolete("Use IPointer instead")] public IInputElement? Captured => _pointer.Captured; - /// - /// Gets the mouse position, in screen coordinates. - /// - [Obsolete("Use events instead")] - public PixelPoint Position - { - get => _position ?? new PixelPoint(-1, -1); - protected set => _position = value; - } - /// /// Captures mouse input to the specified control. /// @@ -76,7 +61,7 @@ namespace Avalonia.Input } #pragma warning disable CS0618 // Type or member is obsolete - var rootPoint = relativeTo.VisualRoot.PointToClient(Position); + var rootPoint = relativeTo.VisualRoot.PointToClient(_position ?? new PixelPoint(-1, -1)); #pragma warning restore CS0618 // Type or member is obsolete var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo); return rootPoint * transform!.Value; @@ -120,29 +105,13 @@ namespace Avalonia.Input } } } - - int ButtonCount(PointerPointProperties props) - { - var rv = 0; - if (props.IsLeftButtonPressed) - rv++; - if (props.IsMiddleButtonPressed) - rv++; - if (props.IsRightButtonPressed) - rv++; - if (props.IsXButton1Pressed) - rv++; - if (props.IsXButton2Pressed) - rv++; - return rv; - } private void ProcessRawEvent(RawPointerEventArgs e) { e = e ?? throw new ArgumentNullException(nameof(e)); - var mouse = (PenDevice)e.Device; - if(mouse._disposed) + var pen = (PenDevice)e.Device; + if(pen._disposed) return; _position = e.Root.PointToScreen(e.Position); @@ -151,34 +120,16 @@ namespace Avalonia.Input switch (e.Type) { case RawPointerEventType.LeaveWindow: - LeaveWindow(mouse, e.Timestamp, e.Root, props, keyModifiers); + LeaveWindow(pen, e.Timestamp, e.Root, props, keyModifiers); break; - case RawPointerEventType.LeftButtonDown: - case RawPointerEventType.RightButtonDown: - case RawPointerEventType.MiddleButtonDown: - case RawPointerEventType.XButton1Down: - case RawPointerEventType.XButton2Down: - if (ButtonCount(props) > 1) - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - else - e.Handled = MouseDown(mouse, e.Timestamp, e.Root, e.Position, - props, keyModifiers); + case RawPointerEventType.PenBegin: + e.Handled = PenDown(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; - case RawPointerEventType.LeftButtonUp: - case RawPointerEventType.RightButtonUp: - case RawPointerEventType.MiddleButtonUp: - case RawPointerEventType.XButton1Up: - case RawPointerEventType.XButton2Up: - if (ButtonCount(props) != 0) - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - else - e.Handled = MouseUp(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); + case RawPointerEventType.PenEnd: + e.Handled = PenUp(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; - case RawPointerEventType.Move: - e.Handled = MouseMove(mouse, e.Timestamp, e.Root, e.Position, props, keyModifiers); - break; - case RawPointerEventType.Wheel: - e.Handled = MouseWheel(mouse, e.Timestamp, e.Root, e.Position, props, ((RawMouseWheelEventArgs)e).Delta, keyModifiers); + case RawPointerEventType.PenUpdate: + e.Handled = PenMove(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; } } @@ -196,35 +147,18 @@ namespace Avalonia.Input PointerPointProperties CreateProperties(RawPointerEventArgs args) { - var kind = PointerUpdateKind.Other; - if (args.Type == RawPointerEventType.LeftButtonDown) + if (args.Type == RawPointerEventType.PenBegin) kind = PointerUpdateKind.LeftButtonPressed; - if (args.Type == RawPointerEventType.MiddleButtonDown) - kind = PointerUpdateKind.MiddleButtonPressed; - if (args.Type == RawPointerEventType.RightButtonDown) - kind = PointerUpdateKind.RightButtonPressed; - if (args.Type == RawPointerEventType.XButton1Down) - kind = PointerUpdateKind.XButton1Pressed; - if (args.Type == RawPointerEventType.XButton2Down) - kind = PointerUpdateKind.XButton2Pressed; - if (args.Type == RawPointerEventType.LeftButtonUp) + if (args.Type == RawPointerEventType.PenEnd) kind = PointerUpdateKind.LeftButtonReleased; - if (args.Type == RawPointerEventType.MiddleButtonUp) - kind = PointerUpdateKind.MiddleButtonReleased; - if (args.Type == RawPointerEventType.RightButtonUp) - kind = PointerUpdateKind.RightButtonReleased; - if (args.Type == RawPointerEventType.XButton1Up) - kind = PointerUpdateKind.XButton1Released; - if (args.Type == RawPointerEventType.XButton2Up) - kind = PointerUpdateKind.XButton2Released; return new PointerPointProperties(args.InputModifiers, kind); } private MouseButton _lastMouseDownButton; - private bool MouseDown(IPenDevice device, ulong timestamp, IInputElement root, Point p, + private bool PenDown(IPenDevice device, ulong timestamp, IInputElement root, Point p, PointerPointProperties properties, KeyModifiers inputModifiers) { @@ -239,21 +173,8 @@ namespace Avalonia.Input var source = GetSource(hit); if (source != null) { - var settings = AvaloniaLocator.Current.GetService(); - var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; - var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); - - if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) - { - _clickCount = 0; - } - - ++_clickCount; - _lastClickTime = timestamp; - _lastClickRect = new Rect(p, new Size()) - .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); - var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); + var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, 1); source.RaiseEvent(e); return e.Handled; } @@ -262,7 +183,7 @@ namespace Avalonia.Input return false; } - private bool MouseMove(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, + private bool PenMove(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, KeyModifiers inputModifiers) { device = device ?? throw new ArgumentNullException(nameof(device)); @@ -292,7 +213,7 @@ namespace Avalonia.Input return false; } - private bool MouseUp(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, + private bool PenUp(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers) { device = device ?? throw new ArgumentNullException(nameof(device)); @@ -314,27 +235,6 @@ namespace Avalonia.Input return false; } - private bool MouseWheel(IPenDevice device, ulong timestamp, IInputRoot root, Point p, - PointerPointProperties props, - Vector delta, KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); - var source = GetSource(hit); - - if (source is not null) - { - var e = new PointerWheelEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, delta); - - source?.RaiseEvent(e); - return e.Handled; - } - - return false; - } - private IInteractive? GetSource(IVisual? hit) { if (hit is null) diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index 9f8285a8e1..16fab7410c 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -20,6 +20,14 @@ namespace Avalonia.Input public bool IsRightButtonPressed { get; } public bool IsXButton1Pressed { get; } public bool IsXButton2Pressed { get; } + public bool IsBarrelButtonPressed { get; } + public bool IsEraser { get; } + + public float Twist { get; } + public float Pressure { get; } + public float XTilt { get; } + public float YTilt { get; } + public PointerUpdateKind PointerUpdateKind { get; } @@ -36,10 +44,12 @@ namespace Avalonia.Input IsRightButtonPressed = modifiers.HasAllFlags(RawInputModifiers.RightMouseButton); IsXButton1Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton1MouseButton); IsXButton2Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton2MouseButton); + IsBarrelButtonPressed = modifiers.HasAllFlags(RawInputModifiers.BarrelPenButton); + IsEraser = modifiers.HasAllFlags(RawInputModifiers.PenEraser); // The underlying input source might be reporting the previous state, // so make sure that we reflect the current state - + if (kind == PointerUpdateKind.LeftButtonPressed) IsLeftButtonPressed = true; if (kind == PointerUpdateKind.LeftButtonReleased) @@ -60,6 +70,20 @@ namespace Avalonia.Input IsXButton2Pressed = true; if (kind == PointerUpdateKind.XButton2Released) IsXButton2Pressed = false; + if (kind == PointerUpdateKind.BarrelButtonPressed) + IsBarrelButtonPressed = true; + if (kind == PointerUpdateKind.BarrelButtonReleased) + IsBarrelButtonPressed = false; + } + + public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind, + float twist, float pressure, float xTilt, float yTilt + ) : this (modifiers, kind) + { + Twist = twist; + Pressure = pressure; + XTilt = xTilt; + YTilt = yTilt; } public static PointerPointProperties None { get; } = new PointerPointProperties(); @@ -77,7 +101,9 @@ namespace Avalonia.Input RightButtonReleased, XButton1Released, XButton2Released, - Other + Other, + BarrelButtonPressed, + BarrelButtonReleased } public static class PointerUpdateKindExtensions diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index 62a1dd5d84..ea160efef5 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -21,7 +21,13 @@ namespace Avalonia.Input.Raw TouchBegin, TouchUpdate, TouchEnd, - TouchCancel + TouchCancel, + PenBegin, + PenUpdate, + PenEnd, + PenCancel, + BarrelUp, + BarrelDown, } /// diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 5e31bba925..db11508ed7 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -374,17 +374,6 @@ namespace Avalonia.Win32 break; } - - - - - - - - - - - case WindowsMessage.WM_POINTERDEVICECHANGE: { //notifies about changes in the settings of a monitor that has a digitizer attached to it. @@ -414,7 +403,10 @@ namespace Avalonia.Win32 GetDeviceInfo(wParam, out var device, out var info); var point = PointToClient(PointFromLParam(lParam)); var modifiers = GetInputModifiers(info.dwKeyStates); - var eventType = info.ButtonChangeType switch + + if (info.ButtonChangeType != PointerButtonChangeType.POINTER_CHANGE_NONE) + { + var eventType = info.ButtonChangeType switch { PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN => RawPointerEventType.LeftButtonDown, PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_DOWN => RawPointerEventType.RightButtonDown, @@ -428,12 +420,13 @@ namespace Avalonia.Win32 PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_UP => RawPointerEventType.XButton1Up, PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_UP => RawPointerEventType.XButton2Up, }; - if (eventType == RawPointerEventType.NonClientLeftButtonDown && - (WindowsMessage)msg == WindowsMessage.WM_NCPOINTERDOWN) - { - eventType = RawPointerEventType.NonClientLeftButtonDown; + if (eventType == RawPointerEventType.NonClientLeftButtonDown && + (WindowsMessage)msg == WindowsMessage.WM_NCPOINTERDOWN) + { + eventType = RawPointerEventType.NonClientLeftButtonDown; + } + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); } - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); break; } case WindowsMessage.WM_POINTERUPDATE: @@ -446,7 +439,8 @@ namespace Avalonia.Win32 var point = PointToClient(PointFromLParam(lParam)); var modifiers = GetInputModifiers(info.dwKeyStates); - e = new RawPointerEventArgs(device, timestamp, _owner, RawPointerEventType.Move, point, modifiers); + e = new RawPointerEventArgs( + device, timestamp, _owner, RawPointerEventType.Move, point, modifiers); break; } case WindowsMessage.WM_POINTERENTER: @@ -462,14 +456,10 @@ namespace Avalonia.Win32 { GetDeviceInfo(wParam, out var device, out var info); var point = PointToClient(PointFromLParam(lParam)); + var modifiers = GetInputModifiers(info.dwKeyStates); e = new RawPointerEventArgs( - device, - timestamp, - _owner, - RawPointerEventType.LeaveWindow, - point, - WindowsKeyboardDevice.Instance.Modifiers); + device, timestamp, _owner, RawPointerEventType.LeaveWindow, point, modifiers); break; } case WindowsMessage.WM_POINTERACTIVATE: @@ -520,33 +510,11 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_PARENTNOTIFY: { - //This message is sent in a dialog scenarios. Contains mouse position in an old-way, - //but listed in the wm_pointer reference + //This message is sent in a dialog scenarios. Contains mouse position. + //Old message, but listed in the wm_pointer reference //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-parentnotify break; } - - - - - - - - - - - - - - - - - - - - - - case WindowsMessage.WM_NCPAINT: { if (!HasFullDecorations) From d3f3166914428a945d24b8369c2b6c18ff0aab34 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 14:16:35 +0300 Subject: [PATCH 007/393] Provide Pressure, Tilt, and other parameters to PointerPointProperties. Provide touch events (still a lot to do), use point position from pointer info. --- src/Avalonia.Input/PenDevice.cs | 25 ++-- src/Avalonia.Input/PointerPoint.cs | 12 +- src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 4 - .../Interop/UnmanagedMethods.cs | 2 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 111 ++++++++++++------ 5 files changed, 98 insertions(+), 56 deletions(-) diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs index 3c0f3c7709..c993e7fac4 100644 --- a/src/Avalonia.Input/PenDevice.cs +++ b/src/Avalonia.Input/PenDevice.cs @@ -32,6 +32,14 @@ namespace Avalonia.Input [Obsolete("Use IPointer instead")] public IInputElement? Captured => _pointer.Captured; + public bool IsEraser { get; set; } + public bool IsInverted { get; set; } + public bool IsBarrel { get; set; } + public int XTilt { get; set; } + public int YTilt { get; set; } + public uint Pressure { get; set; } + public uint Twist { get; set; } + /// /// Captures mouse input to the specified control. /// @@ -122,13 +130,13 @@ namespace Avalonia.Input case RawPointerEventType.LeaveWindow: LeaveWindow(pen, e.Timestamp, e.Root, props, keyModifiers); break; - case RawPointerEventType.PenBegin: + case RawPointerEventType.LeftButtonDown: e.Handled = PenDown(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; - case RawPointerEventType.PenEnd: + case RawPointerEventType.LeftButtonUp: e.Handled = PenUp(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; - case RawPointerEventType.PenUpdate: + case RawPointerEventType.Move: e.Handled = PenMove(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); break; } @@ -145,16 +153,17 @@ namespace Avalonia.Input } - PointerPointProperties CreateProperties(RawPointerEventArgs args) + private PointerPointProperties CreateProperties(RawPointerEventArgs args) { var kind = PointerUpdateKind.Other; - if (args.Type == RawPointerEventType.PenBegin) + if (args.Type == RawPointerEventType.LeftButtonDown) kind = PointerUpdateKind.LeftButtonPressed; - if (args.Type == RawPointerEventType.PenEnd) + if (args.Type == RawPointerEventType.LeftButtonUp) kind = PointerUpdateKind.LeftButtonReleased; - - return new PointerPointProperties(args.InputModifiers, kind); + + return new PointerPointProperties(args.InputModifiers, kind, + Twist, Pressure, XTilt, YTilt, IsEraser, IsInverted, IsBarrel); } private MouseButton _lastMouseDownButton; diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index 16fab7410c..07ef130fcc 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -22,6 +22,7 @@ namespace Avalonia.Input public bool IsXButton2Pressed { get; } public bool IsBarrelButtonPressed { get; } public bool IsEraser { get; } + public bool IsInverted { get; } public float Twist { get; } public float Pressure { get; } @@ -70,20 +71,19 @@ namespace Avalonia.Input IsXButton2Pressed = true; if (kind == PointerUpdateKind.XButton2Released) IsXButton2Pressed = false; - if (kind == PointerUpdateKind.BarrelButtonPressed) - IsBarrelButtonPressed = true; - if (kind == PointerUpdateKind.BarrelButtonReleased) - IsBarrelButtonPressed = false; } public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind, - float twist, float pressure, float xTilt, float yTilt + float twist, float pressure, float xTilt, float yTilt, bool isEraser, bool isInverted, bool isBarrel ) : this (modifiers, kind) { Twist = twist; Pressure = pressure; XTilt = xTilt; YTilt = yTilt; + IsEraser = isEraser; + IsInverted = isInverted; + IsBarrelButtonPressed = isBarrel; } public static PointerPointProperties None { get; } = new PointerPointProperties(); @@ -102,8 +102,6 @@ namespace Avalonia.Input XButton1Released, XButton2Released, Other, - BarrelButtonPressed, - BarrelButtonReleased } public static class PointerUpdateKindExtensions diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index 6a35ec3fad..c75eb69bfd 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -22,10 +22,6 @@ namespace Avalonia.Input.Raw TouchUpdate, TouchEnd, TouchCancel, - PenBegin, - PenUpdate, - PenEnd, - PenCancel, BarrelUp, BarrelDown, Magnify, diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index 93457f7bbd..b3cab5d052 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -1003,7 +1003,7 @@ namespace Avalonia.Win32.Interop public uint historyCount; public int inputData; public ModifierKeys dwKeyStates; - public UInt64 PerformanceCount; + public ulong PerformanceCount; public PointerButtonChangeType ButtonChangeType; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index db11508ed7..34cd9acf25 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -22,8 +22,8 @@ namespace Avalonia.Win32 uint timestamp = unchecked((uint)GetMessageTime()); RawInputEventArgs e = null; var shouldTakeFocus = false; - - switch ((WindowsMessage)msg) + var message = (WindowsMessage)msg; + switch (message) { case WindowsMessage.WM_ACTIVATE: { @@ -180,7 +180,7 @@ namespace Avalonia.Win32 _mouseDevice, timestamp, _owner, - (WindowsMessage)msg switch + message switch { WindowsMessage.WM_LBUTTONDOWN => RawPointerEventType.LeftButtonDown, WindowsMessage.WM_RBUTTONDOWN => RawPointerEventType.RightButtonDown, @@ -212,7 +212,7 @@ namespace Avalonia.Win32 _mouseDevice, timestamp, _owner, - (WindowsMessage)msg switch + message switch { WindowsMessage.WM_LBUTTONUP => RawPointerEventType.LeftButtonUp, WindowsMessage.WM_RBUTTONUP => RawPointerEventType.RightButtonUp, @@ -327,7 +327,7 @@ namespace Avalonia.Win32 _mouseDevice, timestamp, _owner, - (WindowsMessage)msg switch + message switch { WindowsMessage.WM_NCLBUTTONDOWN => RawPointerEventType .NonClientLeftButtonDown, @@ -400,33 +400,13 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERDOWN: case WindowsMessage.WM_POINTERUP: { + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); GetDeviceInfo(wParam, out var device, out var info); - var point = PointToClient(PointFromLParam(lParam)); + var eventType = GetEventType(message, info); + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); - if (info.ButtonChangeType != PointerButtonChangeType.POINTER_CHANGE_NONE) - { - var eventType = info.ButtonChangeType switch - { - PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN => RawPointerEventType.LeftButtonDown, - PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_DOWN => RawPointerEventType.RightButtonDown, - PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_DOWN => RawPointerEventType.MiddleButtonDown, - PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_DOWN => RawPointerEventType.XButton1Down, - PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_DOWN => RawPointerEventType.XButton2Down, - - PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP => RawPointerEventType.LeftButtonUp, - PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_UP => RawPointerEventType.RightButtonUp, - PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_UP => RawPointerEventType.MiddleButtonUp, - PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_UP => RawPointerEventType.XButton1Up, - PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_UP => RawPointerEventType.XButton2Up, - }; - if (eventType == RawPointerEventType.NonClientLeftButtonDown && - (WindowsMessage)msg == WindowsMessage.WM_NCPOINTERDOWN) - { - eventType = RawPointerEventType.NonClientLeftButtonDown; - } - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); - } + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); break; } case WindowsMessage.WM_POINTERUPDATE: @@ -436,11 +416,11 @@ namespace Avalonia.Win32 break; } GetDeviceInfo(wParam, out var device, out var info); - var point = PointToClient(PointFromLParam(lParam)); + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); + var eventType = device is TouchDevice ? RawPointerEventType.TouchUpdate : RawPointerEventType.Move; - e = new RawPointerEventArgs( - device, timestamp, _owner, RawPointerEventType.Move, point, modifiers); + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); break; } case WindowsMessage.WM_POINTERENTER: @@ -455,7 +435,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERLEAVE: { GetDeviceInfo(wParam, out var device, out var info); - var point = PointToClient(PointFromLParam(lParam)); + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); e = new RawPointerEventArgs( @@ -478,7 +458,7 @@ namespace Avalonia.Win32 { GetDeviceInfo(wParam, out var device, out var info); - var point = PointToClient(PointFromLParam(lParam)); + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); var delta = new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta); e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); @@ -488,7 +468,7 @@ namespace Avalonia.Win32 { GetDeviceInfo(wParam, out var device, out var info); - var point = PointToClient(PointFromLParam(lParam)); + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); var delta = new Vector((ToInt32(wParam) >> 16) / wheelDelta, 0); e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); @@ -696,7 +676,7 @@ namespace Avalonia.Win32 { Input(e); - if ((WindowsMessage)msg == WindowsMessage.WM_KEYDOWN) + if (message == WindowsMessage.WM_KEYDOWN) { // Handling a WM_KEYDOWN message should cause the subsequent WM_CHAR message to // be ignored. This should be safe to do as WM_CHAR should only be produced in @@ -717,6 +697,44 @@ namespace Avalonia.Win32 } } + private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) + { + switch (info.pointerType) + { + case PointerInputType.PT_PEN: + return ToEventType(info.ButtonChangeType); + case PointerInputType.PT_TOUCH: + if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED) || + !info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CONFIDENCE)) + { + return RawPointerEventType.TouchCancel; + } + return message == WindowsMessage.WM_POINTERDOWN || message == WindowsMessage.WM_NCPOINTERDOWN + ? RawPointerEventType.TouchBegin + : RawPointerEventType.TouchEnd; + default: + var eventType = ToEventType(info.ButtonChangeType); + if (eventType == RawPointerEventType.LeftButtonDown && + message == WindowsMessage.WM_NCPOINTERDOWN) + { + eventType = RawPointerEventType.NonClientLeftButtonDown; + } + return eventType; + } + } + + private unsafe void ApplyPenInfo(POINTER_PEN_INFO penInfo) + { + _penDevice.IsBarrel = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL); + _penDevice.IsEraser = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL); + _penDevice.IsInverted = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_INVERTED); + + _penDevice.XTilt = penInfo.tiltX; + _penDevice.YTilt = penInfo.tiltY; + _penDevice.Pressure = penInfo.pressure; + _penDevice.Twist = penInfo.rotation; + } + private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info) { var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); @@ -727,6 +745,8 @@ namespace Avalonia.Win32 device = _penDevice; GetPointerPenInfo(pointerId, out var penInfo); info = penInfo.pointerInfo; + + ApplyPenInfo(penInfo); break; case PointerInputType.PT_TOUCH: device = _touchDevice; @@ -740,6 +760,25 @@ namespace Avalonia.Win32 } } + private static RawPointerEventType ToEventType(PointerButtonChangeType type) + { + return type switch + { + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN => RawPointerEventType.LeftButtonDown, + PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_DOWN => RawPointerEventType.RightButtonDown, + PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_DOWN => RawPointerEventType.MiddleButtonDown, + PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_DOWN => RawPointerEventType.XButton1Down, + PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_DOWN => RawPointerEventType.XButton2Down, + + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP => RawPointerEventType.LeftButtonUp, + PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_UP => RawPointerEventType.RightButtonUp, + PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_UP => RawPointerEventType.MiddleButtonUp, + PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_UP => RawPointerEventType.XButton1Up, + PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_UP => RawPointerEventType.XButton2Up, + _ => RawPointerEventType.Move + }; + } + public readonly bool Win8Plus = Win32Platform.WindowsVersion >= PlatformConstants.Windows8; private void UpdateInputMethod(IntPtr hkl) From c046165714c37e20b305cfae823347966cd95aca Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 15:36:29 +0300 Subject: [PATCH 008/393] Add History fetch methods (will be implemented a bit later). Raise touch events. --- .../Interop/UnmanagedMethods.cs | 25 +++-- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 103 +++++++++++------- 2 files changed, 76 insertions(+), 52 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index b3cab5d052..d71efcb074 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -1074,32 +1074,35 @@ namespace Avalonia.Win32.Interop public const int SizeOf_BITMAPINFOHEADER = 40; + [DllImport("user32.dll", SetLastError = true)] + public static extern bool IsMouseInPointerEnabled(); + [DllImport("user32.dll", SetLastError = true)] public static extern int EnableMouseInPointer(bool enable); [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetPointerCursorId(uint pointerID, out uint cursorId); + public static extern bool GetPointerCursorId(uint pointerId, out uint cursorId); [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetPointerType(uint pointerID, out PointerInputType pointerType); + public static extern bool GetPointerType(uint pointerId, out PointerInputType pointerType); - [DllImport("User32.dll", SetLastError = true)] - public static extern bool GetPointerInfo(uint pointerID, out POINTER_INFO pointerInfo); + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetPointerInfo(uint pointerId, out POINTER_INFO pointerInfo); - [DllImport("User32.dll", SetLastError = true)] - public static extern bool GetPointerPenInfo(uint pointerID, out POINTER_PEN_INFO penInfo); + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetPointerInfoHistory(uint pointerId, ref int entriesCount, [MarshalAs(UnmanagedType.LPArray), In, Out] POINTER_INFO[] pointerInfos); - [DllImport("User32.dll", SetLastError = true)] - public static extern bool GetPointerTouchInfo(uint pointerID, out POINTER_TOUCH_INFO touchInfo); + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetPointerPenInfo(uint pointerId, out POINTER_PEN_INFO penInfo); [DllImport("user32.dll", SetLastError = true)] - public static extern void GetUnpredictedMessagePos(); + public static extern bool GetPointerPenInfoHistory(uint pointerId, ref int entriesCount, [MarshalAs(UnmanagedType.LPArray), In, Out] POINTER_PEN_INFO[] penInfos); [DllImport("user32.dll", SetLastError = true)] - public static extern bool IsMouseInPointerEnabled(); + public static extern bool GetPointerTouchInfo(uint pointerId, out POINTER_TOUCH_INFO touchInfo); [DllImport("user32.dll", SetLastError = true)] - public static extern bool SkipPointerFrameMessages(uint pointerID); + public static extern bool GetPointerTouchInfoHistory(uint pointerId, ref int entriesCount, [MarshalAs(UnmanagedType.LPArray), In, Out] POINTER_TOUCH_INFO[] touchInfos); [DllImport("user32.dll")] public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 34cd9acf25..fda68e1561 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -401,26 +401,41 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUP: { var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - GetDeviceInfo(wParam, out var device, out var info); + GetDeviceInfo(wParam, out var device, out var info, ref timestamp); var eventType = GetEventType(message, info); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); + if (device is TouchDevice) + { + e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId); + } + else + { + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); + } break; } case WindowsMessage.WM_POINTERUPDATE: { - if (ShouldIgnoreTouchEmulatedMessage()) - { - break; - } - GetDeviceInfo(wParam, out var device, out var info); + GetDeviceInfo(wParam, out var device, out var info, ref timestamp); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); - var eventType = device is TouchDevice ? RawPointerEventType.TouchUpdate : RawPointerEventType.Move; - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); + if (device is TouchDevice) + { + if (ShouldIgnoreTouchEmulatedMessage()) + { + break; + } + e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, + RawPointerEventType.TouchUpdate, point, modifiers, info.pointerId); + } + else + { + e = new RawPointerEventArgs(device, timestamp, _owner, + RawPointerEventType.Move, point, modifiers); + } break; } case WindowsMessage.WM_POINTERENTER: @@ -434,7 +449,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERLEAVE: { - GetDeviceInfo(wParam, out var device, out var info); + GetDeviceInfo(wParam, out var device, out var info, ref timestamp); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -456,7 +471,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERWHEEL: { - GetDeviceInfo(wParam, out var device, out var info); + GetDeviceInfo(wParam, out var device, out var info, ref timestamp); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -466,7 +481,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERHWHEEL: { - GetDeviceInfo(wParam, out var device, out var info); + GetDeviceInfo(wParam, out var device, out var info, ref timestamp); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -697,36 +712,10 @@ namespace Avalonia.Win32 } } - private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) - { - switch (info.pointerType) - { - case PointerInputType.PT_PEN: - return ToEventType(info.ButtonChangeType); - case PointerInputType.PT_TOUCH: - if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED) || - !info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CONFIDENCE)) - { - return RawPointerEventType.TouchCancel; - } - return message == WindowsMessage.WM_POINTERDOWN || message == WindowsMessage.WM_NCPOINTERDOWN - ? RawPointerEventType.TouchBegin - : RawPointerEventType.TouchEnd; - default: - var eventType = ToEventType(info.ButtonChangeType); - if (eventType == RawPointerEventType.LeftButtonDown && - message == WindowsMessage.WM_NCPOINTERDOWN) - { - eventType = RawPointerEventType.NonClientLeftButtonDown; - } - return eventType; - } - } - private unsafe void ApplyPenInfo(POINTER_PEN_INFO penInfo) { _penDevice.IsBarrel = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL); - _penDevice.IsEraser = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL); + _penDevice.IsEraser = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_ERASER); _penDevice.IsInverted = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_INVERTED); _penDevice.XTilt = penInfo.tiltX; @@ -735,10 +724,11 @@ namespace Avalonia.Win32 _penDevice.Twist = penInfo.rotation; } - private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info) + private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info, ref uint timestamp) { var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - GetPointerType(pointerId, out var type);//ToDo we can cache this and invalidate in WM_POINTERDEVICECHANGE + GetPointerType(pointerId, out var type); + //GetPointerCursorId(pointerId, out var cursorId); switch (type) { case PointerInputType.PT_PEN: @@ -758,6 +748,37 @@ namespace Avalonia.Win32 GetPointerInfo(pointerId, out info); break; } + + if (info.dwTime != 0) + { + timestamp = info.dwTime; + } + } + + private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) + { + switch (info.pointerType) + { + case PointerInputType.PT_PEN: + return ToEventType(info.ButtonChangeType); + case PointerInputType.PT_TOUCH: + if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED) || + !info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CONFIDENCE)) + { + return RawPointerEventType.TouchCancel; + } + return message == WindowsMessage.WM_POINTERDOWN || message == WindowsMessage.WM_NCPOINTERDOWN + ? RawPointerEventType.TouchBegin + : RawPointerEventType.TouchEnd; + default: + var eventType = ToEventType(info.ButtonChangeType); + if (eventType == RawPointerEventType.LeftButtonDown && + message == WindowsMessage.WM_NCPOINTERDOWN) + { + eventType = RawPointerEventType.NonClientLeftButtonDown; + } + return eventType; + } } private static RawPointerEventType ToEventType(PointerButtonChangeType type) From cbc813235a80918b5f0a57ca54f5abe5b47b08cb Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 16:35:25 +0300 Subject: [PATCH 009/393] Combine some message handlers --- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 68 +++++++------------ 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index fda68e1561..0266134199 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -399,26 +399,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCPOINTERUP: case WindowsMessage.WM_POINTERDOWN: case WindowsMessage.WM_POINTERUP: - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - GetDeviceInfo(wParam, out var device, out var info, ref timestamp); - var eventType = GetEventType(message, info); - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); - - if (device is TouchDevice) - { - e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId); - } - else - { - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); - } - break; - } case WindowsMessage.WM_POINTERUPDATE: { - GetDeviceInfo(wParam, out var device, out var info, ref timestamp); + GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + var eventType = GetEventType(message, info); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -428,13 +412,11 @@ namespace Avalonia.Win32 { break; } - e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, - RawPointerEventType.TouchUpdate, point, modifiers, info.pointerId); + e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId); } else { - e = new RawPointerEventArgs(device, timestamp, _owner, - RawPointerEventType.Move, point, modifiers); + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); } break; } @@ -449,7 +431,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERLEAVE: { - GetDeviceInfo(wParam, out var device, out var info, ref timestamp); + GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -457,6 +439,18 @@ namespace Avalonia.Win32 device, timestamp, _owner, RawPointerEventType.LeaveWindow, point, modifiers); break; } + case WindowsMessage.WM_POINTERWHEEL: + case WindowsMessage.WM_POINTERHWHEEL: + { + GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + + var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); + var modifiers = GetInputModifiers(info.dwKeyStates); + var val = (ToInt32(wParam) >> 16) / wheelDelta; + var delta = message == WindowsMessage.WM_POINTERHWHEEL ? new Vector(0, val) : new Vector(val, 0); + e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); + break; + } case WindowsMessage.WM_POINTERACTIVATE: { //occurs when a pointer activates an inactive window. @@ -469,26 +463,6 @@ namespace Avalonia.Win32 _mouseDevice.Capture(null); return IntPtr.Zero; } - case WindowsMessage.WM_POINTERWHEEL: - { - GetDeviceInfo(wParam, out var device, out var info, ref timestamp); - - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); - var delta = new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta); - e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); - break; - } - case WindowsMessage.WM_POINTERHWHEEL: - { - GetDeviceInfo(wParam, out var device, out var info, ref timestamp); - - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); - var delta = new Vector((ToInt32(wParam) >> 16) / wheelDelta, 0); - e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); - break; - } case WindowsMessage.DM_POINTERHITTEST: { //DM stands for direct manipulation. @@ -724,7 +698,7 @@ namespace Avalonia.Win32 _penDevice.Twist = penInfo.rotation; } - private void GetDeviceInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info, ref uint timestamp) + private void GetDevicePointerInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info, ref uint timestamp) { var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); GetPointerType(pointerId, out var type); @@ -757,6 +731,12 @@ namespace Avalonia.Win32 private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) { + if (message == WindowsMessage.WM_POINTERUPDATE) + { + return info.pointerType == PointerInputType.PT_TOUCH + ? RawPointerEventType.TouchUpdate + : RawPointerEventType.Move; + } switch (info.pointerType) { case PointerInputType.PT_PEN: From c880572c5f711edb016a727f17003dabc2b1427f Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 19:27:17 +0300 Subject: [PATCH 010/393] Handle history pointer infos for touch and pen --- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 0266134199..0aaa9d4ce0 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -402,6 +402,62 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUPDATE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + + if (info.historyCount > 1) + { + if (info.pointerType == PointerInputType.PT_TOUCH) + { + if (ShouldIgnoreTouchEmulatedMessage()) + { + break; + } + + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyCount = (int)info.historyCount; + var historyTouchInfos = new POINTER_TOUCH_INFO[historyCount]; + if (GetPointerTouchInfoHistory(pointerId, ref historyCount, historyTouchInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyTouchInfo = historyTouchInfos[i]; + var historyInfo = historyTouchInfo.pointerInfo; + var historyEventType = GetEventType(message, historyInfo); + var historyPoint = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + var historyModifiers = GetInputModifiers(historyInfo.dwKeyStates); + var historyTimestamp = historyInfo.dwTime == 0 ? timestamp : historyInfo.dwTime; + Input?.Invoke(new RawTouchEventArgs(_touchDevice, historyTimestamp, _owner, + historyEventType, historyPoint, historyModifiers, historyInfo.pointerId)); + } + } + } + else if (info.pointerType == PointerInputType.PT_PEN) + { + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyCount = (int)info.historyCount; + var historyPenInfos = new POINTER_PEN_INFO[historyCount]; + if (GetPointerPenInfoHistory(pointerId, ref historyCount, historyPenInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyPenInfo = historyPenInfos[i]; + var historyInfo = historyPenInfo.pointerInfo; + var historyEventType = GetEventType(message, historyInfo); + var historyPoint = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + var historyModifiers = GetInputModifiers(historyInfo.dwKeyStates); + var historyTimestamp = historyInfo.dwTime == 0 ? timestamp : historyInfo.dwTime; + + ApplyPenInfo(historyPenInfo); + Input?.Invoke(new RawPointerEventArgs(_penDevice, historyTimestamp, _owner, + historyEventType, historyPoint, historyModifiers)); + } + } + } + } + var eventType = GetEventType(message, info); var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -447,7 +503,7 @@ namespace Avalonia.Win32 var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); var val = (ToInt32(wParam) >> 16) / wheelDelta; - var delta = message == WindowsMessage.WM_POINTERHWHEEL ? new Vector(0, val) : new Vector(val, 0); + var delta = message == WindowsMessage.WM_POINTERWHEEL ? new Vector(0, val) : new Vector(val, 0); e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); break; } From 8cbd26ffdf6709e5e22487aeadc3d6b99f55af2c Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 19:49:32 +0300 Subject: [PATCH 011/393] Remove redundant changes, improve tab control pointer type check --- src/Avalonia.Controls/TabControl.cs | 6 ++++-- src/Avalonia.Input/IKeyboardDevice.cs | 2 -- src/Avalonia.Input/PointerPoint.cs | 2 +- src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 2 -- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Controls/TabControl.cs b/src/Avalonia.Controls/TabControl.cs index 306a9d3e6a..955b29f3f9 100644 --- a/src/Avalonia.Controls/TabControl.cs +++ b/src/Avalonia.Controls/TabControl.cs @@ -211,7 +211,8 @@ namespace Avalonia.Controls { base.OnPointerPressed(e); - if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && e.Pointer.Type == PointerType.Mouse) + if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && + (e.Pointer.Type == PointerType.Mouse || e.Pointer.Type == PointerType.Pen)) { e.Handled = UpdateSelectionFromEventSource(e.Source); } @@ -219,7 +220,8 @@ namespace Avalonia.Controls protected override void OnPointerReleased(PointerReleasedEventArgs e) { - if (e.InitialPressMouseButton == MouseButton.Left && e.Pointer.Type != PointerType.Mouse) + if (e.InitialPressMouseButton == MouseButton.Left && + (e.Pointer.Type == PointerType.Mouse || e.Pointer.Type == PointerType.Pen)) { var container = GetContainerFromEventSource(e.Source); if (container != null diff --git a/src/Avalonia.Input/IKeyboardDevice.cs b/src/Avalonia.Input/IKeyboardDevice.cs index b3ea7c5f4f..9506dc36fb 100644 --- a/src/Avalonia.Input/IKeyboardDevice.cs +++ b/src/Avalonia.Input/IKeyboardDevice.cs @@ -47,8 +47,6 @@ namespace Avalonia.Input MiddleMouseButton = 64, XButton1MouseButton = 128, XButton2MouseButton = 256, - BarrelPenButton = 512, - PenEraser = 1024, KeyboardMask = Alt | Control | Shift | Meta } diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index 07ef130fcc..cdfcb8da3a 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -101,7 +101,7 @@ namespace Avalonia.Input RightButtonReleased, XButton1Released, XButton2Released, - Other, + Other } public static class PointerUpdateKindExtensions diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index c75eb69bfd..d6406121c7 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -22,8 +22,6 @@ namespace Avalonia.Input.Raw TouchUpdate, TouchEnd, TouchCancel, - BarrelUp, - BarrelDown, Magnify, Rotate, Swipe From 5127006d1b84880b03fbfca7a25889c376fcc8be Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 22:12:34 +0300 Subject: [PATCH 012/393] fix touch issues --- .../GestureRecognizers/ScrollGestureRecognizer.cs | 2 +- src/Avalonia.Input/PointerPoint.cs | 2 -- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 7 +++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs b/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs index f8cedb636f..1d97fdfe53 100644 --- a/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs +++ b/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs @@ -101,7 +101,7 @@ namespace Avalonia.Input.GestureRecognizers if (_scrolling) { var vector = _trackedRootPoint - rootPoint; - var elapsed = _lastMoveTimestamp.HasValue ? + var elapsed = _lastMoveTimestamp.HasValue && _lastMoveTimestamp < e.Timestamp ? TimeSpan.FromMilliseconds(e.Timestamp - _lastMoveTimestamp.Value) : TimeSpan.Zero; diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index cdfcb8da3a..728bb1c579 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -45,8 +45,6 @@ namespace Avalonia.Input IsRightButtonPressed = modifiers.HasAllFlags(RawInputModifiers.RightMouseButton); IsXButton1Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton1MouseButton); IsXButton2Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton2MouseButton); - IsBarrelButtonPressed = modifiers.HasAllFlags(RawInputModifiers.BarrelPenButton); - IsEraser = modifiers.HasAllFlags(RawInputModifiers.PenEraser); // The underlying input source might be reporting the previous state, // so make sure that we reflect the current state diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 0aaa9d4ce0..52981ac7ec 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -488,6 +488,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERLEAVE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + if (device is TouchDevice) + { + break; + } var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -798,8 +802,7 @@ namespace Avalonia.Win32 case PointerInputType.PT_PEN: return ToEventType(info.ButtonChangeType); case PointerInputType.PT_TOUCH: - if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED) || - !info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CONFIDENCE)) + if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED)) { return RawPointerEventType.TouchCancel; } From 8dee09b830462ed3e0c5d6197c44a95f2049a935 Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Sun, 23 Jan 2022 23:13:39 +0300 Subject: [PATCH 013/393] Allow double click for pen device --- src/Avalonia.Input/PenDevice.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs index c993e7fac4..aa4f89bb85 100644 --- a/src/Avalonia.Input/PenDevice.cs +++ b/src/Avalonia.Input/PenDevice.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Reactive.Linq; using Avalonia.Input.Raw; using Avalonia.Interactivity; +using Avalonia.Platform; using Avalonia.VisualTree; namespace Avalonia.Input @@ -12,6 +13,10 @@ namespace Avalonia.Input /// public class PenDevice : IPenDevice, IDisposable { + private int _clickCount; + private Rect _lastClickRect; + private ulong _lastClickTime; + private readonly Pointer _pointer; private bool _disposed; private PixelPoint? _position; @@ -182,8 +187,21 @@ namespace Avalonia.Input var source = GetSource(hit); if (source != null) { + var settings = AvaloniaLocator.Current.GetService(); + var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; + var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); + + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) + { + _clickCount = 0; + } + + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) + .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); - var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, 1); + var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); source.RaiseEvent(e); return e.Handled; } From 600bb3198c775a76ac9034a5473fea795056be7b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 23 Jan 2022 21:20:02 -0500 Subject: [PATCH 014/393] Add pressure preview --- samples/ControlCatalog/Pages/PointersPage.cs | 266 ++++++++++++------- 1 file changed, 169 insertions(+), 97 deletions(-) diff --git a/samples/ControlCatalog/Pages/PointersPage.cs b/samples/ControlCatalog/Pages/PointersPage.cs index 2901013cea..9702e8e3e7 100644 --- a/samples/ControlCatalog/Pages/PointersPage.cs +++ b/samples/ControlCatalog/Pages/PointersPage.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using System.Diagnostics; @@ -25,7 +26,8 @@ public class PointersPage : Decorator Items = new[] { new TabItem() { Header = "Contacts", Content = new PointerContactsTab() }, - new TabItem() { Header = "IntermediatePoints", Content = new PointerIntermediatePointsTab() } + new TabItem() { Header = "IntermediatePoints", Content = new PointerIntermediatePointsTab() }, + new TabItem() { Header = "Pressure", Content = new PointerPressureTab() } } }; } @@ -148,7 +150,7 @@ public class PointersPage : Decorator { Children = { - new PointerCanvas(slider, status), + new PointerCanvas(slider, status, true), new Border { Background = Brushes.LightYellow, @@ -182,140 +184,210 @@ public class PointersPage : Decorator } }; } + } - class PointerCanvas : Control + public class PointerPressureTab : Decorator + { + public PointerPressureTab() { - private readonly Slider _slider; - private readonly TextBlock _status; - private int _events; - private Stopwatch _stopwatch = Stopwatch.StartNew(); - private Dictionary _pointers = new(); - class PointerPoints + this[TextBlock.ForegroundProperty] = Brushes.Black; + + var status = new TextBlock() + { + HorizontalAlignment = HorizontalAlignment.Left, + VerticalAlignment = VerticalAlignment.Top, + FontSize = 12 + }; + Child = new Grid { - struct CanvasPoint + Children = { - public IBrush Brush; - public Point Point; - public double Radius; + new PointerCanvas(null, status, false), + status } + }; + } + } + + class PointerCanvas : Control + { + private readonly Slider? _slider; + private readonly TextBlock _status; + private readonly bool _drawPoints; + private int _events; + private Stopwatch _stopwatch = Stopwatch.StartNew(); + private IDisposable? _statusUpdated; + private Dictionary _pointers = new(); + private PointerPointProperties? _lastProperties; + class PointerPoints + { + struct CanvasPoint + { + public IBrush Brush; + public Point Point; + public double Radius; + public double Pressure; + } + + readonly CanvasPoint[] _points = new CanvasPoint[1000]; + int _index; - readonly CanvasPoint[] _points = new CanvasPoint[1000]; - int _index; - - public void Render(DrawingContext context) + public void Render(DrawingContext context, bool drawPoints) + { + + CanvasPoint? prev = null; + for (var c = 0; c < _points.Length; c++) { - - CanvasPoint? prev = null; - for (var c = 0; c < _points.Length; c++) + var i = (c + _index) % _points.Length; + var pt = _points[i]; + var thickness = pt.Pressure == 0 ? 1 : (pt.Pressure / 1024) * 5; + + if (drawPoints) { - var i = (c + _index) % _points.Length; - var pt = _points[i]; if (prev.HasValue && prev.Value.Brush != null && pt.Brush != null) - context.DrawLine(new Pen(Brushes.Black), prev.Value.Point, pt.Point); - prev = pt; + context.DrawLine(new Pen(Brushes.Black, thickness), prev.Value.Point, pt.Point); if (pt.Brush != null) context.DrawEllipse(pt.Brush, null, pt.Point, pt.Radius, pt.Radius); - } - - } - - void AddPoint(Point pt, IBrush brush, double radius) - { - _points[_index] = new CanvasPoint { Point = pt, Brush = brush, Radius = radius }; - _index = (_index + 1) % _points.Length; - } - - public void HandleEvent(PointerEventArgs e, Visual v) - { - e.Handled = true; - if (e.RoutedEvent == PointerPressedEvent) - AddPoint(e.GetPosition(v), Brushes.Green, 10); - else if (e.RoutedEvent == PointerReleasedEvent) - AddPoint(e.GetPosition(v), Brushes.Red, 10); else { - var pts = e.GetIntermediatePoints(v); - for (var c = 0; c < pts.Count; c++) - { - var pt = pts[c]; - AddPoint(pt.Position, c == pts.Count - 1 ? Brushes.Blue : Brushes.Black, - c == pts.Count - 1 ? 5 : 2); - } + if (prev.HasValue && prev.Value.Brush != null && pt.Brush != null) + context.DrawLine(new Pen(Brushes.Black, thickness, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round), prev.Value.Point, pt.Point); } + prev = pt; } + } - - public PointerCanvas(Slider slider, TextBlock status) + + void AddPoint(Point pt, IBrush brush, double radius, float pressure) + { + _points[_index] = new CanvasPoint { Point = pt, Brush = brush, Radius = radius, Pressure = pressure }; + _index = (_index + 1) % _points.Length; + } + + public void HandleEvent(PointerEventArgs e, Visual v) { - _slider = slider; - _status = status; - DispatcherTimer.Run(() => + e.Handled = true; + var currentPoint = e.GetCurrentPoint(v); + if (e.RoutedEvent == PointerPressedEvent) + AddPoint(currentPoint.Position, Brushes.Green, 10, currentPoint.Properties.Pressure); + else if (e.RoutedEvent == PointerReleasedEvent) + AddPoint(currentPoint.Position, Brushes.Red, 10, currentPoint.Properties.Pressure); + else { - if (_stopwatch.Elapsed.TotalSeconds > 1) + var pts = e.GetIntermediatePoints(v); + for (var c = 0; c < pts.Count; c++) { - _status.Text = "Events per second: " + (_events / _stopwatch.Elapsed.TotalSeconds); - _stopwatch.Restart(); - _events = 0; + var pt = pts[c]; + AddPoint(pt.Position, c == pts.Count - 1 ? Brushes.Blue : Brushes.Black, + c == pts.Count - 1 ? 5 : 2, pt.Properties.Pressure); } - - return this.GetVisualRoot() != null; - }, TimeSpan.FromMilliseconds(10)); + } } + } + public PointerCanvas(Slider? slider, TextBlock status, bool drawPoints) + { + _slider = slider; + _status = status; + _drawPoints = drawPoints; + } - void HandleEvent(PointerEventArgs e) - { - _events++; - Thread.Sleep((int)_slider.Value); - InvalidateVisual(); + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); - if (e.RoutedEvent == PointerReleasedEvent && e.Pointer.Type == PointerType.Touch) + _statusUpdated = DispatcherTimer.Run(() => + { + if (_stopwatch.Elapsed.TotalSeconds > 1) { - _pointers.Remove(e.Pointer.Id); - return; + _status.Text = $@"Events per second: {(_events / _stopwatch.Elapsed.TotalSeconds)} +PointerUpdateKind: {_lastProperties?.PointerUpdateKind} +IsLeftButtonPressed: {_lastProperties?.IsLeftButtonPressed} +IsRightButtonPressed: {_lastProperties?.IsRightButtonPressed} +IsMiddleButtonPressed: {_lastProperties?.IsMiddleButtonPressed} +IsXButton1Pressed: {_lastProperties?.IsXButton1Pressed} +IsXButton2Pressed: {_lastProperties?.IsXButton2Pressed} +IsBarrelButtonPressed: {_lastProperties?.IsBarrelButtonPressed} +IsEraser: {_lastProperties?.IsEraser} +IsInverted: {_lastProperties?.IsInverted} +Pressure: {_lastProperties?.Pressure} +XTilt: {_lastProperties?.XTilt} +YTilt: {_lastProperties?.YTilt} +Twist: {_lastProperties?.Twist}"; + _stopwatch.Restart(); + _events = 0; } - if (!_pointers.TryGetValue(e.Pointer.Id, out var pt)) - _pointers[e.Pointer.Id] = pt = new PointerPoints(); - pt.HandleEvent(e, this); - - - } - - public override void Render(DrawingContext context) + return true; + }, TimeSpan.FromMilliseconds(10)); + } + + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnDetachedFromVisualTree(e); + + _statusUpdated?.Dispose(); + } + + void HandleEvent(PointerEventArgs e) + { + _events++; + if (_slider != null) { - context.FillRectangle(Brushes.White, Bounds); - foreach(var pt in _pointers.Values) - pt.Render(context); - base.Render(context); + Thread.Sleep((int)_slider.Value); } + InvalidateVisual(); - protected override void OnPointerPressed(PointerPressedEventArgs e) + if (e.RoutedEvent == PointerReleasedEvent && e.Pointer.Type == PointerType.Touch) { - if (e.ClickCount == 2) - { - _pointers.Clear(); - InvalidateVisual(); - return; - } - - HandleEvent(e); - base.OnPointerPressed(e); + _pointers.Remove(e.Pointer.Id); + return; } + + var lastPointer = e.GetCurrentPoint(this); + _lastProperties = lastPointer.Properties; - protected override void OnPointerMoved(PointerEventArgs e) + if (e.Pointer.Type != PointerType.Pen + || lastPointer.Properties.Pressure > 0) { - HandleEvent(e); - base.OnPointerMoved(e); + if (!_pointers.TryGetValue(e.Pointer.Id, out var pt)) + _pointers[e.Pointer.Id] = pt = new PointerPoints(); + pt.HandleEvent(e, this); } + } + + public override void Render(DrawingContext context) + { + context.FillRectangle(Brushes.White, Bounds); + foreach (var pt in _pointers.Values) + pt.Render(context, _drawPoints); + base.Render(context); + } - protected override void OnPointerReleased(PointerReleasedEventArgs e) + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + if (e.ClickCount == 2) { - HandleEvent(e); - base.OnPointerReleased(e); + _pointers.Clear(); + InvalidateVisual(); + return; } + + HandleEvent(e); + base.OnPointerPressed(e); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + HandleEvent(e); + base.OnPointerMoved(e); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + HandleEvent(e); + base.OnPointerReleased(e); } - } } From bef72b3477574e8db361ee22f58cba6354ce435a Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Mon, 24 Jan 2022 11:39:13 +0300 Subject: [PATCH 015/393] fix some issues by requests --- src/Avalonia.Controls/TabControl.cs | 6 +-- .../ScrollGestureRecognizer.cs | 3 +- src/Avalonia.Input/MouseDevice.cs | 39 +++++++------------ src/Avalonia.Input/PenDevice.cs | 13 +++---- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/src/Avalonia.Controls/TabControl.cs b/src/Avalonia.Controls/TabControl.cs index 955b29f3f9..306a9d3e6a 100644 --- a/src/Avalonia.Controls/TabControl.cs +++ b/src/Avalonia.Controls/TabControl.cs @@ -211,8 +211,7 @@ namespace Avalonia.Controls { base.OnPointerPressed(e); - if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && - (e.Pointer.Type == PointerType.Mouse || e.Pointer.Type == PointerType.Pen)) + if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && e.Pointer.Type == PointerType.Mouse) { e.Handled = UpdateSelectionFromEventSource(e.Source); } @@ -220,8 +219,7 @@ namespace Avalonia.Controls protected override void OnPointerReleased(PointerReleasedEventArgs e) { - if (e.InitialPressMouseButton == MouseButton.Left && - (e.Pointer.Type == PointerType.Mouse || e.Pointer.Type == PointerType.Pen)) + if (e.InitialPressMouseButton == MouseButton.Left && e.Pointer.Type != PointerType.Mouse) { var container = GetContainerFromEventSource(e.Source); if (container != null diff --git a/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs b/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs index 1d97fdfe53..889b7e3b82 100644 --- a/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs +++ b/src/Avalonia.Input/GestureRecognizers/ScrollGestureRecognizer.cs @@ -66,7 +66,8 @@ namespace Avalonia.Input.GestureRecognizers public void PointerPressed(PointerPressedEventArgs e) { - if (e.Pointer.IsPrimary && e.Pointer.Type == PointerType.Touch) + if (e.Pointer.IsPrimary && + (e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen)) { EndGesture(); _tracking = e.Pointer; diff --git a/src/Avalonia.Input/MouseDevice.cs b/src/Avalonia.Input/MouseDevice.cs index 087a806f77..38f63402ba 100644 --- a/src/Avalonia.Input/MouseDevice.cs +++ b/src/Avalonia.Input/MouseDevice.cs @@ -205,31 +205,20 @@ namespace Avalonia.Input PointerPointProperties CreateProperties(RawPointerEventArgs args) { - - var kind = PointerUpdateKind.Other; - - if (args.Type == RawPointerEventType.LeftButtonDown) - kind = PointerUpdateKind.LeftButtonPressed; - if (args.Type == RawPointerEventType.MiddleButtonDown) - kind = PointerUpdateKind.MiddleButtonPressed; - if (args.Type == RawPointerEventType.RightButtonDown) - kind = PointerUpdateKind.RightButtonPressed; - if (args.Type == RawPointerEventType.XButton1Down) - kind = PointerUpdateKind.XButton1Pressed; - if (args.Type == RawPointerEventType.XButton2Down) - kind = PointerUpdateKind.XButton2Pressed; - if (args.Type == RawPointerEventType.LeftButtonUp) - kind = PointerUpdateKind.LeftButtonReleased; - if (args.Type == RawPointerEventType.MiddleButtonUp) - kind = PointerUpdateKind.MiddleButtonReleased; - if (args.Type == RawPointerEventType.RightButtonUp) - kind = PointerUpdateKind.RightButtonReleased; - if (args.Type == RawPointerEventType.XButton1Up) - kind = PointerUpdateKind.XButton1Released; - if (args.Type == RawPointerEventType.XButton2Up) - kind = PointerUpdateKind.XButton2Released; - - return new PointerPointProperties(args.InputModifiers, kind); + return new PointerPointProperties(args.InputModifiers, args.Type switch + { + RawPointerEventType.LeftButtonDown => PointerUpdateKind.LeftButtonPressed, + RawPointerEventType.MiddleButtonDown => PointerUpdateKind.MiddleButtonPressed, + RawPointerEventType.RightButtonDown => PointerUpdateKind.RightButtonPressed, + RawPointerEventType.XButton1Down => PointerUpdateKind.XButton1Pressed, + RawPointerEventType.XButton2Down => PointerUpdateKind.XButton2Pressed, + RawPointerEventType.LeftButtonUp => PointerUpdateKind.LeftButtonReleased, + RawPointerEventType.MiddleButtonUp => PointerUpdateKind.MiddleButtonReleased, + RawPointerEventType.RightButtonUp => PointerUpdateKind.RightButtonReleased, + RawPointerEventType.XButton1Up => PointerUpdateKind.XButton1Released, + RawPointerEventType.XButton2Up => PointerUpdateKind.XButton2Released, + _ => PointerUpdateKind.Other, + }); } private MouseButton _lastMouseDownButton; diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs index aa4f89bb85..0fef462831 100644 --- a/src/Avalonia.Input/PenDevice.cs +++ b/src/Avalonia.Input/PenDevice.cs @@ -160,13 +160,12 @@ namespace Avalonia.Input private PointerPointProperties CreateProperties(RawPointerEventArgs args) { - var kind = PointerUpdateKind.Other; - - if (args.Type == RawPointerEventType.LeftButtonDown) - kind = PointerUpdateKind.LeftButtonPressed; - if (args.Type == RawPointerEventType.LeftButtonUp) - kind = PointerUpdateKind.LeftButtonReleased; - + var kind = args.Type switch + { + RawPointerEventType.LeftButtonDown => PointerUpdateKind.LeftButtonPressed, + RawPointerEventType.LeftButtonUp => PointerUpdateKind.LeftButtonReleased, + _ => PointerUpdateKind.Other, + }; return new PointerPointProperties(args.InputModifiers, kind, Twist, Pressure, XTilt, YTilt, IsEraser, IsInverted, IsBarrel); } From dc9fc4ab146432c1b07e0af563487c6b53a7a47d Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Mon, 24 Jan 2022 12:01:30 +0300 Subject: [PATCH 016/393] Handle Pointer History. Put into intermediate points. --- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 52981ac7ec..7b5e42e490 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -402,6 +402,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUPDATE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + Point[]? intermediatePoints = null; if (info.historyCount > 1) { @@ -456,6 +457,23 @@ namespace Avalonia.Win32 } } } + else + { + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyCount = (int)info.historyCount; + var historyInfos = new POINTER_INFO[historyCount]; + if (GetPointerInfoHistory(pointerId, ref historyCount, historyInfos)) + { + //last info is the same as the current so skip it + intermediatePoints = new Point[historyCount - 1]; + for (int i = 0;i < historyCount - 1; i++) + { + var historyInfo = historyInfos[i]; + intermediatePoints[i] = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + } + } + } } var eventType = GetEventType(message, info); @@ -468,11 +486,17 @@ namespace Avalonia.Win32 { break; } - e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId); + e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId) + { + IntermediatePoints = intermediatePoints + }; } else { - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers); + e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers) + { + IntermediatePoints = intermediatePoints + }; } break; } From f04adadc89f04ba881c0c3811786706038059b7e Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Mon, 24 Jan 2022 12:52:58 +0300 Subject: [PATCH 017/393] Release mouse capture if pen is close to digitizer. Release pen capture if pen is out of range of digitizer. --- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 7b5e42e490..dd961aec48 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -381,13 +381,18 @@ namespace Avalonia.Win32 break; } case WindowsMessage.WM_POINTERDEVICEINRANGE: - case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: { + _mouseDevice.Capture(null); //notifies about proximity of pointer device to the digitizer. //contains pointer id and proximity. //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdeviceinrange break; } + case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: + { + _penDevice.Capture(null); + break; + } case WindowsMessage.WM_NCPOINTERUPDATE: { //NC stands for non-client area - window header and window border @@ -545,6 +550,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERCAPTURECHANGED: { _mouseDevice.Capture(null); + _penDevice.Capture(null); return IntPtr.Zero; } case WindowsMessage.DM_POINTERHITTEST: From 903685839645adf7aa55e718372b26797c75c25f Mon Sep 17 00:00:00 2001 From: Sergey Mikolaytis Date: Mon, 24 Jan 2022 17:02:22 +0300 Subject: [PATCH 018/393] fix MK_NONE --- src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index d71efcb074..0431808a43 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -225,7 +225,7 @@ namespace Avalonia.Win32.Interop [Flags] public enum ModifierKeys { - MK_NONE = 0x0001, + MK_NONE = 0x0000, MK_LBUTTON = 0x0001, MK_RBUTTON = 0x0002, From 47a328ab878aa61e09c588310c42b4d8fc23f97d Mon Sep 17 00:00:00 2001 From: Nathan Garside Date: Thu, 27 Jan 2022 15:04:44 +0000 Subject: [PATCH 019/393] Add window position offset --- src/Windows/Avalonia.Win32/WindowImpl.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index e4f5268285..9c4037be92 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -448,10 +448,20 @@ namespace Avalonia.Win32 { GetWindowRect(_hwnd, out var rc); + // Windows 10 and 11 add a 7 pixel invisible border on the left/right/bottom of windows for resizing + if (Win32Platform.WindowsVersion.Major >= 10 && HasFullDecorations) + { + return new PixelPoint(rc.left + (int)(7 * _scaling), rc.top); + } + return new PixelPoint(rc.left, rc.top); } set { + if (Win32Platform.WindowsVersion.Major >= 10 && HasFullDecorations) + { + value = new PixelPoint(value.X - (int)(7 * _scaling), value.Y); + } SetWindowPos( Handle.Handle, IntPtr.Zero, From 1ae26b326e503527e6ff4615cd9399d5c950e696 Mon Sep 17 00:00:00 2001 From: Nathan Garside Date: Sat, 29 Jan 2022 12:03:01 +0000 Subject: [PATCH 020/393] Calculate border size --- src/Windows/Avalonia.Win32/WindowImpl.cs | 34 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 9c4037be92..94fe9168ab 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -448,20 +448,14 @@ namespace Avalonia.Win32 { GetWindowRect(_hwnd, out var rc); - // Windows 10 and 11 add a 7 pixel invisible border on the left/right/bottom of windows for resizing - if (Win32Platform.WindowsVersion.Major >= 10 && HasFullDecorations) - { - return new PixelPoint(rc.left + (int)(7 * _scaling), rc.top); - } - - return new PixelPoint(rc.left, rc.top); + var border = HiddenBorderSize; + return new PixelPoint(rc.left + border.Width, rc.top + border.Height); } set { - if (Win32Platform.WindowsVersion.Major >= 10 && HasFullDecorations) - { - value = new PixelPoint(value.X - (int)(7 * _scaling), value.Y); - } + var border = HiddenBorderSize; + value = new PixelPoint(value.X - border.Width, value.Y - border.Height); + SetWindowPos( Handle.Handle, IntPtr.Zero, @@ -475,6 +469,24 @@ namespace Avalonia.Win32 private bool HasFullDecorations => _windowProperties.Decorations == SystemDecorations.Full; + private PixelSize HiddenBorderSize + { + get + { + // Windows 10 and 11 add a 7 pixel invisible border on the left/right/bottom of windows for resizing + if (Win32Platform.WindowsVersion.Major < 10 || !HasFullDecorations) + { + return PixelSize.Empty; + } + + DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var clientRect, Marshal.SizeOf(typeof(RECT))); + GetWindowRect(_hwnd, out var frameRect); + var borderWidth = GetSystemMetrics(SystemMetric.SM_CXBORDER); + + return new PixelSize(clientRect.left - frameRect.left - borderWidth, 0); + } + } + public void Move(PixelPoint point) => Position = point; public void SetMinMaxSize(Size minSize, Size maxSize) From c646343beee6da4f8568751ffd56bdd2da1f92ff Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 20 Mar 2022 23:54:04 -0400 Subject: [PATCH 021/393] WIP on intermediate points win --- src/Avalonia.Input/PointerEventArgs.cs | 3 +- src/Avalonia.Input/PointerPoint.cs | 17 +++ src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 10 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 141 +++++++++++------- 4 files changed, 112 insertions(+), 59 deletions(-) diff --git a/src/Avalonia.Input/PointerEventArgs.cs b/src/Avalonia.Input/PointerEventArgs.cs index 0604d09dc4..a30c1c51dc 100644 --- a/src/Avalonia.Input/PointerEventArgs.cs +++ b/src/Avalonia.Input/PointerEventArgs.cs @@ -128,7 +128,8 @@ namespace Avalonia.Input for (var c = 0; c < previousPoints.Count; c++) { var pt = previousPoints[c]; - points[c] = new PointerPoint(Pointer, GetPosition(pt.Position, relativeTo), _properties); + var pointProperties = new PointerPointProperties(_properties, pt); + points[c] = new PointerPoint(Pointer, GetPosition(pt.Position, relativeTo), pointProperties); } points[points.Length - 1] = GetCurrentPoint(relativeTo); diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index 728bb1c579..ba69add7d8 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -84,6 +84,23 @@ namespace Avalonia.Input IsBarrelButtonPressed = isBarrel; } + internal PointerPointProperties(PointerPointProperties basedOn, Raw.RawPointerPoint rawPoint) + { + IsLeftButtonPressed = basedOn.IsLeftButtonPressed; + IsMiddleButtonPressed = basedOn.IsMiddleButtonPressed; + IsRightButtonPressed = basedOn.IsRightButtonPressed; + IsXButton1Pressed = basedOn.IsXButton1Pressed; + IsXButton2Pressed = basedOn.IsXButton2Pressed; + IsInverted = basedOn.IsInverted; + IsEraser = basedOn.IsEraser; + IsBarrelButtonPressed = basedOn.IsBarrelButtonPressed; + + Twist = rawPoint.Twist; + Pressure = rawPoint.Pressure; + XTilt = rawPoint.XTilt; + YTilt = rawPoint.YTilt; + } + public static PointerPointProperties None { get; } = new PointerPointProperties(); } diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index c157fa059c..cd99cdc23b 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -128,10 +128,16 @@ namespace Avalonia.Input.Raw /// Pointer position, in client DIPs. /// public Point Position { get; set; } - + + public float Twist { get; set; } + public float Pressure { get; set; } + public float XTilt { get; set; } + public float YTilt { get; set; } + + public RawPointerPoint() { - Position = default; + this = default; } } } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 1ef3cbaba2..5c17caa13b 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -1,4 +1,6 @@ using System; +using System.Buffers; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Text; @@ -413,78 +415,105 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUPDATE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); - Point[]? intermediatePoints = null; + if (info.pointerType == PointerInputType.PT_TOUCH + && ShouldIgnoreTouchEmulatedMessage()) + { + break; + } + var historyCount = (int)info.historyCount; + Lazy> intermediatePoints = null; if (info.historyCount > 1) { - if (info.pointerType == PointerInputType.PT_TOUCH) + intermediatePoints = new Lazy>(() => { - if (ShouldIgnoreTouchEmulatedMessage()) + var list = new List(historyCount - 1); + if (info.pointerType == PointerInputType.PT_TOUCH) { - break; - } - - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyCount = (int)info.historyCount; - var historyTouchInfos = new POINTER_TOUCH_INFO[historyCount]; - if (GetPointerTouchInfoHistory(pointerId, ref historyCount, historyTouchInfos)) - { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyTouchInfos = ArrayPool.Shared.Rent(historyCount); + try + { + if (GetPointerTouchInfoHistory(pointerId, ref historyCount, historyTouchInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyTouchInfo = historyTouchInfos[i]; + var historyInfo = historyTouchInfo.pointerInfo; + var historyPoint = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + list.Add(new RawPointerPoint + { + Position = historyPoint, + }); + } + } + } + finally { - var historyTouchInfo = historyTouchInfos[i]; - var historyInfo = historyTouchInfo.pointerInfo; - var historyEventType = GetEventType(message, historyInfo); - var historyPoint = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); - var historyModifiers = GetInputModifiers(historyInfo.dwKeyStates); - var historyTimestamp = historyInfo.dwTime == 0 ? timestamp : historyInfo.dwTime; - Input?.Invoke(new RawTouchEventArgs(_touchDevice, historyTimestamp, _owner, - historyEventType, historyPoint, historyModifiers, historyInfo.pointerId)); + ArrayPool.Shared.Return(historyTouchInfos); } } - } - else if (info.pointerType == PointerInputType.PT_PEN) - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyCount = (int)info.historyCount; - var historyPenInfos = new POINTER_PEN_INFO[historyCount]; - if (GetPointerPenInfoHistory(pointerId, ref historyCount, historyPenInfos)) + else if (info.pointerType == PointerInputType.PT_PEN) { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyPenInfos = ArrayPool.Shared.Rent(historyCount); + try { - var historyPenInfo = historyPenInfos[i]; - var historyInfo = historyPenInfo.pointerInfo; - var historyEventType = GetEventType(message, historyInfo); - var historyPoint = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); - var historyModifiers = GetInputModifiers(historyInfo.dwKeyStates); - var historyTimestamp = historyInfo.dwTime == 0 ? timestamp : historyInfo.dwTime; - - ApplyPenInfo(historyPenInfo); - Input?.Invoke(new RawPointerEventArgs(_penDevice, historyTimestamp, _owner, - historyEventType, historyPoint, historyModifiers)); + if (GetPointerPenInfoHistory(pointerId, ref historyCount, historyPenInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyPenInfo = historyPenInfos[i]; + var historyInfo = historyPenInfo.pointerInfo; + var historyPoint = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + list.Add(new RawPointerPoint + { + Position = historyPoint, + Pressure = historyPenInfo.pressure, + Twist = historyPenInfo.rotation, + XTilt = historyPenInfo.tiltX, + YTilt = historyPenInfo.tiltX + }); + } + } + } + finally + { + ArrayPool.Shared.Return(historyPenInfos); } } - } - else - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyCount = (int)info.historyCount; - var historyInfos = new POINTER_INFO[historyCount]; - if (GetPointerInfoHistory(pointerId, ref historyCount, historyInfos)) + else { - //last info is the same as the current so skip it - intermediatePoints = new Point[historyCount - 1]; - for (int i = 0;i < historyCount - 1; i++) + var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); + var historyInfos = ArrayPool.Shared.Rent(historyCount); + try + { + if (GetPointerInfoHistory(pointerId, ref historyCount, historyInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyInfo = historyInfos[i]; + var historyPoint = PointToClient(new PixelPoint( + historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + list.Add(new RawPointerPoint + { + Position = historyPoint + }); + } + } + } + finally { - var historyInfo = historyInfos[i]; - intermediatePoints[i] = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); + ArrayPool.Shared.Return(historyInfos); } } - } + return list; + }); } var eventType = GetEventType(message, info); From d8f7dc5d1f2200a114404f9ed9cc7f34a58d0091 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 24 Mar 2022 20:28:56 -0400 Subject: [PATCH 022/393] Make EnableWmPointerEvents optional --- src/Windows/Avalonia.Win32/Win32Platform.cs | 9 +++ .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 66 +++++++++++++------ src/Windows/Avalonia.Win32/WindowImpl.cs | 14 ++-- 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 5cfbab40e4..25a6717122 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -63,8 +63,17 @@ namespace Avalonia /// /// Multitouch allows a surface (a touchpad or touchscreen) to recognize the presence of more than one point of contact with the surface at the same time. /// + [Obsolete("Multitouch is always enabled")] public bool? EnableMultitouch { get; set; } = true; + /// + /// Enables Win8+ WM_POINTER events support. The default value is false. + /// + /// + /// Required for extended Pen and Touch support. + /// + public bool? EnableWmPointerEvents { get; set; } = false; + /// /// Embeds popups to the window when set to true. The default value is false. /// diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 5c17caa13b..d52115425f 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -174,7 +174,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONDOWN: case WindowsMessage.WM_XBUTTONDOWN: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -207,7 +207,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONUP: case WindowsMessage.WM_XBUTTONUP: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -240,7 +240,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEMOVE: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -275,7 +275,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEWHEEL: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -291,7 +291,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEHWHEEL: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -307,7 +307,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSELEAVE: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -327,7 +327,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCMBUTTONDOWN: case WindowsMessage.WM_NCXBUTTONDOWN: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -351,7 +351,7 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_TOUCH: { - if (Win8Plus) + if (_wmPointerEnabled) { break; } @@ -384,12 +384,20 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERDEVICECHANGE: { + if (!_wmPointerEnabled) + { + break; + } //notifies about changes in the settings of a monitor that has a digitizer attached to it. //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdevicechange break; } case WindowsMessage.WM_POINTERDEVICEINRANGE: { + if (!_wmPointerEnabled) + { + break; + } _mouseDevice.Capture(null); //notifies about proximity of pointer device to the digitizer. //contains pointer id and proximity. @@ -398,11 +406,19 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: { + if (!_wmPointerEnabled) + { + break; + } _penDevice.Capture(null); break; } case WindowsMessage.WM_NCPOINTERUPDATE: { + if (!_wmPointerEnabled) + { + break; + } //NC stands for non-client area - window header and window border //As I found above in an old message handling - we dont need to handle NC pointer move/updates. //All we need is pointer down and up. So this is skipped for now. @@ -415,8 +431,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUPDATE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); - if (info.pointerType == PointerInputType.PT_TOUCH - && ShouldIgnoreTouchEmulatedMessage()) + if (!_wmPointerEnabled) { break; } @@ -522,10 +537,6 @@ namespace Avalonia.Win32 if (device is TouchDevice) { - if (ShouldIgnoreTouchEmulatedMessage()) - { - break; - } e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId) { IntermediatePoints = intermediatePoints @@ -542,6 +553,10 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERENTER: { + if (!_wmPointerEnabled) + { + break; + } //this is not handled by WM_MOUSEENTER so I think there is no need to handle this too. //but we can detect a new pointer by this message and calling IS_POINTER_NEW_WPARAM @@ -552,6 +567,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERLEAVE: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + if (!_wmPointerEnabled) + { + break; + } if (device is TouchDevice) { break; @@ -567,6 +586,10 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERHWHEEL: { GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); + if (!_wmPointerEnabled) + { + break; + } var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); var modifiers = GetInputModifiers(info.dwKeyStates); @@ -577,6 +600,10 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERACTIVATE: { + if (!_wmPointerEnabled) + { + break; + } //occurs when a pointer activates an inactive window. //we should handle this and return PA_ACTIVATE or PA_NOACTIVATE //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointeractivate @@ -584,6 +611,10 @@ namespace Avalonia.Win32 } case WindowsMessage.WM_POINTERCAPTURECHANGED: { + if (!_wmPointerEnabled) + { + break; + } _mouseDevice.Capture(null); _penDevice.Capture(null); return IntPtr.Zero; @@ -913,8 +944,6 @@ namespace Avalonia.Win32 }; } - public readonly bool Win8Plus = Win32Platform.WindowsVersion >= PlatformConstants.Windows8; - private void UpdateInputMethod(IntPtr hkl) { // note: for non-ime language, also create it so that emoji panel tracks cursor @@ -951,10 +980,7 @@ namespace Avalonia.Win32 private bool ShouldIgnoreTouchEmulatedMessage() { - if (!_multitouch) - { - return false; - } + // Note: GetMessageExtraInfo doesn't work with WM_POINTER events. // MI_WP_SIGNATURE // https://docs.microsoft.com/en-us/windows/win32/tablet/system-events-and-mouse-messages diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index becbbe7561..53dde352f7 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -75,7 +75,7 @@ namespace Avalonia.Win32 private WndProc _wndProcDelegate; private string _className; private IntPtr _hwnd; - private bool _multitouch; + private bool _wmPointerEnabled; private IInputRoot _owner; private WindowProperties _windowProperties; private bool _trackingMouse;//ToDo - there is something missed. Needs investigation @Steven Kirk @@ -128,7 +128,10 @@ namespace Avalonia.Win32 egl.Display is AngleWin32EglDisplay angleDisplay && angleDisplay.PlatformApi == AngleOptions.PlatformApi.DirectX11; - if (Win8Plus && !IsMouseInPointerEnabled()) + _wmPointerEnabled = Win32Platform.Options.EnableWmPointerEvents + ?? Win32Platform.WindowsVersion >= PlatformConstants.Windows8; + + if (_wmPointerEnabled && !IsMouseInPointerEnabled()) { EnableMouseInPointer(true); } @@ -795,12 +798,7 @@ namespace Avalonia.Win32 Handle = new WindowImplPlatformHandle(this); - _multitouch = Win32Platform.Options.EnableMultitouch ?? true; - - if (_multitouch) - { - RegisterTouchWindow(_hwnd, 0); - } + RegisterTouchWindow(_hwnd, 0); if (ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8) { From b599f295f6b94d01bec4d267bc6759da1d69833c Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Apr 2022 01:10:45 -0400 Subject: [PATCH 023/393] Add RawPointerId to the RawPointerEventArgs --- src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 5 ++++ src/Avalonia.Input/Raw/RawTouchEventArgs.cs | 17 ++++++++++--- src/Avalonia.Input/TouchDevice.cs | 13 +++++----- src/Shared/RawEventGrouping.cs | 12 ++++------ .../TouchDeviceTests.cs | 24 ++++++++++++------- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index 58ea076379..1faa20fbf1 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -87,6 +87,11 @@ namespace Avalonia.Input.Raw InputModifiers = inputModifiers; } + /// + /// Gets the raw pointer identifier. + /// + public long RawPointerId { get; set; } + /// /// Gets the pointer properties and position, in client DIPs. /// diff --git a/src/Avalonia.Input/Raw/RawTouchEventArgs.cs b/src/Avalonia.Input/Raw/RawTouchEventArgs.cs index 020b40e55b..6706a45f48 100644 --- a/src/Avalonia.Input/Raw/RawTouchEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawTouchEventArgs.cs @@ -1,15 +1,26 @@ +using System; + namespace Avalonia.Input.Raw { public class RawTouchEventArgs : RawPointerEventArgs { public RawTouchEventArgs(IInputDevice device, ulong timestamp, IInputRoot root, RawPointerEventType type, Point position, RawInputModifiers inputModifiers, - long touchPointId) + long rawPointerId) : base(device, timestamp, root, type, position, inputModifiers) { - TouchPointId = touchPointId; + RawPointerId = rawPointerId; + } + + public RawTouchEventArgs(IInputDevice device, ulong timestamp, IInputRoot root, + RawPointerEventType type, RawPointerPoint point, RawInputModifiers inputModifiers, + long rawPointerId) + : base(device, timestamp, root, type, point, inputModifiers) + { + RawPointerId = rawPointerId; } - public long TouchPointId { get; set; } + [Obsolete("Use RawPointerId")] + public long TouchPointId { get => RawPointerId; set => RawPointerId = value; } } } diff --git a/src/Avalonia.Input/TouchDevice.cs b/src/Avalonia.Input/TouchDevice.cs index 54dcc4051e..e914d860fd 100644 --- a/src/Avalonia.Input/TouchDevice.cs +++ b/src/Avalonia.Input/TouchDevice.cs @@ -40,14 +40,14 @@ namespace Avalonia.Input { if (ev.Handled || _disposed) return; - var args = (RawTouchEventArgs)ev; - if (!_pointers.TryGetValue(args.TouchPointId, out var pointer)) + var args = (RawPointerEventArgs)ev; + if (!_pointers.TryGetValue(args.RawPointerId, out var pointer)) { if (args.Type == RawPointerEventType.TouchEnd) return; var hit = args.InputHitTestResult; - _pointers[args.TouchPointId] = pointer = new Pointer(Pointer.GetNextFreeId(), + _pointers[args.RawPointerId] = pointer = new Pointer(Pointer.GetNextFreeId(), PointerType.Touch, _pointers.Count == 0); pointer.Capture(hit); } @@ -88,7 +88,7 @@ namespace Avalonia.Input if (args.Type == RawPointerEventType.TouchEnd) { - _pointers.Remove(args.TouchPointId); + _pointers.Remove(args.RawPointerId); using (pointer) { target.RaiseEvent(new PointerReleasedEventArgs(target, pointer, @@ -101,7 +101,7 @@ namespace Avalonia.Input if (args.Type == RawPointerEventType.TouchCancel) { - _pointers.Remove(args.TouchPointId); + _pointers.Remove(args.RawPointerId); using (pointer) pointer.Capture(null); _lastPointer = null; @@ -129,8 +129,7 @@ namespace Avalonia.Input public IPointer? TryGetPointer(RawPointerEventArgs ev) { - return ev is RawTouchEventArgs args - && _pointers.TryGetValue(args.TouchPointId, out var pointer) + return _pointers.TryGetValue(ev.RawPointerId, out var pointer) ? pointer : null; } diff --git a/src/Shared/RawEventGrouping.cs b/src/Shared/RawEventGrouping.cs index 084593ffc6..966744888c 100644 --- a/src/Shared/RawEventGrouping.cs +++ b/src/Shared/RawEventGrouping.cs @@ -2,10 +2,8 @@ using System; using System.Collections.Generic; using Avalonia.Collections.Pooled; -using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Threading; -using JetBrains.Annotations; namespace Avalonia; @@ -19,7 +17,7 @@ internal class RawEventGrouper : IDisposable private readonly Action _eventCallback; private readonly Queue _inputQueue = new(); private readonly Action _dispatchFromQueue; - readonly Dictionary _lastTouchPoints = new(); + readonly Dictionary _lastTouchPoints = new(); RawInputEventArgs? _lastEvent; public RawEventGrouper(Action eventCallback) @@ -49,7 +47,7 @@ internal class RawEventGrouper : IDisposable _lastEvent = null; if (ev is RawTouchEventArgs { Type: RawPointerEventType.TouchUpdate } touchUpdate) - _lastTouchPoints.Remove(touchUpdate.TouchPointId); + _lastTouchPoints.Remove(touchUpdate.RawPointerId); _eventCallback?.Invoke(ev); @@ -88,11 +86,11 @@ internal class RawEventGrouper : IDisposable { if (args is RawTouchEventArgs touchEvent) { - if (_lastTouchPoints.TryGetValue(touchEvent.TouchPointId, out var lastTouchEvent)) + if (_lastTouchPoints.TryGetValue(touchEvent.RawPointerId, out var lastTouchEvent)) MergeEvents(lastTouchEvent, touchEvent); else { - _lastTouchPoints[touchEvent.TouchPointId] = touchEvent; + _lastTouchPoints[touchEvent.RawPointerId] = touchEvent; AddToQueue(touchEvent); } } @@ -105,7 +103,7 @@ internal class RawEventGrouper : IDisposable { _lastTouchPoints.Clear(); if (args is RawTouchEventArgs { Type: RawPointerEventType.TouchUpdate } touchEvent) - _lastTouchPoints[touchEvent.TouchPointId] = touchEvent; + _lastTouchPoints[touchEvent.RawPointerId] = touchEvent; } AddToQueue(args); } diff --git a/tests/Avalonia.Input.UnitTests/TouchDeviceTests.cs b/tests/Avalonia.Input.UnitTests/TouchDeviceTests.cs index 80c5a45c1a..7b7d547346 100644 --- a/tests/Avalonia.Input.UnitTests/TouchDeviceTests.cs +++ b/tests/Avalonia.Input.UnitTests/TouchDeviceTests.cs @@ -219,30 +219,36 @@ namespace Avalonia.Input.UnitTests { for (int i = 0; i < touchPointIds.Length; i++) { - inputManager.ProcessInput(new RawTouchEventArgs(device, 0, + inputManager.ProcessInput(new RawPointerEventArgs(device, 0, root, type, new Point(0, 0), - RawInputModifiers.None, - touchPointIds[i])); + RawInputModifiers.None) + { + RawPointerId = touchPointIds[i] + }); } } private static void TapOnce(IInputManager inputManager, TouchDevice device, IInputRoot root, ulong timestamp = 0, long touchPointId = 0) { - inputManager.ProcessInput(new RawTouchEventArgs(device, timestamp, + inputManager.ProcessInput(new RawPointerEventArgs(device, timestamp, root, RawPointerEventType.TouchBegin, new Point(0, 0), - RawInputModifiers.None, - touchPointId)); - inputManager.ProcessInput(new RawTouchEventArgs(device, timestamp, + RawInputModifiers.None) + { + RawPointerId = touchPointId + }); + inputManager.ProcessInput(new RawPointerEventArgs(device, timestamp, root, RawPointerEventType.TouchEnd, new Point(0, 0), - RawInputModifiers.None, - touchPointId)); + RawInputModifiers.None) + { + RawPointerId = touchPointId + }); } } } From afb828d4ff3aac67f122b2badd6d5c7399c9081b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Apr 2022 04:00:29 -0400 Subject: [PATCH 024/393] Move IntermediatePoints creation and update RawInputModifiers --- src/Avalonia.Input/IKeyboardDevice.cs | 7 +- src/Avalonia.Input/PenDevice.cs | 404 ++++-------------- src/Avalonia.Input/PointerPoint.cs | 12 +- src/Avalonia.Input/Raw/RawPointerEventArgs.cs | 4 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 379 ++++++++-------- src/Windows/Avalonia.Win32/WindowImpl.cs | 7 + 6 files changed, 278 insertions(+), 535 deletions(-) diff --git a/src/Avalonia.Input/IKeyboardDevice.cs b/src/Avalonia.Input/IKeyboardDevice.cs index d0e84e5ad0..1b9a056272 100644 --- a/src/Avalonia.Input/IKeyboardDevice.cs +++ b/src/Avalonia.Input/IKeyboardDevice.cs @@ -42,12 +42,17 @@ namespace Avalonia.Input Control = 2, Shift = 4, Meta = 8, + LeftMouseButton = 16, RightMouseButton = 32, MiddleMouseButton = 64, XButton1MouseButton = 128, XButton2MouseButton = 256, - KeyboardMask = Alt | Control | Shift | Meta + KeyboardMask = Alt | Control | Shift | Meta, + + PenInverted = 512, + PenEraser = 1024, + PenBarrelButton = 2048 } public interface IKeyboardDevice : IInputDevice, INotifyPropertyChanged diff --git a/src/Avalonia.Input/PenDevice.cs b/src/Avalonia.Input/PenDevice.cs index 0fef462831..d22b48562c 100644 --- a/src/Avalonia.Input/PenDevice.cs +++ b/src/Avalonia.Input/PenDevice.cs @@ -1,8 +1,8 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using Avalonia.Input.Raw; -using Avalonia.Interactivity; using Avalonia.Platform; using Avalonia.VisualTree; @@ -13,72 +13,14 @@ namespace Avalonia.Input /// public class PenDevice : IPenDevice, IDisposable { + private readonly Dictionary _pointers = new(); + private readonly Dictionary _lastPositions = new(); private int _clickCount; private Rect _lastClickRect; private ulong _lastClickTime; + private MouseButton _lastMouseDownButton; - private readonly Pointer _pointer; private bool _disposed; - private PixelPoint? _position; - - public PenDevice(Pointer? pointer = null) - { - _pointer = pointer ?? new Pointer(Pointer.GetNextFreeId(), PointerType.Pen, true); - } - - /// - /// Gets the control that is currently capturing by the mouse, if any. - /// - /// - /// When an element captures the mouse, it receives mouse input whether the cursor is - /// within the control's bounds or not. To set the mouse capture, call the - /// method. - /// - [Obsolete("Use IPointer instead")] - public IInputElement? Captured => _pointer.Captured; - - public bool IsEraser { get; set; } - public bool IsInverted { get; set; } - public bool IsBarrel { get; set; } - public int XTilt { get; set; } - public int YTilt { get; set; } - public uint Pressure { get; set; } - public uint Twist { get; set; } - - /// - /// Captures mouse input to the specified control. - /// - /// The control. - /// - /// When an element captures the mouse, it receives mouse input whether the cursor is - /// within the control's bounds or not. The current mouse capture control is exposed - /// by the property. - /// - public void Capture(IInputElement? control) - { - _pointer.Capture(control); - } - - /// - /// Gets the mouse position relative to a control. - /// - /// The control. - /// The mouse position in the control's coordinates. - public Point GetPosition(IVisual relativeTo) - { - relativeTo = relativeTo ?? throw new ArgumentNullException(nameof(relativeTo)); - - if (relativeTo.VisualRoot == null) - { - throw new InvalidOperationException("Control is not attached to visual tree."); - } - -#pragma warning disable CS0618 // Type or member is obsolete - var rootPoint = relativeTo.VisualRoot.PointToClient(_position ?? new PixelPoint(-1, -1)); -#pragma warning restore CS0618 // Type or member is obsolete - var transform = relativeTo.VisualRoot.TransformToVisual(relativeTo); - return rootPoint * transform!.Value; - } public void ProcessRawEvent(RawInputEventArgs e) { @@ -86,151 +28,93 @@ namespace Avalonia.Input ProcessRawEvent(margs); } - public void TopLevelClosed(IInputRoot root) + private void ProcessRawEvent(RawPointerEventArgs e) { - ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); - } + e = e ?? throw new ArgumentNullException(nameof(e)); - public void SceneInvalidated(IInputRoot root, Rect rect) - { - // Pointer is outside of the target area - if (_position == null ) + if (!_pointers.TryGetValue(e.RawPointerId, out var pointer)) { - if (root.PointerOverElement != null) - ClearPointerOver(this, 0, root, PointerPointProperties.None, KeyModifiers.None); - return; - } - - - var clientPoint = root.PointToClient(_position.Value); + if (e.Type == RawPointerEventType.LeftButtonUp + || e.Type == RawPointerEventType.TouchEnd) + return; - if (rect.Contains(clientPoint)) - { - if (_pointer.Captured == null) - { - SetPointerOver(this, 0 /* TODO: proper timestamp */, root, clientPoint, - PointerPointProperties.None, KeyModifiers.None); - } - else - { - SetPointerOver(this, 0 /* TODO: proper timestamp */, root, _pointer.Captured, - PointerPointProperties.None, KeyModifiers.None); - } + _pointers[e.RawPointerId] = pointer = new Pointer(Pointer.GetNextFreeId(), + PointerType.Pen, _pointers.Count == 0); } - } - - private void ProcessRawEvent(RawPointerEventArgs e) - { - e = e ?? throw new ArgumentNullException(nameof(e)); - var pen = (PenDevice)e.Device; - if(pen._disposed) - return; + _lastPositions[e.RawPointerId] = e.Root.PointToScreen(e.Position); + + var props = new PointerPointProperties(e.InputModifiers, e.Type.ToUpdateKind(), + e.Point.Twist, e.Point.Pressure, e.Point.XTilt, e.Point.YTilt); + var keyModifiers = e.InputModifiers.ToKeyModifiers(); - _position = e.Root.PointToScreen(e.Position); - var props = CreateProperties(e); - var keyModifiers = KeyModifiersUtils.ConvertToKey(e.InputModifiers); + bool shouldReleasePointer = false; switch (e.Type) { case RawPointerEventType.LeaveWindow: - LeaveWindow(pen, e.Timestamp, e.Root, props, keyModifiers); + shouldReleasePointer = true; break; case RawPointerEventType.LeftButtonDown: - e.Handled = PenDown(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); + e.Handled = PenDown(pointer, e.Timestamp, e.Root, e.Position, props, keyModifiers, e.InputHitTestResult); break; case RawPointerEventType.LeftButtonUp: - e.Handled = PenUp(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); + e.Handled = PenUp(pointer, e.Timestamp, e.Root, e.Position, props, keyModifiers, e.InputHitTestResult); break; case RawPointerEventType.Move: - e.Handled = PenMove(pen, e.Timestamp, e.Root, e.Position, props, keyModifiers); + e.Handled = PenMove(pointer, e.Timestamp, e.Root, e.Position, props, keyModifiers, e.InputHitTestResult, e.IntermediatePoints); break; } - } - - private void LeaveWindow(IPenDevice device, ulong timestamp, IInputRoot root, PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - _position = null; - ClearPointerOver(this, timestamp, root, properties, inputModifiers); - } - - private PointerPointProperties CreateProperties(RawPointerEventArgs args) - { - var kind = args.Type switch + if (shouldReleasePointer) { - RawPointerEventType.LeftButtonDown => PointerUpdateKind.LeftButtonPressed, - RawPointerEventType.LeftButtonUp => PointerUpdateKind.LeftButtonReleased, - _ => PointerUpdateKind.Other, - }; - return new PointerPointProperties(args.InputModifiers, kind, - Twist, Pressure, XTilt, YTilt, IsEraser, IsInverted, IsBarrel); + pointer.Dispose(); + _pointers.Remove(e.RawPointerId); + _lastPositions.Remove(e.RawPointerId); + } } - private MouseButton _lastMouseDownButton; - private bool PenDown(IPenDevice device, ulong timestamp, IInputElement root, Point p, - PointerPointProperties properties, - KeyModifiers inputModifiers) + private bool PenDown(Pointer pointer, ulong timestamp, + IInputElement root, Point p, PointerPointProperties properties, + KeyModifiers inputModifiers, IInputElement? hitTest) { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); + var source = pointer.Captured ?? hitTest; - if (hit != null) + if (source != null) { - _pointer.Capture(hit); - var source = GetSource(hit); - if (source != null) - { - var settings = AvaloniaLocator.Current.GetService(); - var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; - var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); - - if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) - { - _clickCount = 0; - } + pointer.Capture(source); + var settings = AvaloniaLocator.Current.GetService(); + var doubleClickTime = settings?.DoubleClickTime.TotalMilliseconds ?? 500; + var doubleClickSize = settings?.DoubleClickSize ?? new Size(4, 4); - ++_clickCount; - _lastClickTime = timestamp; - _lastClickRect = new Rect(p, new Size()) - .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); - _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); - var e = new PointerPressedEventArgs(source, _pointer, root, p, timestamp, properties, inputModifiers, _clickCount); - source.RaiseEvent(e); - return e.Handled; + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) + { + _clickCount = 0; } + + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) + .Inflate(new Thickness(doubleClickSize.Width / 2, doubleClickSize.Height / 2)); + _lastMouseDownButton = properties.PointerUpdateKind.GetMouseButton(); + var e = new PointerPressedEventArgs(source, pointer, root, p, timestamp, properties, inputModifiers, _clickCount); + source.RaiseEvent(e); + return e.Handled; } return false; } - private bool PenMove(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties properties, - KeyModifiers inputModifiers) + private bool PenMove(Pointer pointer, ulong timestamp, + IInputRoot root, Point p, PointerPointProperties properties, + KeyModifiers inputModifiers, IInputElement? hitTest, + Lazy?>? intermediatePoints) { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - IInputElement? source; - - if (_pointer.Captured == null) - { - source = SetPointerOver(this, timestamp, root, p, properties, inputModifiers); - } - else - { - SetPointerOver(this, timestamp, root, _pointer.Captured, properties, inputModifiers); - source = _pointer.Captured; - } + var source = pointer.Captured ?? hitTest; - if (source is object) + if (source is not null) { - var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, _pointer, root, - p, timestamp, properties, inputModifiers); + var e = new PointerEventArgs(InputElement.PointerMovedEvent, source, pointer, root, + p, timestamp, properties, inputModifiers, intermediatePoints); source.RaiseEvent(e); return e.Handled; @@ -239,176 +123,52 @@ namespace Avalonia.Input return false; } - private bool PenUp(IPenDevice device, ulong timestamp, IInputRoot root, Point p, PointerPointProperties props, - KeyModifiers inputModifiers) + private bool PenUp(Pointer pointer, ulong timestamp, + IInputElement root, Point p, PointerPointProperties properties, + KeyModifiers inputModifiers, IInputElement? hitTest) { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var hit = HitTest(root, p); - var source = GetSource(hit); + var source = pointer.Captured ?? hitTest; if (source is not null) { - var e = new PointerReleasedEventArgs(source, _pointer, root, p, timestamp, props, inputModifiers, + var e = new PointerReleasedEventArgs(source, pointer, root, p, timestamp, properties, inputModifiers, _lastMouseDownButton); source?.RaiseEvent(e); - _pointer.Capture(null); + pointer.Capture(null); return e.Handled; } return false; } - private IInteractive? GetSource(IVisual? hit) - { - if (hit is null) - return null; - - return _pointer.Captured ?? - (hit as IInteractive) ?? - hit.GetSelfAndVisualAncestors().OfType().FirstOrDefault(); - } - - private IInputElement? HitTest(IInputElement root, Point p) - { - root = root ?? throw new ArgumentNullException(nameof(root)); - - return _pointer.Captured ?? root.InputHitTest(p); - } - - PointerEventArgs CreateSimpleEvent(RoutedEvent ev, ulong timestamp, IInteractive? source, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - return new PointerEventArgs(ev, source, _pointer, null, default, - timestamp, properties, inputModifiers); - } - - private void ClearPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var element = root.PointerOverElement; - var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, element, properties, inputModifiers); - - if (element!=null && !element.IsAttachedToVisualTree) - { - // element has been removed from visual tree so do top down cleanup - if (root.IsPointerOver) - ClearChildrenPointerOver(e, root,true); - } - while (element != null) - { - e.Source = element; - e.Handled = false; - element.RaiseEvent(e); - element = (IInputElement?)element.VisualParent; - } - - root.PointerOverElement = null; - } - - private void ClearChildrenPointerOver(PointerEventArgs e, IInputElement element,bool clearRoot) - { - foreach (IInputElement el in element.VisualChildren) - { - if (el.IsPointerOver) - { - ClearChildrenPointerOver(e, el, true); - break; - } - } - if(clearRoot) - { - e.Source = element; - e.Handled = false; - element.RaiseEvent(e); - } - } - - private IInputElement? SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, Point p, - PointerPointProperties properties, - KeyModifiers inputModifiers) + public void Dispose() { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - - var element = root.InputHitTest(p); - - if (element != root.PointerOverElement) - { - if (element != null) - { - SetPointerOver(device, timestamp, root, element, properties, inputModifiers); - } - else - { - ClearPointerOver(device, timestamp, root, properties, inputModifiers); - } - } - - return element; + if (_disposed) + return; + var values = _pointers.Values.ToList(); + _pointers.Clear(); + _disposed = true; + foreach (var p in values) + p.Dispose(); } - private void SetPointerOver(IPointerDevice device, ulong timestamp, IInputRoot root, IInputElement element, - PointerPointProperties properties, - KeyModifiers inputModifiers) - { - device = device ?? throw new ArgumentNullException(nameof(device)); - root = root ?? throw new ArgumentNullException(nameof(root)); - element = element ?? throw new ArgumentNullException(nameof(element)); + [Obsolete] + IInputElement? IPointerDevice.Captured => _pointers.Values + .FirstOrDefault(p => p.IsPrimary)?.Captured; - IInputElement? branch = null; + [Obsolete] + void IPointerDevice.Capture(IInputElement? control) => _pointers.Values + .FirstOrDefault(p => p.IsPrimary)?.Capture(control); - IInputElement? el = element; + [Obsolete] + Point IPointerDevice.GetPosition(IVisual relativeTo) => new Point(-1, -1); - while (el != null) - { - if (el.IsPointerOver) - { - branch = el; - break; - } - el = (IInputElement?)el.VisualParent; - } - - el = root.PointerOverElement; - - var e = CreateSimpleEvent(InputElement.PointerLeaveEvent, timestamp, el, properties, inputModifiers); - if (el!=null && branch!=null && !el.IsAttachedToVisualTree) - { - ClearChildrenPointerOver(e,branch,false); - } - - while (el != null && el != branch) - { - e.Source = el; - e.Handled = false; - el.RaiseEvent(e); - el = (IInputElement?)el.VisualParent; - } - - el = root.PointerOverElement = element; - e.RoutedEvent = InputElement.PointerEnterEvent; - - while (el != null && el != branch) - { - e.Source = el; - e.Handled = false; - el.RaiseEvent(e); - el = (IInputElement?)el.VisualParent; - } - } - - public void Dispose() + public IPointer? TryGetPointer(RawPointerEventArgs ev) { - _disposed = true; - _pointer?.Dispose(); + return _pointers.TryGetValue(ev.RawPointerId, out var pointer) + ? pointer + : null; } } } diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index ba69add7d8..c704aa28c6 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -1,3 +1,5 @@ +using Avalonia.Input.Raw; + namespace Avalonia.Input { public sealed class PointerPoint @@ -45,6 +47,9 @@ namespace Avalonia.Input IsRightButtonPressed = modifiers.HasAllFlags(RawInputModifiers.RightMouseButton); IsXButton1Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton1MouseButton); IsXButton2Pressed = modifiers.HasAllFlags(RawInputModifiers.XButton2MouseButton); + IsInverted = modifiers.HasAllFlags(RawInputModifiers.PenInverted); + IsEraser = modifiers.HasAllFlags(RawInputModifiers.PenEraser); + IsBarrelButtonPressed = modifiers.HasAllFlags(RawInputModifiers.PenBarrelButton); // The underlying input source might be reporting the previous state, // so make sure that we reflect the current state @@ -72,19 +77,16 @@ namespace Avalonia.Input } public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind, - float twist, float pressure, float xTilt, float yTilt, bool isEraser, bool isInverted, bool isBarrel + float twist, float pressure, float xTilt, float yTilt ) : this (modifiers, kind) { Twist = twist; Pressure = pressure; XTilt = xTilt; YTilt = yTilt; - IsEraser = isEraser; - IsInverted = isInverted; - IsBarrelButtonPressed = isBarrel; } - internal PointerPointProperties(PointerPointProperties basedOn, Raw.RawPointerPoint rawPoint) + internal PointerPointProperties(PointerPointProperties basedOn, RawPointerPoint rawPoint) { IsLeftButtonPressed = basedOn.IsLeftButtonPressed; IsMiddleButtonPressed = basedOn.IsMiddleButtonPressed; diff --git a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs index 1faa20fbf1..0e4e0ed3e2 100644 --- a/src/Avalonia.Input/Raw/RawPointerEventArgs.cs +++ b/src/Avalonia.Input/Raw/RawPointerEventArgs.cs @@ -56,11 +56,12 @@ namespace Avalonia.Input.Raw Contract.Requires(device != null); Contract.Requires(root != null); + Point = new RawPointerPoint(); Position = position; Type = type; InputModifiers = inputModifiers; } - + /// /// Initializes a new instance of the class. /// @@ -145,6 +146,7 @@ namespace Avalonia.Input.Raw public RawPointerPoint() { this = default; + Pressure = 0.5f; } } } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index d52115425f..6619c60152 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -380,48 +380,6 @@ namespace Avalonia.Win32 return IntPtr.Zero; } - break; - } - case WindowsMessage.WM_POINTERDEVICECHANGE: - { - if (!_wmPointerEnabled) - { - break; - } - //notifies about changes in the settings of a monitor that has a digitizer attached to it. - //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdevicechange - break; - } - case WindowsMessage.WM_POINTERDEVICEINRANGE: - { - if (!_wmPointerEnabled) - { - break; - } - _mouseDevice.Capture(null); - //notifies about proximity of pointer device to the digitizer. - //contains pointer id and proximity. - //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdeviceinrange - break; - } - case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: - { - if (!_wmPointerEnabled) - { - break; - } - _penDevice.Capture(null); - break; - } - case WindowsMessage.WM_NCPOINTERUPDATE: - { - if (!_wmPointerEnabled) - { - break; - } - //NC stands for non-client area - window header and window border - //As I found above in an old message handling - we dont need to handle NC pointer move/updates. - //All we need is pointer down and up. So this is skipped for now. break; } case WindowsMessage.WM_NCPOINTERDOWN: @@ -430,194 +388,92 @@ namespace Avalonia.Win32 case WindowsMessage.WM_POINTERUP: case WindowsMessage.WM_POINTERUPDATE: { - GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); if (!_wmPointerEnabled) { break; } - - var historyCount = (int)info.historyCount; - Lazy> intermediatePoints = null; - if (info.historyCount > 1) - { - intermediatePoints = new Lazy>(() => - { - var list = new List(historyCount - 1); - if (info.pointerType == PointerInputType.PT_TOUCH) - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyTouchInfos = ArrayPool.Shared.Rent(historyCount); - try - { - if (GetPointerTouchInfoHistory(pointerId, ref historyCount, historyTouchInfos)) - { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) - { - var historyTouchInfo = historyTouchInfos[i]; - var historyInfo = historyTouchInfo.pointerInfo; - var historyPoint = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); - list.Add(new RawPointerPoint - { - Position = historyPoint, - }); - } - } - } - finally - { - ArrayPool.Shared.Return(historyTouchInfos); - } - } - else if (info.pointerType == PointerInputType.PT_PEN) - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyPenInfos = ArrayPool.Shared.Rent(historyCount); - try - { - if (GetPointerPenInfoHistory(pointerId, ref historyCount, historyPenInfos)) - { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) - { - var historyPenInfo = historyPenInfos[i]; - var historyInfo = historyPenInfo.pointerInfo; - var historyPoint = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); - list.Add(new RawPointerPoint - { - Position = historyPoint, - Pressure = historyPenInfo.pressure, - Twist = historyPenInfo.rotation, - XTilt = historyPenInfo.tiltX, - YTilt = historyPenInfo.tiltX - }); - } - } - } - finally - { - ArrayPool.Shared.Return(historyPenInfos); - } - } - else - { - var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); - var historyInfos = ArrayPool.Shared.Rent(historyCount); - try - { - if (GetPointerInfoHistory(pointerId, ref historyCount, historyInfos)) - { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) - { - var historyInfo = historyInfos[i]; - var historyPoint = PointToClient(new PixelPoint( - historyInfo.ptPixelLocationX, historyInfo.ptPixelLocationY)); - list.Add(new RawPointerPoint - { - Position = historyPoint - }); - } - } - } - finally - { - ArrayPool.Shared.Return(historyInfos); - } - } - return list; - }); - } - + GetDevicePointerInfo(wParam, out var device, out var info, out var point, out var modifiers, ref timestamp); var eventType = GetEventType(message, info); - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); - if (device is TouchDevice) - { - e = new RawTouchEventArgs(_touchDevice, timestamp, _owner, eventType, point, modifiers, info.pointerId) - { - IntermediatePoints = intermediatePoints - }; - } - else - { - e = new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers) - { - IntermediatePoints = intermediatePoints - }; - } - break; - } - case WindowsMessage.WM_POINTERENTER: - { - if (!_wmPointerEnabled) - { - break; - } - //this is not handled by WM_MOUSEENTER so I think there is no need to handle this too. - //but we can detect a new pointer by this message and calling IS_POINTER_NEW_WPARAM - - //note: by using a pen there can be a pointer leave or enter inside a window coords - //when you are just lift up the pen above the display + var args = CreatePointerArgs(device, timestamp, eventType, point, modifiers, info.pointerId); + args.IntermediatePoints = CreateLazyIntermediatePoints(info); + e = args; break; } + case WindowsMessage.WM_POINTERDEVICEOUTOFRANGE: case WindowsMessage.WM_POINTERLEAVE: + case WindowsMessage.WM_POINTERCAPTURECHANGED: { - GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); if (!_wmPointerEnabled) { break; } - if (device is TouchDevice) - { - break; - } - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); - - e = new RawPointerEventArgs( - device, timestamp, _owner, RawPointerEventType.LeaveWindow, point, modifiers); + GetDevicePointerInfo(wParam, out var device, out var info, out var point, out var modifiers, ref timestamp); + var eventType = device is TouchDevice ? RawPointerEventType.TouchCancel : RawPointerEventType.LeaveWindow; + e = CreatePointerArgs(device, timestamp, eventType, point, modifiers, info.pointerId); break; } case WindowsMessage.WM_POINTERWHEEL: case WindowsMessage.WM_POINTERHWHEEL: { - GetDevicePointerInfo(wParam, out var device, out var info, ref timestamp); if (!_wmPointerEnabled) { break; } + GetDevicePointerInfo(wParam, out var device, out var info, out var point, out var modifiers, ref timestamp); - var point = PointToClient(new PixelPoint(info.ptPixelLocationX, info.ptPixelLocationY)); - var modifiers = GetInputModifiers(info.dwKeyStates); var val = (ToInt32(wParam) >> 16) / wheelDelta; var delta = message == WindowsMessage.WM_POINTERWHEEL ? new Vector(0, val) : new Vector(val, 0); - e = new RawMouseWheelEventArgs(device, timestamp, _owner, point, delta, modifiers); + e = new RawMouseWheelEventArgs(device, timestamp, _owner, point.Position, delta, modifiers) + { + RawPointerId = info.pointerId + }; break; } - case WindowsMessage.WM_POINTERACTIVATE: + case WindowsMessage.WM_POINTERDEVICEINRANGE: { if (!_wmPointerEnabled) { break; } + + // Do not generate events, but release mouse capture on any other device input. + GetDevicePointerInfo(wParam, out var device, out var info, out var point, out var modifiers, ref timestamp); + if (device != _mouseDevice) + { + _mouseDevice.Capture(null); + return IntPtr.Zero; + } + break; + } + case WindowsMessage.WM_POINTERACTIVATE: + { //occurs when a pointer activates an inactive window. //we should handle this and return PA_ACTIVATE or PA_NOACTIVATE //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointeractivate break; } - case WindowsMessage.WM_POINTERCAPTURECHANGED: + case WindowsMessage.WM_POINTERDEVICECHANGE: { - if (!_wmPointerEnabled) - { - break; - } - _mouseDevice.Capture(null); - _penDevice.Capture(null); - return IntPtr.Zero; + //notifies about changes in the settings of a monitor that has a digitizer attached to it. + //https://docs.microsoft.com/en-us/previous-versions/windows/desktop/inputmsg/wm-pointerdevicechange + break; + } + case WindowsMessage.WM_NCPOINTERUPDATE: + { + //NC stands for non-client area - window header and window border + //As I found above in an old message handling - we dont need to handle NC pointer move/updates. + //All we need is pointer down and up. So this is skipped for now. + break; + } + case WindowsMessage.WM_POINTERENTER: + { + //this is not handled by WM_MOUSEENTER so I think there is no need to handle this too. + //but we can detect a new pointer by this message and calling IS_POINTER_NEW_WPARAM + + //note: by using a pen there can be a pointer leave or enter inside a window coords + //when you are just lift up the pen above the display + break; } case WindowsMessage.DM_POINTERHITTEST: { @@ -839,6 +695,11 @@ namespace Avalonia.Win32 _ignoreWmChar = e.Handled; } + if (s_intermediatePointsPooledList.Count > 0) + { + s_intermediatePointsPooledList.Dispose(); + } + if (e.Handled) { return IntPtr.Zero; @@ -851,40 +712,110 @@ namespace Avalonia.Win32 } } - private unsafe void ApplyPenInfo(POINTER_PEN_INFO penInfo) + private unsafe Lazy> CreateLazyIntermediatePoints(POINTER_INFO info) { - _penDevice.IsBarrel = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL); - _penDevice.IsEraser = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_ERASER); - _penDevice.IsInverted = penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_INVERTED); - - _penDevice.XTilt = penInfo.tiltX; - _penDevice.YTilt = penInfo.tiltY; - _penDevice.Pressure = penInfo.pressure; - _penDevice.Twist = penInfo.rotation; + // Limit history size with reasonable value. + // With sizeof(POINTER_TOUCH_INFO) * 100 we can get maximum 14400 bytes. + var historyCount = Math.Min((int)info.historyCount, MaxPointerHistorySize); + if (historyCount > 1) + { + return new Lazy>(() => + { + s_intermediatePointsPooledList.Clear(); + s_intermediatePointsPooledList.Capacity = historyCount; + if (info.pointerType == PointerInputType.PT_TOUCH) + { + if (GetPointerTouchInfoHistory(info.pointerId, ref historyCount, s_historyTouchInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyTouchInfo = s_historyTouchInfos[i]; + s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyTouchInfo)); + } + } + } + else if (info.pointerType == PointerInputType.PT_PEN) + { + if (GetPointerPenInfoHistory(info.pointerId, ref historyCount, s_historyPenInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyPenInfo = s_historyPenInfos[i]; + s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyPenInfo)); + } + } + } + else + { + // Currently Windows does not return history info for mouse input, but we handle it just for case. + if (GetPointerInfoHistory(info.pointerId, ref historyCount, s_historyInfos)) + { + //last info is the same as the current so skip it + for (int i = 0; i < historyCount - 1; i++) + { + var historyInfo = s_historyInfos[i]; + s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyInfo)); + } + } + } + return s_intermediatePointsPooledList; + }); + } + + return null; + } + + private RawPointerEventArgs CreatePointerArgs(IInputDevice device, ulong timestamp, RawPointerEventType eventType, RawPointerPoint point, RawInputModifiers modifiers, uint rawPointerId) + { + return device is TouchDevice + ? new RawTouchEventArgs(device, timestamp, _owner, eventType, point, modifiers, rawPointerId) + : new RawPointerEventArgs(device, timestamp, _owner, eventType, point, modifiers) + { + RawPointerId = rawPointerId + }; } - private void GetDevicePointerInfo(IntPtr wParam, out IInputDevice device, out POINTER_INFO info, ref uint timestamp) + private void GetDevicePointerInfo(IntPtr wParam, + out IPointerDevice device, out POINTER_INFO info, out RawPointerPoint point, + out RawInputModifiers modifiers, ref uint timestamp) { var pointerId = (uint)(ToInt32(wParam) & 0xFFFF); GetPointerType(pointerId, out var type); - //GetPointerCursorId(pointerId, out var cursorId); + + modifiers = default; + switch (type) { case PointerInputType.PT_PEN: device = _penDevice; GetPointerPenInfo(pointerId, out var penInfo); info = penInfo.pointerInfo; - - ApplyPenInfo(penInfo); + point = CreateRawPointerPoint(penInfo); + if (penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_BARREL)) + { + modifiers |= RawInputModifiers.PenBarrelButton; + } + if (penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_ERASER)) + { + modifiers |= RawInputModifiers.PenEraser; + } + if (penInfo.penFlags.HasFlag(PenFlags.PEN_FLAGS_INVERTED)) + { + modifiers |= RawInputModifiers.PenInverted; + } break; case PointerInputType.PT_TOUCH: device = _touchDevice; GetPointerTouchInfo(pointerId, out var touchInfo); info = touchInfo.pointerInfo; + point = CreateRawPointerPoint(touchInfo); break; default: device = _mouseDevice; GetPointerInfo(pointerId, out info); + point = CreateRawPointerPoint(info); break; } @@ -892,6 +823,44 @@ namespace Avalonia.Win32 { timestamp = info.dwTime; } + + modifiers |= GetInputModifiers(info.dwKeyStates); + } + + private RawPointerPoint CreateRawPointerPoint(POINTER_INFO pointerInfo) + { + var point = PointToClient(new PixelPoint(pointerInfo.ptPixelLocationX, pointerInfo.ptPixelLocationY)); + return new RawPointerPoint + { + Position = point + }; + } + private RawPointerPoint CreateRawPointerPoint(POINTER_TOUCH_INFO info) + { + var pointerInfo = info.pointerInfo; + var point = PointToClient(new PixelPoint(pointerInfo.ptPixelLocationX, pointerInfo.ptPixelLocationY)); + return new RawPointerPoint + { + Position = point, + // POINTER_PEN_INFO.pressure is normalized to a range between 0 and 1024, with 512 as a default. + // But in our API we use range from 0.0 to 1.0. + Pressure = info.pressure / 1024f + }; + } + private RawPointerPoint CreateRawPointerPoint(POINTER_PEN_INFO info) + { + var pointerInfo = info.pointerInfo; + var point = PointToClient(new PixelPoint(pointerInfo.ptPixelLocationX, pointerInfo.ptPixelLocationY)); + return new RawPointerPoint + { + Position = point, + // POINTER_PEN_INFO.pressure is normalized to a range between 0 and 1024, with 512 as a default. + // But in our API we use range from 0.0 to 1.0. + Pressure = info.pressure / 1024f, + Twist = info.rotation, + XTilt = info.tiltX, + YTilt = info.tiltX + }; } private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) @@ -904,8 +873,6 @@ namespace Avalonia.Win32 } switch (info.pointerType) { - case PointerInputType.PT_PEN: - return ToEventType(info.ButtonChangeType); case PointerInputType.PT_TOUCH: if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED)) { diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 64295f8925..e0f6348c23 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -21,6 +21,7 @@ using Avalonia.Win32.OpenGl; using Avalonia.Win32.WinRT; using Avalonia.Win32.WinRT.Composition; using static Avalonia.Win32.Interop.UnmanagedMethods; +using Avalonia.Collections.Pooled; namespace Avalonia.Win32 { @@ -95,6 +96,12 @@ namespace Avalonia.Win32 private uint _langid; private bool _ignoreWmChar; + private const int MaxPointerHistorySize = 512; + private readonly static PooledList s_intermediatePointsPooledList = new(); + private readonly static POINTER_TOUCH_INFO[] s_historyTouchInfos = new POINTER_TOUCH_INFO[MaxPointerHistorySize]; + private readonly static POINTER_PEN_INFO[] s_historyPenInfos = new POINTER_PEN_INFO[MaxPointerHistorySize]; + private readonly static POINTER_INFO[] s_historyInfos = new POINTER_INFO[MaxPointerHistorySize]; + public WindowImpl() { _touchDevice = new TouchDevice(); From 99e444f5f19a9312ac4eb99076084b18b92040e3 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Apr 2022 04:01:07 -0400 Subject: [PATCH 025/393] Update documentation of pointer types --- src/Avalonia.Input/IPointer.cs | 40 +++++++++++- src/Avalonia.Input/PointerEventArgs.cs | 19 +++++- src/Avalonia.Input/PointerPoint.cs | 86 ++++++++++++++++++++++++-- 3 files changed, 138 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Input/IPointer.cs b/src/Avalonia.Input/IPointer.cs index 361f3ac370..98f7c81f02 100644 --- a/src/Avalonia.Input/IPointer.cs +++ b/src/Avalonia.Input/IPointer.cs @@ -1,15 +1,53 @@ namespace Avalonia.Input { + /// + /// Identifies specific pointer generated by input device. + /// + /// + /// Some devices, for instance, touchscreen might generate a pointer on each physical contact. + /// public interface IPointer { + /// + /// Gets a unique identifier for the input pointer. + /// int Id { get; } + + /// + /// Captures pointer input to the specified control. + /// + /// The control. + /// + /// When an element captures the pointer, it receives pointer input whether the cursor is + /// within the control's bounds or not. The current pointer capture control is exposed + /// by the property. + /// void Capture(IInputElement? control); + + /// + /// Gets the control that is currently capturing by the pointer, if any. + /// + /// + /// When an element captures the pointer, it receives pointer input whether the cursor is + /// within the control's bounds or not. To set the pointer capture, call the + /// method. + /// IInputElement? Captured { get; } + + /// + /// Gets the pointer device type. + /// PointerType Type { get; } + + /// + /// Gets a value that indicates whether the input is from the primary pointer when multiple pointers are registered. + /// bool IsPrimary { get; } - } + /// + /// Enumerates pointer device types. + /// public enum PointerType { Mouse, diff --git a/src/Avalonia.Input/PointerEventArgs.cs b/src/Avalonia.Input/PointerEventArgs.cs index 79335eb9fc..058c2f9cc1 100644 --- a/src/Avalonia.Input/PointerEventArgs.cs +++ b/src/Avalonia.Input/PointerEventArgs.cs @@ -67,7 +67,14 @@ namespace Avalonia.Input public IPointer? TryGetPointer(RawPointerEventArgs ev) => _ev.Pointer; } + /// + /// Gets specific pointer generated by input device. + /// public IPointer Pointer { get; } + + /// + /// Gets the time when the input occurred. + /// public ulong Timestamp { get; } private IPointerDevice? _device; @@ -91,7 +98,10 @@ namespace Avalonia.Input return mods; } } - + + /// + /// Gets a value that indicates which key modifiers were active at the time that the pointer event was initiated. + /// public KeyModifiers KeyModifiers { get; } private Point GetPosition(Point pt, IVisual? relativeTo) @@ -102,7 +112,12 @@ namespace Avalonia.Input return pt; return pt * _rootVisual.TransformToVisual(relativeTo) ?? default; } - + + /// + /// Gets the pointer position relative to a control. + /// + /// The control. + /// The pointer position in the control's coordinates. public Point GetPosition(IVisual? relativeTo) => GetPosition(_rootVisualPosition, relativeTo); [Obsolete("Use GetCurrentPoint")] diff --git a/src/Avalonia.Input/PointerPoint.cs b/src/Avalonia.Input/PointerPoint.cs index c704aa28c6..71145b5cb0 100644 --- a/src/Avalonia.Input/PointerPoint.cs +++ b/src/Avalonia.Input/PointerPoint.cs @@ -2,6 +2,9 @@ using Avalonia.Input.Raw; namespace Avalonia.Input { + /// + /// Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact. + /// public sealed class PointerPoint { public PointerPoint(IPointer pointer, Point position, PointerPointProperties properties) @@ -10,34 +13,109 @@ namespace Avalonia.Input Position = position; Properties = properties; } + + /// + /// Gets specific pointer generated by input device. + /// public IPointer Pointer { get; } + + /// + /// Gets extended information about the input pointer. + /// public PointerPointProperties Properties { get; } + + /// + /// Gets the location of the pointer input in client coordinates. + /// public Point Position { get; } } + /// + /// Provides extended properties for a PointerPoint object. + /// public sealed class PointerPointProperties { + /// + /// Gets a value that indicates whether the pointer input was triggered by the primary action mode of an input device. + /// public bool IsLeftButtonPressed { get; } + + /// + /// Gets a value that indicates whether the pointer input was triggered by the tertiary action mode of an input device. + /// public bool IsMiddleButtonPressed { get; } + + /// + /// Gets a value that indicates whether the pointer input was triggered by the secondary action mode (if supported) of an input device. + /// public bool IsRightButtonPressed { get; } + + /// + /// Gets a value that indicates whether the pointer input was triggered by the first extended mouse button (XButton1). + /// public bool IsXButton1Pressed { get; } + + /// + /// Gets a value that indicates whether the pointer input was triggered by the second extended mouse button (XButton2). + /// public bool IsXButton2Pressed { get; } + + /// + /// Gets a value that indicates whether the barrel button of the pen/stylus device is pressed. + /// public bool IsBarrelButtonPressed { get; } + + /// + /// Gets a value that indicates whether the input is from a pen eraser. + /// public bool IsEraser { get; } + + /// + /// Gets a value that indicates whether the digitizer pen is inverted. + /// public bool IsInverted { get; } + /// + /// Gets the clockwise rotation in degrees of a pen device around its own major axis (such as when the user spins the pen in their fingers). + /// + /// + /// A value between 0.0 and 359.0 in degrees of rotation. The default value is 0.0. + /// public float Twist { get; } - public float Pressure { get; } + + /// + /// Gets a value that indicates the force that the pointer device (typically a pen/stylus) exerts on the surface of the digitizer. + /// + /// + /// A value from 0 to 1.0. The default value is 0.5. + /// + public float Pressure { get; } = 0.5f; + + /// + /// Gets the plane angle between the Y-Z plane and the plane that contains the Y axis and the axis of the input device (typically a pen/stylus). + /// + /// + /// The value is 0.0 when the finger or pen is perpendicular to the digitizer surface, between 0.0 and 90.0 when tilted to the right of perpendicular, and between 0.0 and -90.0 when tilted to the left of perpendicular. The default value is 0.0. + /// public float XTilt { get; } - public float YTilt { get; } + /// + /// Gets the plane angle between the X-Z plane and the plane that contains the X axis and the axis of the input device (typically a pen/stylus). + /// + /// + /// The value is 0.0 when the finger or pen is perpendicular to the digitizer surface, between 0.0 and 90.0 when tilted towards the user, and between 0.0 and -90.0 when tilted away from the user. The default value is 0.0. + /// + public float YTilt { get; } + /// + /// Gets the kind of pointer state change. + /// public PointerUpdateKind PointerUpdateKind { get; } private PointerPointProperties() - { + { } - + public PointerPointProperties(RawInputModifiers modifiers, PointerUpdateKind kind) { PointerUpdateKind = kind; From bd2578d68359abcc44eb83118b907f74abaf3ae2 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Apr 2022 04:31:57 -0400 Subject: [PATCH 026/393] Update control catalog pointers page --- samples/ControlCatalog.NetCore/Program.cs | 2 +- samples/ControlCatalog/MainView.xaml | 2 +- samples/ControlCatalog/Pages/PointerCanvas.cs | 221 ++++++++++ .../Pages/PointerContactsTab.cs | 109 +++++ samples/ControlCatalog/Pages/PointersPage.cs | 394 ------------------ .../ControlCatalog/Pages/PointersPage.xaml | 65 +++ .../ControlCatalog/Pages/PointersPage.xaml.cs | 76 ++++ 7 files changed, 473 insertions(+), 396 deletions(-) create mode 100644 samples/ControlCatalog/Pages/PointerCanvas.cs create mode 100644 samples/ControlCatalog/Pages/PointerContactsTab.cs delete mode 100644 samples/ControlCatalog/Pages/PointersPage.cs create mode 100644 samples/ControlCatalog/Pages/PointersPage.xaml create mode 100644 samples/ControlCatalog/Pages/PointersPage.xaml.cs diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 4b81935452..08ac17d0c4 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -114,7 +114,7 @@ namespace ControlCatalog.NetCore }) .With(new Win32PlatformOptions { - EnableMultitouch = true + EnableWmPointerEvents = true }) .UseSkia() .UseManagedSystemDialogs() diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 85f278b5fa..c61ba231e0 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -106,7 +106,7 @@ - + diff --git a/samples/ControlCatalog/Pages/PointerCanvas.cs b/samples/ControlCatalog/Pages/PointerCanvas.cs new file mode 100644 index 0000000000..b815a573f2 --- /dev/null +++ b/samples/ControlCatalog/Pages/PointerCanvas.cs @@ -0,0 +1,221 @@ +#nullable enable +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; + +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using Avalonia.Threading; + +namespace ControlCatalog.Pages; + +public class PointerCanvas : Control +{ + private readonly Stopwatch _stopwatch = Stopwatch.StartNew(); + private int _events; + private IDisposable? _statusUpdated; + private Dictionary _pointers = new(); + private PointerPointProperties? _lastProperties; + class PointerPoints + { + struct CanvasPoint + { + public IBrush Brush; + public Point Point; + public double Radius; + public double? Pressure; + } + + readonly CanvasPoint[] _points = new CanvasPoint[1000]; + int _index; + + public void Render(DrawingContext context, bool drawPoints) + { + CanvasPoint? prev = null; + for (var c = 0; c < _points.Length; c++) + { + var i = (c + _index) % _points.Length; + var pt = _points[i]; + var pressure = (pt.Pressure ?? prev?.Pressure ?? 0.5); + var thickness = pressure * 10; + var radius = pressure * pt.Radius; + + if (drawPoints) + { + if (pt.Brush != null) + { + context.DrawEllipse(pt.Brush, null, pt.Point, radius, radius); + } + } + else + { + if (prev.HasValue && prev.Value.Brush != null && pt.Brush != null + && prev.Value.Pressure != null && pt.Pressure != null) + { + var linePen = new Pen(Brushes.Black, thickness, null, PenLineCap.Round, PenLineJoin.Round); + context.DrawLine(linePen, prev.Value.Point, pt.Point); + } + } + prev = pt; + } + + } + + void AddPoint(Point pt, IBrush brush, double radius, float? pressure = null) + { + _points[_index] = new CanvasPoint { Point = pt, Brush = brush, Radius = radius, Pressure = pressure }; + _index = (_index + 1) % _points.Length; + } + + public void HandleEvent(PointerEventArgs e, Visual v) + { + e.Handled = true; + var currentPoint = e.GetCurrentPoint(v); + if (e.RoutedEvent == PointerPressedEvent) + AddPoint(currentPoint.Position, Brushes.Green, 10); + else if (e.RoutedEvent == PointerReleasedEvent) + AddPoint(currentPoint.Position, Brushes.Red, 10); + else + { + var pts = e.GetIntermediatePoints(v); + for (var c = 0; c < pts.Count; c++) + { + var pt = pts[c]; + AddPoint(pt.Position, c == pts.Count - 1 ? Brushes.Blue : Brushes.Black, + c == pts.Count - 1 ? 5 : 2, pt.Properties.Pressure); + } + } + } + } + + private int _threadSleep; + public static DirectProperty ThreadSleepProperty = + AvaloniaProperty.RegisterDirect(nameof(ThreadSleep), c => c.ThreadSleep, (c, v) => c.ThreadSleep = v); + + public int ThreadSleep + { + get => _threadSleep; + set => SetAndRaise(ThreadSleepProperty, ref _threadSleep, value); + } + + private bool _drawOnlyPoints; + public static DirectProperty DrawOnlyPointsProperty = + AvaloniaProperty.RegisterDirect(nameof(DrawOnlyPoints), c => c.DrawOnlyPoints, (c, v) => c.DrawOnlyPoints = v); + + public bool DrawOnlyPoints + { + get => _drawOnlyPoints; + set => SetAndRaise(DrawOnlyPointsProperty, ref _drawOnlyPoints, value); + } + + private string? _status; + public static DirectProperty StatusProperty = + AvaloniaProperty.RegisterDirect(nameof(DrawOnlyPoints), c => c.Status, (c, v) => c.Status = v, + defaultBindingMode: Avalonia.Data.BindingMode.TwoWay); + + public string? Status + { + get => _status; + set => SetAndRaise(StatusProperty, ref _status, value); + } + + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + + _statusUpdated = DispatcherTimer.Run(() => + { + if (_stopwatch.Elapsed.TotalSeconds > 1) + { + Status = $@"Events per second: {(_events / _stopwatch.Elapsed.TotalSeconds)} +PointerUpdateKind: {_lastProperties?.PointerUpdateKind} +IsLeftButtonPressed: {_lastProperties?.IsLeftButtonPressed} +IsRightButtonPressed: {_lastProperties?.IsRightButtonPressed} +IsMiddleButtonPressed: {_lastProperties?.IsMiddleButtonPressed} +IsXButton1Pressed: {_lastProperties?.IsXButton1Pressed} +IsXButton2Pressed: {_lastProperties?.IsXButton2Pressed} +IsBarrelButtonPressed: {_lastProperties?.IsBarrelButtonPressed} +IsEraser: {_lastProperties?.IsEraser} +IsInverted: {_lastProperties?.IsInverted} +Pressure: {_lastProperties?.Pressure} +XTilt: {_lastProperties?.XTilt} +YTilt: {_lastProperties?.YTilt} +Twist: {_lastProperties?.Twist}"; + _stopwatch.Restart(); + _events = 0; + } + + return true; + }, TimeSpan.FromMilliseconds(10)); + } + + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnDetachedFromVisualTree(e); + + _statusUpdated?.Dispose(); + } + + void HandleEvent(PointerEventArgs e) + { + _events++; + if (_threadSleep != 0) + { + Thread.Sleep(_threadSleep); + } + InvalidateVisual(); + + if (e.RoutedEvent == PointerReleasedEvent && e.Pointer.Type == PointerType.Touch) + { + _pointers.Remove(e.Pointer.Id); + return; + } + + var lastPointer = e.GetCurrentPoint(this); + _lastProperties = lastPointer.Properties; + + if (e.Pointer.Type != PointerType.Pen + || lastPointer.Properties.Pressure > 0) + { + if (!_pointers.TryGetValue(e.Pointer.Id, out var pt)) + _pointers[e.Pointer.Id] = pt = new PointerPoints(); + pt.HandleEvent(e, this); + } + } + + public override void Render(DrawingContext context) + { + context.FillRectangle(Brushes.White, Bounds); + foreach (var pt in _pointers.Values) + pt.Render(context, _drawOnlyPoints); + base.Render(context); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + if (e.ClickCount == 2) + { + _pointers.Clear(); + InvalidateVisual(); + return; + } + + HandleEvent(e); + base.OnPointerPressed(e); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + HandleEvent(e); + base.OnPointerMoved(e); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + HandleEvent(e); + base.OnPointerReleased(e); + } +} diff --git a/samples/ControlCatalog/Pages/PointerContactsTab.cs b/samples/ControlCatalog/Pages/PointerContactsTab.cs new file mode 100644 index 0000000000..b6aabebf99 --- /dev/null +++ b/samples/ControlCatalog/Pages/PointerContactsTab.cs @@ -0,0 +1,109 @@ +#nullable enable +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Linq; + +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Media; +using Avalonia.Media.Immutable; + +namespace ControlCatalog.Pages; + +public class PointerContactsTab : Control +{ + class PointerInfo + { + public Point Point { get; set; } + public Color Color { get; set; } + } + + private static Color[] AllColors = new[] + { + Colors.Aqua, + Colors.Beige, + Colors.Chartreuse, + Colors.Coral, + Colors.Fuchsia, + Colors.Crimson, + Colors.Lavender, + Colors.Orange, + Colors.Orchid, + Colors.ForestGreen, + Colors.SteelBlue, + Colors.PapayaWhip, + Colors.PaleVioletRed, + Colors.Goldenrod, + Colors.Maroon, + Colors.Moccasin, + Colors.Navy, + Colors.Wheat, + Colors.Violet, + Colors.Sienna, + Colors.Indigo, + Colors.Honeydew + }; + + private Dictionary _pointers = new Dictionary(); + + public PointerContactsTab() + { + ClipToBounds = true; + } + + void UpdatePointer(PointerEventArgs e) + { + if (!_pointers.TryGetValue(e.Pointer, out var info)) + { + if (e.RoutedEvent == PointerMovedEvent) + return; + var colors = AllColors.Except(_pointers.Values.Select(c => c.Color)).ToArray(); + var color = colors[new Random().Next(0, colors.Length - 1)]; + _pointers[e.Pointer] = info = new PointerInfo { Color = color }; + } + + info.Point = e.GetPosition(this); + InvalidateVisual(); + } + + protected override void OnPointerPressed(PointerPressedEventArgs e) + { + UpdatePointer(e); + e.Pointer.Capture(this); + e.Handled = true; + base.OnPointerPressed(e); + } + + protected override void OnPointerMoved(PointerEventArgs e) + { + UpdatePointer(e); + e.Handled = true; + base.OnPointerMoved(e); + } + + protected override void OnPointerReleased(PointerReleasedEventArgs e) + { + _pointers.Remove(e.Pointer); + e.Handled = true; + InvalidateVisual(); + } + + protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) + { + _pointers.Remove(e.Pointer); + InvalidateVisual(); + } + + public override void Render(DrawingContext context) + { + context.FillRectangle(Brushes.Transparent, new Rect(default, Bounds.Size)); + foreach (var pt in _pointers.Values) + { + var brush = new ImmutableSolidColorBrush(pt.Color); + + context.DrawEllipse(brush, null, pt.Point, 75, 75); + } + } +} diff --git a/samples/ControlCatalog/Pages/PointersPage.cs b/samples/ControlCatalog/Pages/PointersPage.cs deleted file mode 100644 index 0668c248c7..0000000000 --- a/samples/ControlCatalog/Pages/PointersPage.cs +++ /dev/null @@ -1,394 +0,0 @@ -#nullable enable -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reactive.Linq; -using System.Runtime.InteropServices; -using System.Threading; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.Documents; -using Avalonia.Input; -using Avalonia.Layout; -using Avalonia.Media; -using Avalonia.Media.Immutable; -using Avalonia.Threading; -using Avalonia.VisualTree; - -namespace ControlCatalog.Pages; - -public class PointersPage : Decorator -{ - public PointersPage() - { - Child = new TabControl - { - Items = new[] - { - new TabItem() { Header = "Contacts", Content = new PointerContactsTab() }, - new TabItem() { Header = "IntermediatePoints", Content = new PointerIntermediatePointsTab() }, - new TabItem() { Header = "Pressure", Content = new PointerPressureTab() } - } - }; - } - - - class PointerContactsTab : Control - { - class PointerInfo - { - public Point Point { get; set; } - public Color Color { get; set; } - } - - private static Color[] AllColors = new[] - { - Colors.Aqua, - Colors.Beige, - Colors.Chartreuse, - Colors.Coral, - Colors.Fuchsia, - Colors.Crimson, - Colors.Lavender, - Colors.Orange, - Colors.Orchid, - Colors.ForestGreen, - Colors.SteelBlue, - Colors.PapayaWhip, - Colors.PaleVioletRed, - Colors.Goldenrod, - Colors.Maroon, - Colors.Moccasin, - Colors.Navy, - Colors.Wheat, - Colors.Violet, - Colors.Sienna, - Colors.Indigo, - Colors.Honeydew - }; - - private Dictionary _pointers = new Dictionary(); - - public PointerContactsTab() - { - ClipToBounds = true; - } - - void UpdatePointer(PointerEventArgs e) - { - if (!_pointers.TryGetValue(e.Pointer, out var info)) - { - if (e.RoutedEvent == PointerMovedEvent) - return; - var colors = AllColors.Except(_pointers.Values.Select(c => c.Color)).ToArray(); - var color = colors[new Random().Next(0, colors.Length - 1)]; - _pointers[e.Pointer] = info = new PointerInfo {Color = color}; - } - - info.Point = e.GetPosition(this); - InvalidateVisual(); - } - - protected override void OnPointerPressed(PointerPressedEventArgs e) - { - UpdatePointer(e); - e.Pointer.Capture(this); - e.Handled = true; - base.OnPointerPressed(e); - } - - protected override void OnPointerMoved(PointerEventArgs e) - { - UpdatePointer(e); - e.Handled = true; - base.OnPointerMoved(e); - } - - protected override void OnPointerReleased(PointerReleasedEventArgs e) - { - _pointers.Remove(e.Pointer); - e.Handled = true; - InvalidateVisual(); - } - - protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) - { - _pointers.Remove(e.Pointer); - InvalidateVisual(); - } - - public override void Render(DrawingContext context) - { - context.FillRectangle(Brushes.Transparent, new Rect(default, Bounds.Size)); - foreach (var pt in _pointers.Values) - { - var brush = new ImmutableSolidColorBrush(pt.Color); - - context.DrawEllipse(brush, null, pt.Point, 75, 75); - } - } - } - - public class PointerIntermediatePointsTab : Decorator - { - public PointerIntermediatePointsTab() - { - this[TextElement.ForegroundProperty] = Brushes.Black; - var slider = new Slider - { - Margin = new Thickness(5), - Minimum = 0, - Maximum = 500 - }; - - var status = new TextBlock() - { - HorizontalAlignment = HorizontalAlignment.Left, - VerticalAlignment = VerticalAlignment.Top, - }; - Child = new Grid - { - Children = - { - new PointerCanvas(slider, status, true), - new Border - { - Background = Brushes.LightYellow, - Child = new StackPanel - { - Children = - { - new StackPanel - { - Orientation = Orientation.Horizontal, - Children = - { - new TextBlock { Text = "Thread sleep:" }, - new TextBlock() - { - [!TextBlock.TextProperty] =slider.GetObservable(Slider.ValueProperty) - .Select(x=>x.ToString()).ToBinding() - } - } - }, - slider - } - }, - - HorizontalAlignment = HorizontalAlignment.Right, - VerticalAlignment = VerticalAlignment.Top, - Width = 300, - Height = 60 - }, - status - } - }; - } - } - - public class PointerPressureTab : Decorator - { - public PointerPressureTab() - { - this[TextBlock.ForegroundProperty] = Brushes.Black; - - var status = new TextBlock() - { - HorizontalAlignment = HorizontalAlignment.Left, - VerticalAlignment = VerticalAlignment.Top, - FontSize = 12 - }; - Child = new Grid - { - Children = - { - new PointerCanvas(null, status, false), - status - } - }; - } - } - - class PointerCanvas : Control - { - private readonly Slider? _slider; - private readonly TextBlock _status; - private readonly bool _drawPoints; - private int _events; - private Stopwatch _stopwatch = Stopwatch.StartNew(); - private IDisposable? _statusUpdated; - private Dictionary _pointers = new(); - private PointerPointProperties? _lastProperties; - class PointerPoints - { - struct CanvasPoint - { - public IBrush Brush; - public Point Point; - public double Radius; - public double Pressure; - } - - readonly CanvasPoint[] _points = new CanvasPoint[1000]; - int _index; - - public void Render(DrawingContext context, bool drawPoints) - { - - CanvasPoint? prev = null; - for (var c = 0; c < _points.Length; c++) - { - var i = (c + _index) % _points.Length; - var pt = _points[i]; - var thickness = pt.Pressure == 0 ? 1 : (pt.Pressure / 1024) * 5; - - if (drawPoints) - { - if (prev.HasValue && prev.Value.Brush != null && pt.Brush != null) - context.DrawLine(new Pen(Brushes.Black, thickness), prev.Value.Point, pt.Point); - if (pt.Brush != null) - context.DrawEllipse(pt.Brush, null, pt.Point, pt.Radius, pt.Radius); - } - else - { - if (prev.HasValue && prev.Value.Brush != null && pt.Brush != null) - context.DrawLine(new Pen(Brushes.Black, thickness, lineCap: PenLineCap.Round, lineJoin: PenLineJoin.Round), prev.Value.Point, pt.Point); - } - prev = pt; - } - - } - - void AddPoint(Point pt, IBrush brush, double radius, float pressure) - { - _points[_index] = new CanvasPoint { Point = pt, Brush = brush, Radius = radius, Pressure = pressure }; - _index = (_index + 1) % _points.Length; - } - - public void HandleEvent(PointerEventArgs e, Visual v) - { - e.Handled = true; - var currentPoint = e.GetCurrentPoint(v); - if (e.RoutedEvent == PointerPressedEvent) - AddPoint(currentPoint.Position, Brushes.Green, 10, currentPoint.Properties.Pressure); - else if (e.RoutedEvent == PointerReleasedEvent) - AddPoint(currentPoint.Position, Brushes.Red, 10, currentPoint.Properties.Pressure); - else - { - var pts = e.GetIntermediatePoints(v); - for (var c = 0; c < pts.Count; c++) - { - var pt = pts[c]; - AddPoint(pt.Position, c == pts.Count - 1 ? Brushes.Blue : Brushes.Black, - c == pts.Count - 1 ? 5 : 2, pt.Properties.Pressure); - } - } - } - } - - public PointerCanvas(Slider? slider, TextBlock status, bool drawPoints) - { - _slider = slider; - _status = status; - _drawPoints = drawPoints; - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - _statusUpdated = DispatcherTimer.Run(() => - { - if (_stopwatch.Elapsed.TotalSeconds > 1) - { - _status.Text = $@"Events per second: {(_events / _stopwatch.Elapsed.TotalSeconds)} -PointerUpdateKind: {_lastProperties?.PointerUpdateKind} -IsLeftButtonPressed: {_lastProperties?.IsLeftButtonPressed} -IsRightButtonPressed: {_lastProperties?.IsRightButtonPressed} -IsMiddleButtonPressed: {_lastProperties?.IsMiddleButtonPressed} -IsXButton1Pressed: {_lastProperties?.IsXButton1Pressed} -IsXButton2Pressed: {_lastProperties?.IsXButton2Pressed} -IsBarrelButtonPressed: {_lastProperties?.IsBarrelButtonPressed} -IsEraser: {_lastProperties?.IsEraser} -IsInverted: {_lastProperties?.IsInverted} -Pressure: {_lastProperties?.Pressure} -XTilt: {_lastProperties?.XTilt} -YTilt: {_lastProperties?.YTilt} -Twist: {_lastProperties?.Twist}"; - _stopwatch.Restart(); - _events = 0; - } - - return true; - }, TimeSpan.FromMilliseconds(10)); - } - - protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnDetachedFromVisualTree(e); - - _statusUpdated?.Dispose(); - } - - void HandleEvent(PointerEventArgs e) - { - _events++; - if (_slider != null) - { - Thread.Sleep((int)_slider.Value); - } - InvalidateVisual(); - - if (e.RoutedEvent == PointerReleasedEvent && e.Pointer.Type == PointerType.Touch) - { - _pointers.Remove(e.Pointer.Id); - return; - } - - var lastPointer = e.GetCurrentPoint(this); - _lastProperties = lastPointer.Properties; - - if (e.Pointer.Type != PointerType.Pen - || lastPointer.Properties.Pressure > 0) - { - if (!_pointers.TryGetValue(e.Pointer.Id, out var pt)) - _pointers[e.Pointer.Id] = pt = new PointerPoints(); - pt.HandleEvent(e, this); - } - } - - public override void Render(DrawingContext context) - { - context.FillRectangle(Brushes.White, Bounds); - foreach (var pt in _pointers.Values) - pt.Render(context, _drawPoints); - base.Render(context); - } - - protected override void OnPointerPressed(PointerPressedEventArgs e) - { - if (e.ClickCount == 2) - { - _pointers.Clear(); - InvalidateVisual(); - return; - } - - HandleEvent(e); - base.OnPointerPressed(e); - } - - protected override void OnPointerMoved(PointerEventArgs e) - { - HandleEvent(e); - base.OnPointerMoved(e); - } - - protected override void OnPointerReleased(PointerReleasedEventArgs e) - { - HandleEvent(e); - base.OnPointerReleased(e); - } - } -} diff --git a/samples/ControlCatalog/Pages/PointersPage.xaml b/samples/ControlCatalog/Pages/PointersPage.xaml new file mode 100644 index 0000000000..1281ec77b6 --- /dev/null +++ b/samples/ControlCatalog/Pages/PointersPage.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Capture 1 + + + Capture 2 + + + + + diff --git a/samples/ControlCatalog/Pages/PointersPage.xaml.cs b/samples/ControlCatalog/Pages/PointersPage.xaml.cs new file mode 100644 index 0000000000..977cee3d58 --- /dev/null +++ b/samples/ControlCatalog/Pages/PointersPage.xaml.cs @@ -0,0 +1,76 @@ +using System; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; + +namespace ControlCatalog.Pages; + +public class PointersPage : UserControl +{ + public PointersPage() + { + this.InitializeComponent(); + + var border1 = this.Get("BorderCapture1"); + var border2 = this.Get("BorderCapture2"); + + border1.PointerPressed += Border_PointerPressed; + border1.PointerReleased += Border_PointerReleased; + border1.PointerCaptureLost += Border_PointerCaptureLost; + border1.PointerMoved += Border_PointerUpdated; + border1.PointerEnter += Border_PointerUpdated; + border1.PointerLeave += Border_PointerUpdated; + + border2.PointerPressed += Border_PointerPressed; + border2.PointerReleased += Border_PointerReleased; + border2.PointerCaptureLost += Border_PointerCaptureLost; + border2.PointerMoved += Border_PointerUpdated; + border2.PointerEnter += Border_PointerUpdated; + border2.PointerLeave += Border_PointerUpdated; + } + + private void Border_PointerUpdated(object sender, PointerEventArgs e) + { + var textBlock = (TextBlock)((Border)sender).Child; + var position = e.GetPosition((Border)sender); + textBlock.Text = @$"Captured: {e.Pointer.Captured == sender} +PointerId: {e.Pointer.Id} +Position: {(int)position.X} {(int)position.Y}"; + e.Handled = true; + } + + private void Border_PointerCaptureLost(object sender, PointerCaptureLostEventArgs e) + { + var textBlock = (TextBlock)((Border)sender).Child; + textBlock.Text = @$"Captured: {e.Pointer.Captured == sender} +PointerId: {e.Pointer.Id} +Position: ??? ???"; + e.Handled = true; + } + + private void Border_PointerReleased(object sender, PointerReleasedEventArgs e) + { + if (e.Pointer.Captured == sender) + { + e.Pointer.Capture(null); + e.Handled = true; + } + else + { + throw new InvalidOperationException("How?"); + } + } + + private void Border_PointerPressed(object sender, PointerPressedEventArgs e) + { + e.Pointer.Capture((Border)sender); + e.Handled = true; + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } +} From e7b281e3fd9cb86db8fbabb2af933821b9eba809 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Apr 2022 04:32:06 -0400 Subject: [PATCH 027/393] Fix GetIntermediatePoints reverse order --- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 6619c60152..1f316a0995 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -714,8 +714,6 @@ namespace Avalonia.Win32 private unsafe Lazy> CreateLazyIntermediatePoints(POINTER_INFO info) { - // Limit history size with reasonable value. - // With sizeof(POINTER_TOUCH_INFO) * 100 we can get maximum 14400 bytes. var historyCount = Math.Min((int)info.historyCount, MaxPointerHistorySize); if (historyCount > 1) { @@ -723,12 +721,15 @@ namespace Avalonia.Win32 { s_intermediatePointsPooledList.Clear(); s_intermediatePointsPooledList.Capacity = historyCount; + + // Pointers in history are ordered from newest to oldest, so we need to reverse iteration. + // Also we skip the newest pointer, because original event arguments already contains it. + if (info.pointerType == PointerInputType.PT_TOUCH) { if (GetPointerTouchInfoHistory(info.pointerId, ref historyCount, s_historyTouchInfos)) { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) + for (int i = historyCount - 1; i >= 1; i--) { var historyTouchInfo = s_historyTouchInfos[i]; s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyTouchInfo)); @@ -739,8 +740,8 @@ namespace Avalonia.Win32 { if (GetPointerPenInfoHistory(info.pointerId, ref historyCount, s_historyPenInfos)) { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) + uint timestamp = 0; + for (int i = historyCount - 1; i >= 1; i--) { var historyPenInfo = s_historyPenInfos[i]; s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyPenInfo)); @@ -752,8 +753,7 @@ namespace Avalonia.Win32 // Currently Windows does not return history info for mouse input, but we handle it just for case. if (GetPointerInfoHistory(info.pointerId, ref historyCount, s_historyInfos)) { - //last info is the same as the current so skip it - for (int i = 0; i < historyCount - 1; i++) + for (int i = historyCount - 1; i >= 1; i--) { var historyInfo = s_historyInfos[i]; s_intermediatePointsPooledList.Add(CreateRawPointerPoint(historyInfo)); From a08ccd91cba6efec6367ebc9e7d1d3cce226ae6b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 17 Apr 2022 03:44:22 -0400 Subject: [PATCH 028/393] Fix DataGrid scrolling --- src/Avalonia.Controls.DataGrid/DataGridCell.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/DataGridCell.cs b/src/Avalonia.Controls.DataGrid/DataGridCell.cs index 67183781d3..ea7d91ed97 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridCell.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridCell.cs @@ -178,9 +178,9 @@ namespace Avalonia.Controls { var handled = OwningGrid.UpdateStateOnMouseLeftButtonDown(e, ColumnIndex, OwningRow.Slot, !e.Handled); - // Do not handle PointerPressed with touch, + // Do not handle PointerPressed with touch or pen, // so we can start scroll gesture on the same event. - if (e.Pointer.Type != PointerType.Touch) + if (e.Pointer.Type != PointerType.Touch && e.Pointer.Type != PointerType.Pen) { e.Handled = handled; } From b094699f760b1f760174d841fd3a5fddfb7e663d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 9 May 2022 19:36:06 +0300 Subject: [PATCH 029/393] Compositor works with X11. Somewhat --- samples/ControlCatalog.NetCore/Program.cs | 1 + src/Avalonia.Base/Avalonia.Base.csproj | 5 +- .../Collections/IAvaloniaReadOnlyList.cs | 1 + .../Collections/Pooled/PooledList.cs | 2 +- src/Avalonia.Base/Matrix.cs | 39 + .../Animations/AnimatedValueStore.cs | 40 + .../Animations/CompositionAnimation.cs | 63 ++ .../Animations/CompositionAnimationGroup.cs | 26 + .../Animations/ExpressionAnimation.cs | 34 + .../Animations/ExpressionAnimationInstance.cs | 44 ++ .../Animations/IAnimationInstance.cs | 11 + .../Animations/ICompositionAnimationBase.cs | 12 + .../Animations/ImplicitAnimationCollection.cs | 73 ++ .../Composition/Animations/Interpolators.cs | 73 ++ .../Animations/KeyFrameAnimation.cs | 53 ++ .../Animations/KeyFrameAnimationInstance.cs | 139 ++++ .../Composition/Animations/KeyFrames.cs | 80 ++ .../Animations/PropertySetSnapshot.cs | 46 ++ .../Composition/CompositingRenderer.cs | 194 +++++ .../Composition/CompositionDrawListVisual.cs | 44 ++ .../Composition/CompositionEasingFunction.cs | 97 +++ .../Composition/CompositionGradientBrush.cs | 16 + .../Composition/CompositionObject.cs | 125 +++ .../Composition/CompositionPropertySet.cs | 132 ++++ .../Composition/CompositionTarget.cs | 107 +++ .../Rendering/Composition/Compositor.cs | 143 ++++ .../Composition/CompositorRenderLoopTask.cs | 20 + .../Rendering/Composition/ContainerVisual.cs | 20 + .../Rendering/Composition/CustomDrawVisual.cs | 56 ++ .../Drawing/CompositionDrawList.cs | 81 ++ .../Drawing/CompositionDrawingContext.cs | 383 +++++++++ .../Rendering/Composition/Enums.cs | 120 +++ .../Expressions/BuiltInExpressionFfi.cs | 234 ++++++ .../Expressions/DelegateExpressionFfi.cs | 181 +++++ .../Composition/Expressions/Expression.cs | 331 ++++++++ .../ExpressionEvaluationContext.cs | 31 + .../Expressions/ExpressionParseException.cs | 14 + .../Expressions/ExpressionParser.cs | 298 +++++++ .../Expressions/ExpressionVariant.cs | 739 ++++++++++++++++++ .../Composition/Expressions/TokenParser.cs | 256 ++++++ .../Composition/ICompositionSurface.cs | 9 + .../Rendering/Composition/MatrixUtils.cs | 46 ++ .../Composition/Server/DrawingContextProxy.cs | 142 ++++ .../Composition/Server/ReadbackIndices.cs | 46 ++ .../Server/ServerCompositionBrush.cs | 7 + .../Server/ServerCompositionDrawListVisual.cs | 41 + .../Server/ServerCompositionGradientBrush.cs | 15 + .../ServerCompositionLinearGradientBrush.cs | 22 + .../Server/ServerCompositionSurface.cs | 9 + .../Server/ServerCompositionTarget.cs | 53 ++ .../Composition/Server/ServerCompositor.cs | 90 +++ .../Server/ServerContainerVisual.cs | 29 + .../Server/ServerCustomDrawVisual.cs | 31 + .../Composition/Server/ServerList.cs | 46 ++ .../Composition/Server/ServerObject.cs | 36 + .../Server/ServerSolidColorVisual.cs | 16 + .../Composition/Server/ServerSpriteVisual.cs | 20 + .../Composition/Server/ServerVisual.cs | 92 +++ .../Rendering/Composition/Transport/Batch.cs | 37 + .../Rendering/Composition/Transport/Change.cs | 82 ++ .../Composition/Transport/ChangeSet.cs | 36 + .../Composition/Transport/ChangeSetPool.cs | 42 + .../Transport/CustomDrawVisualChanges.cs | 20 + .../Transport/DrawListVisualChanges.cs | 48 ++ .../Composition/Transport/ListChange.cs | 19 + .../Composition/Transport/ListChangeSet.cs | 25 + .../Transport/ServerListProxyHelper.cs | 92 +++ .../Composition/Transport/VisualChanges.cs | 16 + .../Composition/Utils/CubicBezier.cs | 302 +++++++ .../Rendering/Composition/Utils/MathExt.cs | 23 + .../Rendering/Composition/Visual.cs | 64 ++ .../Rendering/Composition/VisualCollection.cs | 64 ++ src/Avalonia.Base/Rendering/IRenderer.cs | 6 + .../SceneGraph/DeferredDrawingContextImpl.cs | 1 + src/Avalonia.Base/Size.cs | 11 + .../Threading/DispatcherPriority.cs | 14 +- src/Avalonia.Base/Visual.cs | 25 +- src/Avalonia.Base/composition-schema.xml | 70 ++ .../HeadlessPlatformRenderInterface.cs | 2 + .../CompositionRoslynGenerator.cs | 21 + .../CompositionGenerator/Config.cs | 116 +++ .../CompositionGenerator/Extensions.cs | 90 +++ .../Generator.KeyFrameAnimation.cs | 59 ++ .../Generator.ListProxy.cs | 121 +++ .../CompositionGenerator/Generator.Utils.cs | 66 ++ .../CompositionGenerator/Generator.cs | 504 ++++++++++++ src/Avalonia.X11/X11Platform.cs | 8 +- src/Avalonia.X11/X11Window.cs | 17 +- .../Media/DrawingContextImpl.cs | 7 + 89 files changed, 7106 insertions(+), 16 deletions(-) create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/ICompositionAnimationBase.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/Interpolators.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimation.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/PropertySetSnapshot.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionGradientBrush.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionObject.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Compositor.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CompositorRenderLoopTask.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Enums.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/BuiltInExpressionFfi.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/DelegateExpressionFfi.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParseException.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/TokenParser.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/ICompositionSurface.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionBrush.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionGradientBrush.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionSurface.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerSpriteVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/Change.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Utils/CubicBezier.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Utils/MathExt.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Visual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/VisualCollection.cs create mode 100644 src/Avalonia.Base/composition-schema.xml create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Generator.Utils.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 4464413e63..2a0755b900 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -111,6 +111,7 @@ namespace ControlCatalog.NetCore EnableMultiTouch = true, UseDBusMenu = true, EnableIme = true, + UseCompositor = true }) .With(new Win32PlatformOptions { diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index 8e4755b4b7..bcebdd504c 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -3,10 +3,13 @@ net6.0;netstandard2.0 Avalonia.Base Avalonia - True + True + true + $(BaseIntermediateOutputPath)\GeneratedFiles + diff --git a/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs b/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs index a6a5953827..cefbf642be 100644 --- a/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs +++ b/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; diff --git a/src/Avalonia.Base/Collections/Pooled/PooledList.cs b/src/Avalonia.Base/Collections/Pooled/PooledList.cs index 200a52fb0d..ffda1bedca 100644 --- a/src/Avalonia.Base/Collections/Pooled/PooledList.cs +++ b/src/Avalonia.Base/Collections/Pooled/PooledList.cs @@ -1434,7 +1434,7 @@ namespace Avalonia.Collections.Pooled /// /// Returns the internal buffers to the ArrayPool. /// - public void Dispose() + public virtual void Dispose() { ReturnArray(); _size = 0; diff --git a/src/Avalonia.Base/Matrix.cs b/src/Avalonia.Base/Matrix.cs index b08a0eb98a..6f00b08d13 100644 --- a/src/Avalonia.Base/Matrix.cs +++ b/src/Avalonia.Base/Matrix.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using System.Numerics; using Avalonia.Utilities; namespace Avalonia @@ -106,6 +107,36 @@ namespace Avalonia (value1._m31 * value2.M12) + (value1._m32 * value2.M22) + value2._m32); } + public static Matrix operator +(Matrix value1, Matrix value2) + { + return new Matrix(value1.M11 + value2.M11, + value1.M12 + value2.M12, + value1.M21 + value2.M21, + value1.M22 + value2.M22, + value1.M31 + value2.M31, + value1.M32 + value2.M32); + } + + public static Matrix operator -(Matrix value1, Matrix value2) + { + return new Matrix(value1.M11 - value2.M11, + value1.M12 - value2.M12, + value1.M21 - value2.M21, + value1.M22 - value2.M22, + value1.M31 - value2.M31, + value1.M32 - value2.M32); + } + + public static Matrix operator *(Matrix value1, double value2) + { + return new Matrix(value1.M11 * value2, + value1.M12 * value2, + value1.M21 * value2, + value1.M22 * value2, + value1.M31 * value2, + value1.M32 * value2); + } + /// /// Negates the given matrix by multiplying all values by -1. /// @@ -427,6 +458,14 @@ namespace Avalonia return true; } +#if !BUILDTASK + public static implicit operator Matrix4x4(Matrix m) + { + return new Matrix4x4(new Matrix3x2((float)m._m11, (float)m._m12, (float)m._m21, (float)m._m22, + (float)m._m31, (float)m._m32)); + } +#endif + public struct Decomposed { public Vector Translate; diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs new file mode 100644 index 0000000000..180c45022f --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs @@ -0,0 +1,40 @@ +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Animations +{ + internal struct AnimatedValueStore where T : struct + { + private T _direct; + private IAnimationInstance _animation; + private T? _lastAnimated; + + public T Direct => _direct; + + public T GetAnimated(ServerCompositor compositor) + { + if (_animation == null) + return _direct; + var v = _animation.Evaluate(compositor.ServerNow, ExpressionVariant.Create(_direct)) + .CastOrDefault(); + _lastAnimated = v; + return v; + } + + private T LastAnimated => _animation != null ? _lastAnimated ?? _direct : _direct; + + public bool IsAnimation => _animation != null; + + public void SetAnimation(ChangeSet cs, IAnimationInstance animation) + { + _animation = animation; + _animation.Start(cs.Batch.CommitedAt, ExpressionVariant.Create(LastAnimated)); + } + + public static implicit operator AnimatedValueStore(T value) => new AnimatedValueStore() + { + _direct = value + }; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs new file mode 100644 index 0000000000..9375faaaae --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs @@ -0,0 +1,63 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable CheckNamespace + +using System; +using System.Collections.Generic; +using System.Numerics; +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Animations +{ + public abstract class CompositionAnimation : CompositionObject, ICompositionAnimationBase + { + private readonly CompositionPropertySet _propertySet; + internal CompositionAnimation(Compositor compositor) : base(compositor, null!) + { + _propertySet = new CompositionPropertySet(compositor); + } + + private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); + + public void ClearAllParameters() => _propertySet.ClearAll(); + + public void ClearParameter(string key) => _propertySet.Clear(key); + + void SetVariant(string key, ExpressionVariant value) => _propertySet.Set(key, value); + + public void SetColorParameter(string key, Avalonia.Media.Color value) => SetVariant(key, value); + + public void SetMatrix3x2Parameter(string key, Matrix3x2 value) => SetVariant(key, value); + + public void SetMatrix4x4Parameter(string key, Matrix4x4 value) => SetVariant(key, value); + + public void SetQuaternionParameter(string key, Quaternion value) => SetVariant(key, value); + + public void SetReferenceParameter(string key, CompositionObject compositionObject) => + _propertySet.Set(key, compositionObject); + + public void SetScalarParameter(string key, float value) => SetVariant(key, value); + + public void SetVector2Parameter(string key, Vector2 value) => SetVariant(key, value); + + public void SetVector3Parameter(string key, Vector3 value) => SetVariant(key, value); + + public void SetVector4Parameter(string key, Vector4 value) => SetVariant(key, value); + + // TODO: void SetExpressionReferenceParameter(string parameterName, IAnimationObject source) + + public string? Target { get; set; } + + internal abstract IAnimationInstance CreateInstance(ServerObject targetObject, + ExpressionVariant? finalValue); + + internal PropertySetSnapshot CreateSnapshot(bool server) + => _propertySet.Snapshot(server, 1); + + void ICompositionAnimationBase.InternalOnly() + { + + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs new file mode 100644 index 0000000000..833f7e498c --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Transport; + + +namespace Avalonia.Rendering.Composition.Animations +{ + public class CompositionAnimationGroup : CompositionObject, ICompositionAnimationBase + { + internal List Animations { get; } = new List(); + void ICompositionAnimationBase.InternalOnly() + { + + } + + public void Add(CompositionAnimation value) => Animations.Add(value); + public void Remove(CompositionAnimation value) => Animations.Remove(value); + public void RemoveAll() => Animations.Clear(); + + public CompositionAnimationGroup(Compositor compositor) : base(compositor, null!) + { + } + + private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs new file mode 100644 index 0000000000..a6f24c2e35 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs @@ -0,0 +1,34 @@ +// ReSharper disable CheckNamespace +using System; +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Animations +{ + public class ExpressionAnimation : CompositionAnimation + { + private string? _expression; + private Expression? _parsedExpression; + + internal ExpressionAnimation(Compositor compositor) : base(compositor) + { + } + + public string? Expression + { + get => _expression; + set + { + _expression = value; + _parsedExpression = null; + } + } + + private Expression ParsedExpression => _parsedExpression ??= ExpressionParser.Parse(_expression.AsSpan()); + + internal override IAnimationInstance CreateInstance( + ServerObject targetObject, ExpressionVariant? finalValue) + => new ExpressionAnimationInstance(ParsedExpression, + targetObject, finalValue, CreateSnapshot(true)); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs new file mode 100644 index 0000000000..47b947b2e9 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs @@ -0,0 +1,44 @@ +using System; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition.Animations +{ + internal class ExpressionAnimationInstance : IAnimationInstance + { + private readonly Expression _expression; + private readonly IExpressionObject _target; + private ExpressionVariant _startingValue; + private readonly ExpressionVariant? _finalValue; + private readonly PropertySetSnapshot _parameters; + + public ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue) + { + var ctx = new ExpressionEvaluationContext + { + Parameters = _parameters, + Target = _target, + ForeignFunctionInterface = BuiltInExpressionFfi.Instance, + StartingValue = _startingValue, + FinalValue = _finalValue ?? _startingValue, + CurrentValue = currentValue + }; + return _expression.Evaluate(ref ctx); + } + + public void Start(TimeSpan startedAt, ExpressionVariant startingValue) + { + _startingValue = startingValue; + } + + public ExpressionAnimationInstance(Expression expression, + IExpressionObject target, + ExpressionVariant? finalValue, + PropertySetSnapshot parameters) + { + _expression = expression; + _target = target; + _finalValue = finalValue; + _parameters = parameters; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs new file mode 100644 index 0000000000..a0b066ae0c --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs @@ -0,0 +1,11 @@ +using System; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition.Animations +{ + internal interface IAnimationInstance + { + ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue); + void Start(TimeSpan startedAt, ExpressionVariant startingValue); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ICompositionAnimationBase.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ICompositionAnimationBase.cs new file mode 100644 index 0000000000..bf40fd3ad2 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ICompositionAnimationBase.cs @@ -0,0 +1,12 @@ +// ReSharper disable CheckNamespace + +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Animations +{ + public interface ICompositionAnimationBase + { + internal void InternalOnly(); + } + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs new file mode 100644 index 0000000000..be91352527 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Animations +{ + public class ImplicitAnimationCollection : CompositionObject, IDictionary + { + private Dictionary _inner = new Dictionary(); + private IDictionary _innerface; + internal ImplicitAnimationCollection(Compositor compositor) : base(compositor, null!) + { + _innerface = _inner; + } + + private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); + + public IEnumerator> GetEnumerator() => _inner.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable) _inner).GetEnumerator(); + + void ICollection>.Add(KeyValuePair item) => _innerface.Add(item); + + public void Clear() => _inner.Clear(); + + bool ICollection>.Contains(KeyValuePair item) => _innerface.Contains(item); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => _innerface.CopyTo(array, arrayIndex); + + bool ICollection>.Remove(KeyValuePair item) => _innerface.Remove(item); + + public int Count => _inner.Count; + + bool ICollection>.IsReadOnly => _innerface.IsReadOnly; + + public void Add(string key, ICompositionAnimationBase value) => _inner.Add(key, value); + + public bool ContainsKey(string key) => _inner.ContainsKey(key); + + public bool Remove(string key) => _inner.Remove(key); + + public bool TryGetValue(string key, [MaybeNullWhen(false)] out ICompositionAnimationBase value) => + _inner.TryGetValue(key, out value); + + public ICompositionAnimationBase this[string key] + { + get => _inner[key]; + set => _inner[key] = value; + } + + ICollection IDictionary.Keys => _innerface.Keys; + + ICollection IDictionary.Values => + _innerface.Values; + + // UWP compat + public uint Size => (uint) Count; + + public IReadOnlyDictionary GetView() => + new Dictionary(this); + + public bool HasKey(string key) => ContainsKey(key); + public void Insert(string key, ICompositionAnimationBase animation) => Add(key, animation); + + public ICompositionAnimationBase? Lookup(string key) + { + _inner.TryGetValue(key, out var rv); + return rv; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/Interpolators.cs b/src/Avalonia.Base/Rendering/Composition/Animations/Interpolators.cs new file mode 100644 index 0000000000..62b790701a --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/Interpolators.cs @@ -0,0 +1,73 @@ +using System; +using System.Numerics; + +namespace Avalonia.Rendering.Composition.Animations +{ + internal interface IInterpolator + { + T Interpolate(T from, T to, float progress); + } + + class ScalarInterpolator : IInterpolator + { + public float Interpolate(float @from, float to, float progress) => @from + (to - @from) * progress; + + public static ScalarInterpolator Instance { get; } = new ScalarInterpolator(); + } + + class Vector2Interpolator : IInterpolator + { + public Vector2 Interpolate(Vector2 @from, Vector2 to, float progress) + => Vector2.Lerp(@from, to, progress); + + public static Vector2Interpolator Instance { get; } = new Vector2Interpolator(); + } + + class Vector3Interpolator : IInterpolator + { + public Vector3 Interpolate(Vector3 @from, Vector3 to, float progress) + => Vector3.Lerp(@from, to, progress); + + public static Vector3Interpolator Instance { get; } = new Vector3Interpolator(); + } + + class Vector4Interpolator : IInterpolator + { + public Vector4 Interpolate(Vector4 @from, Vector4 to, float progress) + => Vector4.Lerp(@from, to, progress); + + public static Vector4Interpolator Instance { get; } = new Vector4Interpolator(); + } + + class QuaternionInterpolator : IInterpolator + { + public Quaternion Interpolate(Quaternion @from, Quaternion to, float progress) + => Quaternion.Lerp(@from, to, progress); + + public static QuaternionInterpolator Instance { get; } = new QuaternionInterpolator(); + } + + class ColorInterpolator : IInterpolator + { + static byte Lerp(float a, float b, float p) => (byte) Math.Max(0, Math.Min(255, (p * (b - a) + a))); + + public static Avalonia.Media.Color + LerpRGB(Avalonia.Media.Color to, Avalonia.Media.Color from, float progress) => + new Avalonia.Media.Color(Lerp(to.A, @from.A, progress), + Lerp(to.R, @from.R, progress), + Lerp(to.G, @from.G, progress), + Lerp(to.B, @from.B, progress)); + + public Avalonia.Media.Color Interpolate(Avalonia.Media.Color @from, Avalonia.Media.Color to, float progress) + => LerpRGB(@from, to, progress); + + public static ColorInterpolator Instance { get; } = new ColorInterpolator(); + } + + class BooleanInterpolator : IInterpolator + { + public bool Interpolate(bool @from, bool to, float progress) => progress >= 1 ? to : @from; + + public static BooleanInterpolator Instance { get; } = new BooleanInterpolator(); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimation.cs new file mode 100644 index 0000000000..065dfd7a8e --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimation.cs @@ -0,0 +1,53 @@ +namespace Avalonia.Rendering.Composition.Animations +{ + public abstract class KeyFrameAnimation : CompositionAnimation + { + internal KeyFrameAnimation(Compositor compositor) : base(compositor) + { + } + + public AnimationDelayBehavior DelayBehavior { get; set; } + public System.TimeSpan DelayTime { get; set; } + public AnimationDirection Direction { get; set; } + public System.TimeSpan Duration { get; set; } + public AnimationIterationBehavior IterationBehavior { get; set; } + public int IterationCount { get; set; } = 1; + public AnimationStopBehavior StopBehavior { get; set; } + + private protected abstract IKeyFrames KeyFrames { get; } + + public void InsertExpressionKeyFrame(float normalizedProgressKey, string value, + CompositionEasingFunction easingFunction) => + KeyFrames.InsertExpressionKeyFrame(normalizedProgressKey, value, easingFunction); + + public void InsertExpressionKeyFrame(float normalizedProgressKey, string value) + => KeyFrames.InsertExpressionKeyFrame(normalizedProgressKey, value, new LinearEasingFunction(Compositor)); + } + + public enum AnimationDelayBehavior + { + SetInitialValueAfterDelay, + SetInitialValueBeforeDelay + } + + public enum AnimationDirection + { + Normal, + Reverse, + Alternate, + AlternateReverse + } + + public enum AnimationIterationBehavior + { + Count, + Forever + } + + public enum AnimationStopBehavior + { + LeaveCurrentValue, + SetToInitialValue, + SetToFinalValue + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs new file mode 100644 index 0000000000..b90a02148d --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs @@ -0,0 +1,139 @@ +using System; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition.Animations +{ + class KeyFrameAnimationInstance : IAnimationInstance where T : struct + { + private readonly IInterpolator _interpolator; + private readonly ServerKeyFrame[] _keyFrames; + private readonly PropertySetSnapshot _snapshot; + private readonly ExpressionVariant? _finalValue; + private readonly IExpressionObject _target; + private readonly AnimationDelayBehavior _delayBehavior; + private readonly TimeSpan _delayTime; + private readonly AnimationDirection _direction; + private readonly TimeSpan _duration; + private readonly AnimationIterationBehavior _iterationBehavior; + private readonly int _iterationCount; + private readonly AnimationStopBehavior _stopBehavior; + private TimeSpan _startedAt; + private T _startingValue; + + public KeyFrameAnimationInstance( + IInterpolator interpolator, ServerKeyFrame[] keyFrames, + PropertySetSnapshot snapshot, ExpressionVariant? finalValue, + IExpressionObject target, + AnimationDelayBehavior delayBehavior, TimeSpan delayTime, + AnimationDirection direction, TimeSpan duration, + AnimationIterationBehavior iterationBehavior, + int iterationCount, AnimationStopBehavior stopBehavior) + { + _interpolator = interpolator; + _keyFrames = keyFrames; + _snapshot = snapshot; + _finalValue = finalValue; + _target = target; + _delayBehavior = delayBehavior; + _delayTime = delayTime; + _direction = direction; + _duration = duration; + _iterationBehavior = iterationBehavior; + _iterationCount = iterationCount; + _stopBehavior = stopBehavior; + if (_keyFrames.Length == 0) + throw new InvalidOperationException("Animation has no key frames"); + if(_duration.Ticks <= 0) + throw new InvalidOperationException("Invalid animation duration"); + } + + public ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue) + { + var elapsed = now - _startedAt; + var starting = ExpressionVariant.Create(_startingValue); + var ctx = new ExpressionEvaluationContext + { + Parameters = _snapshot, + Target = _target, + CurrentValue = currentValue, + FinalValue = _finalValue ?? starting, + StartingValue = starting, + ForeignFunctionInterface = BuiltInExpressionFfi.Instance + }; + + if (elapsed < _delayTime) + { + if (_delayBehavior == AnimationDelayBehavior.SetInitialValueBeforeDelay) + return ExpressionVariant.Create(GetKeyFrame(ref ctx, _keyFrames[0])); + return currentValue; + } + + elapsed -= _delayTime; + var iterationNumber = elapsed.Ticks / _duration.Ticks; + if (_iterationBehavior == AnimationIterationBehavior.Count + && iterationNumber >= _iterationCount) + return ExpressionVariant.Create(GetKeyFrame(ref ctx, _keyFrames[_keyFrames.Length - 1])); + + + var evenIterationNumber = iterationNumber % 2 == 0; + elapsed = TimeSpan.FromTicks(elapsed.Ticks % _duration.Ticks); + + var reverse = + _direction == AnimationDirection.Alternate + ? !evenIterationNumber + : _direction == AnimationDirection.AlternateReverse + ? evenIterationNumber + : _direction == AnimationDirection.Reverse; + + var iterationProgress = elapsed.TotalSeconds / _duration.TotalSeconds; + if (reverse) + iterationProgress = 1 - iterationProgress; + + var left = new ServerKeyFrame + { + Value = _startingValue + }; + var right = _keyFrames[_keyFrames.Length - 1]; + for (var c = 0; c < _keyFrames.Length; c++) + { + var kf = _keyFrames[c]; + if (kf.Key < iterationProgress) + { + // this is the last frame + if (c == _keyFrames.Length - 1) + return ExpressionVariant.Create(GetKeyFrame(ref ctx, kf)); + + left = kf; + right = _keyFrames[c + 1]; + break; + } + } + + var keyProgress = Math.Max(0, Math.Min(1, (iterationProgress - left.Key) / (right.Key - left.Key))); + + var easedKeyProgress = right.EasingFunction.Ease((float) keyProgress); + if (float.IsNaN(easedKeyProgress) || float.IsInfinity(easedKeyProgress)) + return currentValue; + + return ExpressionVariant.Create(_interpolator.Interpolate( + GetKeyFrame(ref ctx, left), + GetKeyFrame(ref ctx, right), + easedKeyProgress + )); + } + + T GetKeyFrame(ref ExpressionEvaluationContext ctx, ServerKeyFrame f) + { + if (f.Expression != null) + return f.Expression.Evaluate(ref ctx).CastOrDefault(); + else + return f.Value; + } + + public void Start(TimeSpan startedAt, ExpressionVariant startingValue) + { + _startedAt = startedAt; + _startingValue = startingValue.CastOrDefault(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs new file mode 100644 index 0000000000..d7f2504061 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition.Animations +{ + class KeyFrames : List>, IKeyFrames + { + void Validate(float key) + { + if (key < 0 || key > 1) + throw new ArgumentException("Key frame key"); + if (Count > 0 && this[Count - 1].NormalizedProgressKey > key) + throw new ArgumentException("Key frame key " + key + " is less than the previous one"); + } + + public void InsertExpressionKeyFrame(float normalizedProgressKey, string value, + CompositionEasingFunction easingFunction) + { + Validate(normalizedProgressKey); + Add(new KeyFrame + { + NormalizedProgressKey = normalizedProgressKey, + Expression = Expression.Parse(value), + EasingFunction = easingFunction + }); + } + + public void Insert(float normalizedProgressKey, T value, CompositionEasingFunction easingFunction) + { + Validate(normalizedProgressKey); + Add(new KeyFrame + { + NormalizedProgressKey = normalizedProgressKey, + Value = value, + EasingFunction = easingFunction + }); + } + + public ServerKeyFrame[] Snapshot() + { + var frames = new ServerKeyFrame[Count]; + for (var c = 0; c < Count; c++) + { + var f = this[c]; + frames[c] = new ServerKeyFrame + { + Expression = f.Expression, + Value = f.Value, + EasingFunction = f.EasingFunction.Snapshot(), + Key = f.NormalizedProgressKey + }; + } + return frames; + } + } + + struct KeyFrame + { + public float NormalizedProgressKey; + public T Value; + public Expression Expression; + public CompositionEasingFunction EasingFunction; + } + + struct ServerKeyFrame + { + public T Value; + public Expression Expression; + public IEasingFunction EasingFunction; + public float Key; + } + + + + interface IKeyFrames + { + public void InsertExpressionKeyFrame(float normalizedProgressKey, string value, CompositionEasingFunction easingFunction); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/PropertySetSnapshot.cs b/src/Avalonia.Base/Rendering/Composition/Animations/PropertySetSnapshot.cs new file mode 100644 index 0000000000..ca703dfc6f --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/PropertySetSnapshot.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition.Animations +{ + internal class PropertySetSnapshot : IExpressionParameterCollection, IExpressionObject + { + private readonly Dictionary _dic; + + public struct Value + { + public ExpressionVariant Variant; + public IExpressionObject Object; + + public Value(IExpressionObject o) + { + Object = o; + Variant = default; + } + + public static implicit operator Value(ExpressionVariant v) => new Value + { + Variant = v + }; + } + + public PropertySetSnapshot(Dictionary dic) + { + _dic = dic; + } + + public ExpressionVariant GetParameter(string name) + { + _dic.TryGetValue(name, out var v); + return v.Variant; + } + + public IExpressionObject GetObjectParameter(string name) + { + _dic.TryGetValue(name, out var v); + return v.Object; + } + + public ExpressionVariant GetProperty(string name) => GetParameter(name); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs new file mode 100644 index 0000000000..07ac54b634 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Runtime.InteropServices; +using Avalonia.Collections; +using Avalonia.Media; +using Avalonia.Rendering.Composition.Drawing; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Threading; +using Avalonia.VisualTree; + +namespace Avalonia.Rendering.Composition; + +public class CompositingRenderer : RendererBase, IRendererWithCompositor +{ + private readonly IRenderRoot _root; + private readonly Compositor _compositor; + private readonly IDeferredRendererLock? _rendererLock; + CompositionDrawingContext _recorder = new(); + DrawingContext _recordingContext; + private HashSet _dirty = new(); + private HashSet _recalculateChildren = new(); + private readonly CompositionTarget _target; + private bool _queuedUpdate; + private Action _update; + + public CompositingRenderer(IRenderRoot root, + Compositor compositor, + IDeferredRendererLock? rendererLock = null) + { + _root = root; + _compositor = compositor; + _recordingContext = new DrawingContext(_recorder); + _rendererLock = rendererLock ?? new ManagedDeferredRendererLock(); + _target = compositor.CreateCompositionTarget(root.CreateRenderTarget); + _target.Root = ((Visual)root!.VisualRoot!).AttachToCompositor(compositor); + _update = Update; + } + + public bool DrawFps { get; set; } + public bool DrawDirtyRects { get; set; } + public event EventHandler? SceneInvalidated; + + void QueueUpdate() + { + if(_queuedUpdate) + return; + _queuedUpdate = true; + Dispatcher.UIThread.Post(_update, DispatcherPriority.Composition); + } + public void AddDirty(IVisual visual) + { + _dirty.Add((Visual)visual); + QueueUpdate(); + } + + public IEnumerable HitTest(Point p, IVisual root, Func filter) + { + var res = _target.TryHitTest(new Vector2((float)p.X, (float)p.Y)); + if(res == null) + yield break; + for (var index = res.Count - 1; index >= 0; index--) + { + var v = res[index]; + if (v is CompositionDrawListVisual dv) + { + if (filter == null || filter(dv.Visual)) + yield return dv.Visual; + } + } + } + + public IVisual? HitTestFirst(Point p, IVisual root, Func filter) + { + // TODO: Optimize + return HitTest(p, root, filter).FirstOrDefault(); + } + + public void RecalculateChildren(IVisual visual) + { + _recalculateChildren.Add((Visual)visual); + QueueUpdate(); + } + + private void SyncChildren(Visual v) + { + //TODO: Optimize by moving that logic to Visual itself + if(v.CompositionVisual == null) + return; + var compositionChildren = v.CompositionVisual.Children; + var visualChildren = (AvaloniaList)v.GetVisualChildren(); + if (compositionChildren.Count == visualChildren.Count) + { + bool mismatch = false; + for(var c=0; c _target.IsEnabled = true; + + public void Stop() + { + _target.IsEnabled = true; + } + + public void Dispose() + { + Stop(); + _target.Dispose(); + // Wait for the composition batch to be applied and rendered to guarantee that + // render target is not used anymore and can be safely disposed + _compositor.RequestCommitAsync().Wait(); + } + + + public Compositor Compositor => _compositor; +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs new file mode 100644 index 0000000000..9f02055412 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -0,0 +1,44 @@ +using System.Numerics; +using Avalonia.Rendering.Composition.Drawing; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition; + +internal class CompositionDrawListVisual : CompositionContainerVisual +{ + public Visual Visual { get; } + + private new DrawListVisualChanges Changes => (DrawListVisualChanges)base.Changes; + private CompositionDrawList? _drawList; + public CompositionDrawList? DrawList + { + get => _drawList; + set + { + _drawList?.Dispose(); + _drawList = value; + Changes.DrawCommands = value?.Clone(); + } + } + + private protected override IChangeSetPool ChangeSetPool => DrawListVisualChanges.Pool; + + internal CompositionDrawListVisual(Compositor compositor, ServerCompositionContainerVisual server, Visual visual) : base(compositor, server) + { + Visual = visual; + } + + internal override bool HitTest(Vector2 point) + { + if (DrawList == null) + return false; + var pt = new Point(point.X, point.Y); + if (Visual is ICustomHitTest custom) + return custom.HitTest(pt); + foreach (var op in DrawList) + if (op.Item.HitTest(pt)) + return true; + return false; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs b/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs new file mode 100644 index 0000000000..73db243e93 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs @@ -0,0 +1,97 @@ +using System; +using System.Numerics; +using Avalonia.Rendering.Composition.Transport; +using Avalonia.Rendering.Composition.Utils; + +namespace Avalonia.Rendering.Composition +{ + public abstract class CompositionEasingFunction : CompositionObject + { + internal CompositionEasingFunction(Compositor compositor) : base(compositor, null!) + { + } + + private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); + + internal abstract IEasingFunction Snapshot(); + } + + internal interface IEasingFunction + { + float Ease(float progress); + } + + public sealed class DelegateCompositionEasingFunction : CompositionEasingFunction + { + private readonly Easing _func; + + public delegate float EasingDelegate(float progress); + + internal DelegateCompositionEasingFunction(Compositor compositor, EasingDelegate func) : base(compositor) + { + _func = new Easing(func); + } + + class Easing : IEasingFunction + { + private readonly EasingDelegate _func; + + public Easing(EasingDelegate func) + { + _func = func; + } + + public float Ease(float progress) => _func(progress); + } + + internal override IEasingFunction Snapshot() => _func; + } + + public class LinearEasingFunction : CompositionEasingFunction + { + public LinearEasingFunction(Compositor compositor) : base(compositor) + { + } + + class Linear : IEasingFunction + { + public float Ease(float progress) => progress; + } + + private static readonly Linear Instance = new Linear(); + internal override IEasingFunction Snapshot() => Instance; + } + + public class CubicBezierEasingFunction : CompositionEasingFunction + { + private CubicBezier _bezier; + public Vector2 ControlPoint1 { get; } + public Vector2 ControlPoint2 { get; } + //cubic-bezier(0.25, 0.1, 0.25, 1.0) + internal CubicBezierEasingFunction(Compositor compositor, Vector2 controlPoint1, Vector2 controlPoint2) : base(compositor) + { + ControlPoint1 = controlPoint1; + ControlPoint2 = controlPoint2; + if (controlPoint1.X < 0 || controlPoint1.X > 1 || controlPoint2.X < 0 || controlPoint2.X > 1) + throw new ArgumentException(); + _bezier = new CubicBezier(controlPoint1.X, controlPoint1.Y, controlPoint2.X, controlPoint2.Y); + } + + class EasingFunction : IEasingFunction + { + private readonly CubicBezier _bezier; + + public EasingFunction(CubicBezier bezier) + { + _bezier = bezier; + } + + public float Ease(float progress) => (float)_bezier.Solve(progress); + } + + internal static IEasingFunction Ease { get; } = new EasingFunction(new CubicBezier(0.25, 0.1, 0.25, 1)); + + internal override IEasingFunction Snapshot() => new EasingFunction(_bezier); + } + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionGradientBrush.cs b/src/Avalonia.Base/Rendering/Composition/CompositionGradientBrush.cs new file mode 100644 index 0000000000..cf222550dd --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionGradientBrush.cs @@ -0,0 +1,16 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition +{ + public partial class CompositionGradientBrush : CompositionBrush + { + internal CompositionGradientBrush(Compositor compositor, ServerCompositionGradientBrush server) : base(compositor, server) + { + ColorStops = new CompositionGradientStopCollection(compositor, server.Stops); + } + + public CompositionGradientStopCollection ColorStops { get; } + } + + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs new file mode 100644 index 0000000000..2417ecaba8 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs @@ -0,0 +1,125 @@ +using System; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition +{ + public abstract class CompositionObject : IDisposable, IExpressionObject + { + public ImplicitAnimationCollection? ImplicitAnimations { get; set; } + internal CompositionObject(Compositor compositor, ServerObject server) + { + Compositor = compositor; + Server = server; + } + + public Compositor Compositor { get; } + internal ServerObject Server { get; } + public bool IsDisposed { get; private set; } + private ChangeSet? _changes; + + private static void ThrowInvalidOperation() => + throw new InvalidOperationException("There is no server-side counterpart for this object"); + + private protected ChangeSet Changes + { + get + { + // ReSharper disable once ConditionIsAlwaysTrueOrFalse + if (Server == null) ThrowInvalidOperation(); + var currentBatch = Compositor.CurrentBatch; + if (_changes != null && _changes.Batch != currentBatch) + _changes = null; + if (_changes == null) + { + _changes = ChangeSetPool.Get(Server!, currentBatch); + currentBatch.Changes!.Add(_changes); + Compositor.QueueImplicitBatchCommit(); + } + + return _changes; + } + } + + private protected abstract IChangeSetPool ChangeSetPool { get; } + + public void Dispose() + { + Changes.Dispose = true; + IsDisposed = true; + } + + internal virtual ExpressionVariant GetPropertyForAnimation(string name) + { + return default; + } + + ExpressionVariant IExpressionObject.GetProperty(string name) => GetPropertyForAnimation(name); + + public void StartAnimation(string propertyName, CompositionAnimation animation) + => StartAnimation(propertyName, animation, null); + + internal virtual void StartAnimation(string propertyName, CompositionAnimation animation, ExpressionVariant? finalValue = null) + { + throw new ArgumentException("Unknown property " + propertyName); + } + + public void StartAnimationGroup(ICompositionAnimationBase grp) + { + if (grp is CompositionAnimation animation) + { + if(animation.Target == null) + throw new ArgumentException("Animation Target can't be null"); + StartAnimation(animation.Target, animation); + } + else if (grp is CompositionAnimationGroup group) + { + foreach (var a in group.Animations) + { + if (a.Target == null) + throw new ArgumentException("Animation Target can't be null"); + StartAnimation(a.Target, a); + } + } + } + + bool StartAnimationGroupPart(CompositionAnimation animation, string target, ExpressionVariant finalValue) + { + if(animation.Target == null) + throw new ArgumentException("Animation Target can't be null"); + if (animation.Target == target) + { + StartAnimation(animation.Target, animation, finalValue); + return true; + } + else + { + StartAnimation(animation.Target, animation); + return false; + } + } + + internal bool StartAnimationGroup(ICompositionAnimationBase grp, string target, ExpressionVariant finalValue) + { + if (grp is CompositionAnimation animation) + return StartAnimationGroupPart(animation, target, finalValue); + if (grp is CompositionAnimationGroup group) + { + var matched = false; + foreach (var a in group.Animations) + { + if (a.Target == null) + throw new ArgumentException("Animation Target can't be null"); + if (StartAnimationGroupPart(a, target, finalValue)) + matched = true; + } + + return matched; + } + + throw new ArgumentException(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs new file mode 100644 index 0000000000..004c2676ff --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Numerics; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition +{ + public class CompositionPropertySet : CompositionObject + { + private readonly Dictionary _variants = new Dictionary(); + private readonly Dictionary _objects = new Dictionary(); + + internal CompositionPropertySet(Compositor compositor) : base(compositor, null!) + { + } + + private protected override IChangeSetPool ChangeSetPool => throw new NotSupportedException(); + + internal void Set(string key, ExpressionVariant value) + { + _objects.Remove(key); + _variants[key] = value; + } + + internal void Set(string key, CompositionObject obj) + { + _objects[key] = obj ?? throw new ArgumentNullException(nameof(obj)); + _variants.Remove(key); + } + public void InsertColor(string propertyName, Avalonia.Media.Color value) => Set(propertyName, value); + + public void InsertMatrix3x2(string propertyName, Matrix3x2 value) => Set(propertyName, value); + + public void InsertMatrix4x4(string propertyName, Matrix4x4 value) => Set(propertyName, value); + + public void InsertQuaternion(string propertyName, Quaternion value) => Set(propertyName, value); + + public void InsertScalar(string propertyName, float value) => Set(propertyName, value); + public void InsertVector2(string propertyName, Vector2 value) => Set(propertyName, value); + + public void InsertVector3(string propertyName, Vector3 value) => Set(propertyName, value); + + public void InsertVector4(string propertyName, Vector4 value) => Set(propertyName, value); + + + CompositionGetValueStatus TryGetVariant(string key, out T value) where T : struct + { + value = default; + if (!_variants.TryGetValue(key, out var v)) + return _objects.ContainsKey(key) + ? CompositionGetValueStatus.TypeMismatch + : CompositionGetValueStatus.NotFound; + + return v.TryCast(out value) ? CompositionGetValueStatus.Succeeded : CompositionGetValueStatus.TypeMismatch; + } + + public CompositionGetValueStatus TryGetColor(string propertyName, out Avalonia.Media.Color value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetMatrix3x2(string propertyName, out Matrix3x2 value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetMatrix4x4(string propertyName, out Matrix4x4 value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetQuaternion(string propertyName, out Quaternion value) + => TryGetVariant(propertyName, out value); + + + public CompositionGetValueStatus TryGetScalar(string propertyName, out float value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetVector2(string propertyName, out Vector2 value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetVector3(string propertyName, out Vector3 value) + => TryGetVariant(propertyName, out value); + + public CompositionGetValueStatus TryGetVector4(string propertyName, out Vector4 value) + => TryGetVariant(propertyName, out value); + + + public void InsertBoolean(string propertyName, bool value) => Set(propertyName, value); + + public CompositionGetValueStatus TryGetBoolean(string propertyName, out bool value) + => TryGetVariant(propertyName, out value); + + internal void ClearAll() + { + _objects.Clear(); + _variants.Clear(); + } + + internal void Clear(string key) + { + _objects.Remove(key); + _variants.Remove(key); + } + + internal PropertySetSnapshot Snapshot(bool server, int allowedNestingLevel) + { + var dic = new Dictionary(_objects.Count + _variants.Count); + foreach (var o in _objects) + { + if (o.Value is CompositionPropertySet ps) + { + if (allowedNestingLevel <= 0) + throw new InvalidOperationException("PropertySet depth limit reached"); + dic[o.Key] = new PropertySetSnapshot.Value(ps.Snapshot(server, allowedNestingLevel - 1)); + } + else if (o.Value.Server == null) + throw new InvalidOperationException($"Object of type {o.Value.GetType()} is not allowed"); + else + dic[o.Key] = new PropertySetSnapshot.Value(server ? (IExpressionObject) o.Value.Server : o.Value); + } + + foreach (var v in _variants) + dic[v.Key] = v.Value; + + return new PropertySetSnapshot(dic); + } + } + + public enum CompositionGetValueStatus + { + Succeeded, + TypeMismatch, + NotFound + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs new file mode 100644 index 0000000000..a8835ca668 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.Numerics; +using Avalonia.Collections.Pooled; + +namespace Avalonia.Rendering.Composition +{ + public partial class CompositionTarget + { + partial void OnRootChanged() + { + if (Root != null) + Root.Root = this; + } + + partial void OnRootChanging() + { + if (Root != null) + Root.Root = null; + } + + public PooledList? TryHitTest(Vector2 point) + { + Server.Readback.NextRead(); + if (Root == null) + return null; + var res = new PooledList(); + HitTestCore(Root, point, res); + return res; + } + + public Vector2? TryTransformToVisual(CompositionVisual visual, Vector2 point) + { + if (visual.Root != this) + return null; + var v = visual; + var m = Matrix3x2.Identity; + while (v != null) + { + if (!TryGetInvertedTransform(v, out var cm)) + return null; + m = m * cm; + v = v.Parent; + } + + return Vector2.Transform(point, m); + } + + bool TryGetInvertedTransform(CompositionVisual visual, out Matrix3x2 matrix) + { + var m = visual.TryGetServerTransform(); + if (m == null) + { + matrix = default; + return false; + } + + // TODO: Use Matrix3x3 + var m32 = new Matrix3x2(m.Value.M11, m.Value.M12, m.Value.M21, m.Value.M22, m.Value.M41, m.Value.M42); + + return Matrix3x2.Invert(m32, out matrix); + } + + bool TryTransformTo(CompositionVisual visual, ref Vector2 v) + { + if (TryGetInvertedTransform(visual, out var m)) + { + v = Vector2.Transform(v, m); + return true; + } + + return false; + } + + bool HitTestCore(CompositionVisual visual, Vector2 point, PooledList result) + { + //TODO: Check readback too + if (visual.Visible == false) + return false; + if (!TryTransformTo(visual, ref point)) + return false; + if (point.X >= 0 && point.Y >= 0 && point.X <= visual.Size.X && point.Y <= visual.Size.Y) + { + bool success = false; + // Hit-test the current node + if (visual.HitTest(point)) + { + result.Add(visual); + success = true; + } + + // Inspect children too + if(visual is CompositionContainerVisual cv) + for (var c = cv.Children.Count - 1; c >= 0; c--) + { + var ch = cv.Children[c]; + var hit = HitTestCore(ch, point, result); + if (hit) + return true; + } + + return success; + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Compositor.cs b/src/Avalonia.Base/Rendering/Composition/Compositor.cs new file mode 100644 index 0000000000..217d8dd803 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Compositor.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Numerics; +using System.Threading.Tasks; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; +using Avalonia.Threading; + + +namespace Avalonia.Rendering.Composition +{ + public partial class Compositor + { + private ServerCompositor _server; + private Batch _currentBatch; + private bool _implicitBatchCommitQueued; + private Action _implicitBatchCommit; + + internal Batch CurrentBatch => _currentBatch; + internal ServerCompositor Server => _server; + internal CompositionEasingFunction DefaultEasing { get; } + + private Compositor(ServerCompositor server) + { + _server = server; + _currentBatch = new Batch(); + _implicitBatchCommit = ImplicitBatchCommit; + DefaultEasing = new CubicBezierEasingFunction(this, + new Vector2(0.25f, 0.1f), new Vector2(0.25f, 1f)); + } + + public CompositionTarget CreateCompositionTarget(Func renderTargetFactory) + { + return new CompositionTarget(this, new ServerCompositionTarget(_server, renderTargetFactory)); + } + + public Task RequestCommitAsync() + { + var batch = CurrentBatch; + _currentBatch = new Batch(); + batch.CommitedAt = Server.Clock.Elapsed; + _server.EnqueueBatch(batch); + return batch.Completed; + } + + public static Compositor Create(IRenderLoop timer) + { + return new Compositor(new ServerCompositor(timer)); + } + + public void Dispose() + { + + } + + public CompositionContainerVisual CreateContainerVisual() => new(this, new ServerCompositionContainerVisual(_server)); + + public CompositionSolidColorVisual CreateSolidColorVisual() => new CompositionSolidColorVisual(this, + new ServerCompositionSolidColorVisual(_server)); + + public CompositionSolidColorVisual CreateSolidColorVisual(Avalonia.Media.Color color) + { + var v = new CompositionSolidColorVisual(this, new ServerCompositionSolidColorVisual(_server)); + v.Color = color; + return v; + } + + public CompositionSpriteVisual CreateSpriteVisual() => new CompositionSpriteVisual(this, new ServerCompositionSpriteVisual(_server)); + + public CompositionLinearGradientBrush CreateLinearGradientBrush() + => new CompositionLinearGradientBrush(this, new ServerCompositionLinearGradientBrush(_server)); + + public CompositionColorGradientStop CreateColorGradientStop() + => new CompositionColorGradientStop(this, new ServerCompositionColorGradientStop(_server)); + + public CompositionColorGradientStop CreateColorGradientStop(float offset, Avalonia.Media.Color color) + { + var stop = CreateColorGradientStop(); + stop.Offset = offset; + stop.Color = color; + return stop; + } + + // We want to make it 100% async later + /* + public CompositionBitmapSurface LoadBitmapSurface(Stream stream) + { + var bmp = _server.Backend.LoadCpuMemoryBitmap(stream); + return new CompositionBitmapSurface(this, bmp); + } + + public async Task LoadBitmapSurfaceAsync(Stream stream) + { + var bmp = await Task.Run(() => _server.Backend.LoadCpuMemoryBitmap(stream)); + return new CompositionBitmapSurface(this, bmp); + } + */ + public CompositionColorBrush CreateColorBrush(Avalonia.Media.Color color) => + new CompositionColorBrush(this, new ServerCompositionColorBrush(_server)) {Color = color}; + + public CompositionSurfaceBrush CreateSurfaceBrush() => + new CompositionSurfaceBrush(this, new ServerCompositionSurfaceBrush(_server)); + + /* + public CompositionGaussianBlurEffectBrush CreateGaussianBlurEffectBrush() => + new CompositionGaussianBlurEffectBrush(this, new ServerCompositionGaussianBlurEffectBrush(_server)); + + public CompositionBackdropBrush CreateBackdropBrush() => + new CompositionBackdropBrush(this, new ServerCompositionBackdropBrush(Server));*/ + + public ExpressionAnimation CreateExpressionAnimation() => new ExpressionAnimation(this); + + public ExpressionAnimation CreateExpressionAnimation(string expression) => new ExpressionAnimation(this) + { + Expression = expression + }; + + public ImplicitAnimationCollection CreateImplicitAnimationCollection() => new ImplicitAnimationCollection(this); + + public CompositionAnimationGroup CreateAnimationGroup() => new CompositionAnimationGroup(this); + + internal CustomDrawVisual CreateCustomDrawVisual(ICustomDrawVisualRenderer renderer, + ICustomDrawVisualHitTest? hitTest = null) where T : IEquatable => + new CustomDrawVisual(this, renderer, hitTest); + + public void QueueImplicitBatchCommit() + { + if(_implicitBatchCommitQueued) + return; + _implicitBatchCommitQueued = true; + Dispatcher.UIThread.Post(_implicitBatchCommit, DispatcherPriority.CompositionBatch); + } + + private void ImplicitBatchCommit() + { + _implicitBatchCommitQueued = false; + RequestCommitAsync(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositorRenderLoopTask.cs b/src/Avalonia.Base/Rendering/Composition/CompositorRenderLoopTask.cs new file mode 100644 index 0000000000..074c0a9ccf --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CompositorRenderLoopTask.cs @@ -0,0 +1,20 @@ +using System; + +namespace Avalonia.Rendering.Composition; + +partial class Compositor +{ + class CompositorRenderLoopTask : IRenderLoopTask + { + public bool NeedsUpdate { get; } + public void Update(TimeSpan time) + { + throw new NotImplementedException(); + } + + public void Render() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs new file mode 100644 index 0000000000..f650d3e995 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs @@ -0,0 +1,20 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition +{ + public class CompositionContainerVisual : CompositionVisual + { + public CompositionVisualCollection Children { get; } + internal CompositionContainerVisual(Compositor compositor, ServerCompositionContainerVisual server) : base(compositor, server) + { + Children = new CompositionVisualCollection(this, server.Children); + } + + private protected override void OnRootChanged() + { + foreach (var ch in Children) + ch.Root = Root; + base.OnRootChanged(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs b/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs new file mode 100644 index 0000000000..0505d6a46c --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs @@ -0,0 +1,56 @@ +using System; +using System.Numerics; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Server; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition +{ + internal class CustomDrawVisual : CompositionContainerVisual where TData : IEquatable + { + private readonly ICustomDrawVisualHitTest? _hitTest; + + internal CustomDrawVisual(Compositor compositor, ICustomDrawVisualRenderer renderer, + ICustomDrawVisualHitTest? hitTest) : base(compositor, + new ServerCustomDrawVisual(compositor.Server, renderer)) + { + _hitTest = hitTest; + } + + private TData? _data; + + static bool Eq(TData? left, TData? right) + { + if (left == null && right == null) + return true; + if (left == null) + return false; + return left.Equals(right); + } + + public TData? Data + { + get => _data; + set + { + if (!Eq(_data, value)) + { + ((CustomDrawVisualChanges) Changes).Data.Value = value; + _data = value; + } + } + } + + private protected override IChangeSetPool ChangeSetPool => CustomDrawVisualChanges.Pool; + } + + public interface ICustomDrawVisualRenderer + { + void Render(IDrawingContextImpl canvas, TData? data); + } + + public interface ICustomDrawVisualHitTest + { + bool HitTest(TData data, Vector2 vector2); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs new file mode 100644 index 0000000000..aca8ef7c46 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs @@ -0,0 +1,81 @@ +using System; +using Avalonia.Collections.Pooled; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Utilities; + +namespace Avalonia.Rendering.Composition.Drawing; + +internal class CompositionDrawList : PooledList> +{ + public CompositionDrawList() + { + + } + + public CompositionDrawList(int capacity) : base(capacity) + { + + } + + public override void Dispose() + { + foreach(var item in this) + item.Dispose(); + base.Dispose(); + } + + public CompositionDrawList Clone() + { + var clone = new CompositionDrawList(Count); + foreach (var r in this) + clone.Add(r.Clone()); + return clone; + } +} + +internal class CompositionDrawListBuilder +{ + private CompositionDrawList? _operations; + private bool _owns; + + public void Reset(CompositionDrawList? previousOperations) + { + _operations = previousOperations; + _owns = false; + } + + public CompositionDrawList DrawOperations => _operations ?? new CompositionDrawList(); + + void MakeWritable(int atIndex) + { + if(_owns) + return; + _owns = true; + var newOps = new CompositionDrawList(_operations?.Count ?? Math.Max(1, atIndex)); + if (_operations != null) + { + for (var c = 0; c < atIndex; c++) + newOps.Add(_operations[c].Clone()); + } + + _operations = newOps; + } + + public void ReplaceDrawOperation(int index, IDrawOperation node) + { + MakeWritable(index); + DrawOperations.Add(RefCountable.Create(node)); + } + + public void AddDrawOperation(IDrawOperation node) + { + MakeWritable(DrawOperations.Count); + DrawOperations.Add(RefCountable.Create(node)); + } + + public void TrimTo(int count) + { + if (count < DrawOperations.Count) + DrawOperations.RemoveRange(count, DrawOperations.Count - count); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs new file mode 100644 index 0000000000..c8e5d9e064 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs @@ -0,0 +1,383 @@ +using System; +using System.Collections.Generic; +using System.Numerics; +using Avalonia.Media; +using Avalonia.Media.Imaging; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Drawing; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Utilities; +using Avalonia.VisualTree; +namespace Avalonia.Rendering.Composition; + +internal class CompositionDrawingContext : IDrawingContextImpl +{ + private CompositionDrawListBuilder _builder = new(); + private int _drawOperationIndex; + + /// + public Matrix Transform { get; set; } = Matrix.Identity; + + /// + public void Clear(Color color) + { + // Cannot clear a deferred scene. + } + + /// + public void Dispose() + { + // Nothing to do here since we allocate no unmanaged resources. + } + + public void BeginUpdate(CompositionDrawList list) + { + _builder.Reset(list); + _drawOperationIndex = 0; + } + + public CompositionDrawList EndUpdate() + { + _builder.TrimTo(_drawOperationIndex); + return _builder.DrawOperations!; + } + + /// + public void DrawGeometry(IBrush? brush, IPen? pen, IGeometryImpl geometry) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, brush, pen, geometry)) + { + Add(new GeometryNode(Transform, brush, pen, geometry, CreateChildScene(brush))); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void DrawBitmap(IRef source, double opacity, Rect sourceRect, Rect destRect, + BitmapInterpolationMode bitmapInterpolationMode) + { + var next = NextDrawAs(); + + if (next == null || + !next.Item.Equals(Transform, source, opacity, sourceRect, destRect, bitmapInterpolationMode)) + { + Add(new ImageNode(Transform, source, opacity, sourceRect, destRect, bitmapInterpolationMode)); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void DrawBitmap(IRef source, IBrush opacityMask, Rect opacityMaskRect, Rect sourceRect) + { + // This method is currently only used to composite layers so shouldn't be called here. + throw new NotSupportedException(); + } + + /// + public void DrawLine(IPen pen, Point p1, Point p2) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, pen, p1, p2)) + { + Add(new LineNode(Transform, pen, p1, p2, CreateChildScene(pen.Brush))); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void DrawRectangle(IBrush? brush, IPen? pen, RoundedRect rect, + BoxShadows boxShadows = default) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, brush, pen, rect, boxShadows)) + { + Add(new RectangleNode(Transform, brush, pen, rect, boxShadows, CreateChildScene(brush))); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void DrawRectangle(IExperimentalAcrylicMaterial material, RoundedRect rect) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, material, rect)) + { + Add(new ExperimentalAcrylicNode(Transform, material, rect)); + } + else + { + ++_drawOperationIndex; + } + } + + public void DrawEllipse(IBrush? brush, IPen? pen, Rect rect) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, brush, pen, rect)) + { + Add(new EllipseNode(Transform, brush, pen, rect, CreateChildScene(brush))); + } + else + { + ++_drawOperationIndex; + } + } + + public void Custom(ICustomDrawOperation custom) + { + var next = NextDrawAs(); + if (next == null || !next.Item.Equals(Transform, custom)) + Add(new CustomDrawOperation(custom, Transform)); + else + ++_drawOperationIndex; + } + + /// + public void DrawGlyphRun(IBrush foreground, GlyphRun glyphRun) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, foreground, glyphRun)) + { + Add(new GlyphRunNode(Transform, foreground, glyphRun, CreateChildScene(foreground))); + } + + else + { + ++_drawOperationIndex; + } + } + + public IDrawingContextLayerImpl CreateLayer(Size size) + { + throw new NotSupportedException("Creating layers on a deferred drawing context not supported"); + } + + /// + public void PopClip() + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(null)) + { + Add(new ClipNode()); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PopGeometryClip() + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(null)) + { + Add(new GeometryClipNode()); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PopBitmapBlendMode() + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(null)) + { + Add(new BitmapBlendModeNode()); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PopOpacity() + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(null)) + { + Add(new OpacityNode()); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PopOpacityMask() + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(null, null)) + { + Add(new OpacityMaskNode()); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushClip(Rect clip) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, clip)) + { + Add(new ClipNode(Transform, clip)); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushClip(RoundedRect clip) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, clip)) + { + Add(new ClipNode(Transform, clip)); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushGeometryClip(IGeometryImpl? clip) + { + if (clip is null) + return; + + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(Transform, clip)) + { + Add(new GeometryClipNode(Transform, clip)); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushOpacity(double opacity) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(opacity)) + { + Add(new OpacityNode(opacity)); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushOpacityMask(IBrush mask, Rect bounds) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(mask, bounds)) + { + Add(new OpacityMaskNode(mask, bounds, CreateChildScene(mask))); + } + else + { + ++_drawOperationIndex; + } + } + + /// + public void PushBitmapBlendMode(BitmapBlendingMode blendingMode) + { + var next = NextDrawAs(); + + if (next == null || !next.Item.Equals(blendingMode)) + { + Add(new BitmapBlendModeNode(blendingMode)); + } + else + { + ++_drawOperationIndex; + } + } + + private void Add(T node) where T : class, IDrawOperation + { + if (_drawOperationIndex < _builder!.DrawOperations.Count) + { + _builder.ReplaceDrawOperation(_drawOperationIndex, node); + } + else + { + _builder.AddDrawOperation(node); + } + + ++_drawOperationIndex; + } + + private IRef? NextDrawAs() where T : class, IDrawOperation + { + return _drawOperationIndex < _builder!.DrawOperations.Count + ? _builder.DrawOperations[_drawOperationIndex] as IRef + : null; + } + + private IDictionary? CreateChildScene(IBrush? brush) + { + /* + var visualBrush = brush as VisualBrush; + + if (visualBrush != null) + { + var visual = visualBrush.Visual; + + if (visual != null) + { + (visual as IVisualBrushInitialize)?.EnsureInitialized(); + var scene = new Scene(visual); + _sceneBuilder.UpdateAll(scene); + return new Dictionary { { visualBrush.Visual, scene } }; + } + }*/ + + return null; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Enums.cs b/src/Avalonia.Base/Rendering/Composition/Enums.cs new file mode 100644 index 0000000000..e349845cbf --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Enums.cs @@ -0,0 +1,120 @@ +using System; + +namespace Avalonia.Rendering.Composition +{ + public enum CompositionBlendMode + { + /// No regions are enabled. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_clr.svg) + Clear, + + /// Only the source will be present. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_src.svg) + Src, + + /// Only the destination will be present. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_dst.svg) + Dst, + + /// Source is placed over the destination. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_src-over.svg) + SrcOver, + + /// Destination is placed over the source. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_dst-over.svg) + DstOver, + + /// The source that overlaps the destination, replaces the destination. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_src-in.svg) + SrcIn, + + /// Destination which overlaps the source, replaces the source. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_dst-in.svg) + DstIn, + + /// Source is placed, where it falls outside of the destination. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_src-out.svg) + SrcOut, + + /// Destination is placed, where it falls outside of the source. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_dst-out.svg) + DstOut, + + /// Source which overlaps the destination, replaces the destination. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_src-atop.svg) + SrcATop, + + /// Destination which overlaps the source replaces the source. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_dst-atop.svg) + DstATop, + + /// The non-overlapping regions of source and destination are combined. [Porter Duff Compositing Operators] (https://drafts.fxtf.org/compositing-1/examples/PD_xor.svg) + Xor, + + /// Display the sum of the source image and destination image. [Porter Duff Compositing Operators] + Plus, + + /// Multiplies all components (= alpha and color). [Separable Blend Modes] + Modulate, + + /// Multiplies the complements of the backdrop and source CompositionColorvalues, then complements the result. [Separable Blend Modes] + Screen, + + /// Multiplies or screens the colors, depending on the backdrop CompositionColorvalue. [Separable Blend Modes] + Overlay, + + /// Selects the darker of the backdrop and source colors. [Separable Blend Modes] + Darken, + + /// Selects the lighter of the backdrop and source colors. [Separable Blend Modes] + Lighten, + + /// Brightens the backdrop CompositionColorto reflect the source color. [Separable Blend Modes] + ColorDodge, + + /// Darkens the backdrop CompositionColorto reflect the source color. [Separable Blend Modes] + ColorBurn, + + /// Multiplies or screens the colors, depending on the source CompositionColorvalue. [Separable Blend Modes] + HardLight, + + /// Darkens or lightens the colors, depending on the source CompositionColorvalue. [Separable Blend Modes] + SoftLight, + + /// Subtracts the darker of the two constituent colors from the lighter color. [Separable Blend Modes] + Difference, + + /// Produces an effect similar to that of the Difference mode but lower in contrast. [Separable Blend Modes] + Exclusion, + + /// The source CompositionColoris multiplied by the destination CompositionColorand replaces the destination [Separable Blend Modes] + Multiply, + + /// Creates a CompositionColorwith the hue of the source CompositionColorand the saturation and luminosity of the backdrop color. [Non-Separable Blend Modes] + Hue, + + /// Creates a CompositionColorwith the saturation of the source CompositionColorand the hue and luminosity of the backdrop color. [Non-Separable Blend Modes] + Saturation, + + /// Creates a CompositionColorwith the hue and saturation of the source CompositionColorand the luminosity of the backdrop color. [Non-Separable Blend Modes] + Color, + + /// Creates a CompositionColorwith the luminosity of the source CompositionColorand the hue and saturation of the backdrop color. [Non-Separable Blend Modes] + Luminosity, + } + + public enum CompositionGradientExtendMode + { + Clamp, + Wrap, + Mirror + } + + [Flags] + public enum CompositionTileMode + { + None = 0, + TileX = 1, + TileY = 2, + FlipX = 4, + FlipY = 8, + Tile = TileX | TileY, + Flip = FlipX | FlipY + } + + public enum CompositionStretch + { + None = 0, + Fill = 1, + //TODO: Uniform, UniformToFill + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/BuiltInExpressionFfi.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/BuiltInExpressionFfi.cs new file mode 100644 index 0000000000..db9a26e301 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/BuiltInExpressionFfi.cs @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.Numerics; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Utils; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal class BuiltInExpressionFfi : IExpressionForeignFunctionInterface + { + private readonly DelegateExpressionFfi _registry; + + static float Lerp(float a, float b, float p) => p * (b - a) + a; + + static Matrix3x2 Inverse(Matrix3x2 m) + { + Matrix3x2.Invert(m, out var r); + return r; + } + + static Matrix4x4 Inverse(Matrix4x4 m) + { + Matrix4x4.Invert(m, out var r); + return r; + } + + static float SmoothStep(float edge0, float edge1, float x) + { + var t = MathExt.Clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); + return t * t * (3.0f - 2.0f * t); + } + + static Vector2 SmoothStep(Vector2 edge0, Vector2 edge1, Vector2 x) + { + return new Vector2( + SmoothStep(edge0.X, edge1.X, x.X), + SmoothStep(edge0.Y, edge1.Y, x.Y) + + ); + } + static Vector3 SmoothStep(Vector3 edge0, Vector3 edge1, Vector3 x) + { + return new Vector3( + SmoothStep(edge0.X, edge1.X, x.X), + SmoothStep(edge0.Y, edge1.Y, x.Y), + SmoothStep(edge0.Z, edge1.Z, x.Z) + + ); + } + + static Vector4 SmoothStep(Vector4 edge0, Vector4 edge1, Vector4 x) + { + return new Vector4( + SmoothStep(edge0.X, edge1.X, x.X), + SmoothStep(edge0.Y, edge1.Y, x.Y), + SmoothStep(edge0.Z, edge1.Z, x.Z), + SmoothStep(edge0.W, edge1.W, x.W) + ); + } + + private BuiltInExpressionFfi() + { + _registry = new DelegateExpressionFfi + { + {"Abs", (float f) => Math.Abs(f)}, + {"Abs", (Vector2 v) => Vector2.Abs(v)}, + {"Abs", (Vector3 v) => Vector3.Abs(v)}, + {"Abs", (Vector4 v) => Vector4.Abs(v)}, + + {"ACos", (float f) => (float) Math.Acos(f)}, + {"ASin", (float f) => (float) Math.Asin(f)}, + {"ATan", (float f) => (float) Math.Atan(f)}, + {"Ceil", (float f) => (float) Math.Ceiling(f)}, + + {"Clamp", (float a1, float a2, float a3) => MathExt.Clamp(a1, a2, a3)}, + {"Clamp", (Vector2 a1, Vector2 a2, Vector2 a3) => Vector2.Clamp(a1, a2, a3)}, + {"Clamp", (Vector3 a1, Vector3 a2, Vector3 a3) => Vector3.Clamp(a1, a2, a3)}, + {"Clamp", (Vector4 a1, Vector4 a2, Vector4 a3) => Vector4.Clamp(a1, a2, a3)}, + + {"Concatenate", (Quaternion a1, Quaternion a2) => Quaternion.Concatenate(a1, a2)}, + {"Cos", (float a) => (float) Math.Cos(a)}, + + /* + TODO: + ColorHsl(Float h, Float s, Float l) + ColorLerpHSL(Color colorTo, CompositionColorcolorFrom, Float progress) + */ + + { + "ColorLerp", (Avalonia.Media.Color to, Avalonia.Media.Color from, float progress) => + ColorInterpolator.LerpRGB(to, from, progress) + }, + { + "ColorLerpRGB", (Avalonia.Media.Color to, Avalonia.Media.Color from, float progress) => + ColorInterpolator.LerpRGB(to, from, progress) + }, + { + "ColorRGB", (float a, float r, float g, float b) => Avalonia.Media.Color.FromArgb( + (byte) MathExt.Clamp(a, 0, 255), + (byte) MathExt.Clamp(r, 0, 255), + (byte) MathExt.Clamp(g, 0, 255), + (byte) MathExt.Clamp(b, 0, 255) + ) + }, + + {"Distance", (Vector2 a1, Vector2 a2) => Vector2.Distance(a1, a2)}, + {"Distance", (Vector3 a1, Vector3 a2) => Vector3.Distance(a1, a2)}, + {"Distance", (Vector4 a1, Vector4 a2) => Vector4.Distance(a1, a2)}, + + {"DistanceSquared", (Vector2 a1, Vector2 a2) => Vector2.DistanceSquared(a1, a2)}, + {"DistanceSquared", (Vector3 a1, Vector3 a2) => Vector3.DistanceSquared(a1, a2)}, + {"DistanceSquared", (Vector4 a1, Vector4 a2) => Vector4.DistanceSquared(a1, a2)}, + + {"Floor", (float v) => (float) Math.Floor(v)}, + + {"Inverse", (Matrix3x2 v) => Inverse(v)}, + {"Inverse", (Matrix4x4 v) => Inverse(v)}, + + + {"Length", (Vector2 a1) => a1.Length()}, + {"Length", (Vector3 a1) => a1.Length()}, + {"Length", (Vector4 a1) => a1.Length()}, + {"Length", (Quaternion a1) => a1.Length()}, + + {"LengthSquared", (Vector2 a1) => a1.LengthSquared()}, + {"LengthSquared", (Vector3 a1) => a1.LengthSquared()}, + {"LengthSquared", (Vector4 a1) => a1.LengthSquared()}, + {"LengthSquared", (Quaternion a1) => a1.LengthSquared()}, + + {"Lerp", (float a1, float a2, float a3) => Lerp(a1, a2, a3)}, + {"Lerp", (Vector2 a1, Vector2 a2, float a3) => Vector2.Lerp(a1, a2, a3)}, + {"Lerp", (Vector3 a1, Vector3 a2, float a3) => Vector3.Lerp(a1, a2, a3)}, + {"Lerp", (Vector4 a1, Vector4 a2, float a3) => Vector4.Lerp(a1, a2, a3)}, + + + {"Ln", (float f) => (float) Math.Log(f)}, + {"Log10", (float f) => (float) Math.Log10(f)}, + + {"Matrix3x2.CreateFromScale", (Vector2 v) => Matrix3x2.CreateScale(v)}, + {"Matrix3x2.CreateFromTranslation", (Vector2 v) => Matrix3x2.CreateTranslation(v)}, + {"Matrix3x2.CreateRotation", (float v) => Matrix3x2.CreateRotation(v)}, + {"Matrix3x2.CreateScale", (Vector2 v) => Matrix3x2.CreateScale(v)}, + {"Matrix3x2.CreateSkew", (float a1, float a2, Vector2 a3) => Matrix3x2.CreateSkew(a1, a2, a3)}, + {"Matrix3x2.CreateTranslation", (Vector2 v) => Matrix3x2.CreateScale(v)}, + { + "Matrix3x2", (float m11, float m12, float m21, float m22, float m31, float m32) => + new Matrix3x2(m11, m12, m21, m22, m31, m32) + }, + {"Matrix4x4.CreateFromAxisAngle", (Vector3 v, float angle) => Matrix4x4.CreateFromAxisAngle(v, angle)}, + {"Matrix4x4.CreateFromScale", (Vector3 v) => Matrix4x4.CreateScale(v)}, + {"Matrix4x4.CreateFromTranslation", (Vector3 v) => Matrix4x4.CreateTranslation(v)}, + {"Matrix4x4.CreateScale", (Vector3 v) => Matrix4x4.CreateScale(v)}, + {"Matrix4x4.CreateTranslation", (Vector3 v) => Matrix4x4.CreateScale(v)}, + {"Matrix4x4", (Matrix3x2 m) => new Matrix4x4(m)}, + { + "Matrix4x4", + (float m11, float m12, float m13, float m14, + float m21, float m22, float m23, float m24, + float m31, float m32, float m33, float m34, + float m41, float m42, float m43, float m44) => + new Matrix4x4( + m11, m12, m13, m14, + m21, m22, m23, m24, + m31, m32, m33, m34, + m41, m42, m43, m44) + }, + + + {"Max", (float a1, float a2) => Math.Max(a1, a2)}, + {"Max", (Vector2 a1, Vector2 a2) => Vector2.Max(a1, a2)}, + {"Max", (Vector3 a1, Vector3 a2) => Vector3.Max(a1, a2)}, + {"Max", (Vector4 a1, Vector4 a2) => Vector4.Max(a1, a2)}, + + + {"Min", (float a1, float a2) => Math.Min(a1, a2)}, + {"Min", (Vector2 a1, Vector2 a2) => Vector2.Min(a1, a2)}, + {"Min", (Vector3 a1, Vector3 a2) => Vector3.Min(a1, a2)}, + {"Min", (Vector4 a1, Vector4 a2) => Vector4.Min(a1, a2)}, + + {"Mod", (float a, float b) => a % b}, + + {"Normalize", (Quaternion a) => Quaternion.Normalize(a)}, + {"Normalize", (Vector2 a) => Vector2.Normalize(a)}, + {"Normalize", (Vector3 a) => Vector3.Normalize(a)}, + {"Normalize", (Vector4 a) => Vector4.Normalize(a)}, + + {"Pow", (float a, float b) => (float) Math.Pow(a, b)}, + {"Quaternion.CreateFromAxisAngle", (Vector3 a, float b) => Quaternion.CreateFromAxisAngle(a, b)}, + {"Quaternion", (float a, float b, float c, float d) => new Quaternion(a, b, c, d)}, + + {"Round", (float a) => (float) Math.Round(a)}, + + {"Scale", (Matrix3x2 a, float b) => a * b}, + {"Scale", (Matrix4x4 a, float b) => a * b}, + {"Scale", (Vector2 a, float b) => a * b}, + {"Scale", (Vector3 a, float b) => a * b}, + {"Scale", (Vector4 a, float b) => a * b}, + + {"Sin", (float a) => (float) Math.Sin(a)}, + + {"SmoothStep", (float a1, float a2, float a3) => SmoothStep(a1, a2, a3)}, + {"SmoothStep", (Vector2 a1, Vector2 a2, Vector2 a3) => SmoothStep(a1, a2, a3)}, + {"SmoothStep", (Vector3 a1, Vector3 a2, Vector3 a3) => SmoothStep(a1, a2, a3)}, + {"SmoothStep", (Vector4 a1, Vector4 a2, Vector4 a3) => SmoothStep(a1, a2, a3)}, + + // I have no idea how to do a spherical interpolation for a scalar value, so we are doing a linear one + {"Slerp", (float a1, float a2, float a3) => Lerp(a1, a2, a3)}, + {"Slerp", (Quaternion a1, Quaternion a2, float a3) => Quaternion.Slerp(a1, a2, a3)}, + + {"Sqrt", (float a) => (float) Math.Sqrt(a)}, + {"Square", (float a) => a * a}, + {"Tan", (float a) => (float) Math.Tan(a)}, + + {"ToRadians", (float a) => (float) (a * Math.PI / 180)}, + {"ToDegrees", (float a) => (float) (a * 180d / Math.PI)}, + + {"Transform", (Vector2 a, Matrix3x2 b) => Vector2.Transform(a, b)}, + {"Transform", (Vector3 a, Matrix4x4 b) => Vector3.Transform(a, b)}, + + {"Vector2", (float a, float b) => new Vector2(a, b)}, + {"Vector3", (float a, float b, float c) => new Vector3(a, b, c)}, + {"Vector3", (Vector2 v2, float z) => new Vector3(v2, z)}, + {"Vector4", (float a, float b, float c, float d) => new Vector4(a, b, c, d)}, + {"Vector4", (Vector2 v2, float z, float w) => new Vector4(v2, z, w)}, + {"Vector4", (Vector3 v3, float w) => new Vector4(v3, w)}, + }; + } + + public bool Call(string name, IReadOnlyList arguments, out ExpressionVariant result) => + _registry.Call(name, arguments, out result); + + public static BuiltInExpressionFfi Instance { get; } = new BuiltInExpressionFfi(); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/DelegateExpressionFfi.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/DelegateExpressionFfi.cs new file mode 100644 index 0000000000..002cf37522 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/DelegateExpressionFfi.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using Avalonia.Media; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal class DelegateExpressionFfi : IExpressionForeignFunctionInterface, IEnumerable + { + struct FfiRecord + { + public VariantType[] Types; + public Func, ExpressionVariant> Delegate; + } + + private readonly Dictionary>> + _registry = new Dictionary>>(); + + public bool Call(string name, IReadOnlyList arguments, out ExpressionVariant result) + { + result = default; + if (!_registry.TryGetValue(name, out var nameGroup)) + return false; + if (!nameGroup.TryGetValue(arguments.Count, out var countGroup)) + return false; + foreach (var record in countGroup) + { + var match = true; + for (var c = 0; c < arguments.Count; c++) + { + if (record.Types[c] != arguments[c].Type) + { + match = false; + break; + } + } + + if (match) + { + result = record.Delegate(arguments); + return true; + } + } + + return false; + } + + // Stub for collection initializer + IEnumerator IEnumerable.GetEnumerator() => Array.Empty().GetEnumerator(); + + void Add(string name, Func, ExpressionVariant> cb, + params Type[] types) + { + if (!_registry.TryGetValue(name, out var nameGroup)) + _registry[name] = nameGroup = + new Dictionary>(); + if (!nameGroup.TryGetValue(types.Length, out var countGroup)) + nameGroup[types.Length] = countGroup = new List(); + + countGroup.Add(new FfiRecord + { + Types = types.Select(t => TypeMap[t]).ToArray(), + Delegate = cb + }); + } + + static readonly Dictionary TypeMap = new Dictionary + { + [typeof(bool)] = VariantType.Boolean, + [typeof(float)] = VariantType.Scalar, + [typeof(Vector2)] = VariantType.Vector2, + [typeof(Vector3)] = VariantType.Vector3, + [typeof(Vector4)] = VariantType.Vector4, + [typeof(Matrix3x2)] = VariantType.Matrix3x2, + [typeof(Matrix4x4)] = VariantType.Matrix4x4, + [typeof(Quaternion)] = VariantType.Quaternion, + [typeof(Color)] = VariantType.Color + }; + + public void Add(string name, Func cb) where T1 : struct + { + Add(name, args => cb(args[0].CastOrDefault()), typeof(T1)); + } + + public void Add(string name, Func cb) where T1 : struct where T2 : struct + { + Add(name, args => cb(args[0].CastOrDefault(), args[1].CastOrDefault()), typeof(T1), typeof(T2)); + } + + + public void Add(string name, Func cb) + where T1 : struct where T2 : struct where T3 : struct + { + Add(name, args => cb(args[0].CastOrDefault(), args[1].CastOrDefault(), args[2].CastOrDefault()), typeof(T1), typeof(T2), + typeof(T3)); + } + + public void Add(string name, Func cb) + where T1 : struct where T2 : struct where T3 : struct where T4 : struct + { + Add(name, args => cb( + args[0].CastOrDefault(), + args[1].CastOrDefault(), + args[2].CastOrDefault(), + args[3].CastOrDefault()), + typeof(T1), typeof(T2), typeof(T3), typeof(T4)); + } + + public void Add(string name, Func cb) + where T1 : struct where T2 : struct where T3 : struct where T4 : struct where T5 : struct + { + Add(name, args => cb( + args[0].CastOrDefault(), + args[1].CastOrDefault(), + args[2].CastOrDefault(), + args[3].CastOrDefault(), + args[4].CastOrDefault()), + typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5)); + } + + public void Add(string name, Func cb) + where T1 : struct where T2 : struct where T3 : struct where T4 : struct where T5 : struct where T6 : struct + { + Add(name, args => cb( + args[0].CastOrDefault(), + args[1].CastOrDefault(), + args[2].CastOrDefault(), + args[3].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault()), + typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6)); + } + + + public void Add(string name, + Func cb) + where T1 : struct + where T2 : struct + where T3 : struct + where T4 : struct + where T5 : struct + where T6 : struct + where T7 : struct + where T8 : struct + where T9 : struct + where T10 : struct + where T11 : struct + where T12 : struct + where T13 : struct + where T14 : struct + where T15 : struct + where T16 : struct + { + Add(name, args => cb( + args[0].CastOrDefault(), + args[1].CastOrDefault(), + args[2].CastOrDefault(), + args[3].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault(), + args[4].CastOrDefault() + ), + typeof(T1), typeof(T2), typeof(T3), typeof(T4), + typeof(T5), typeof(T6), typeof(T7), typeof(T8), + typeof(T9), typeof(T10), typeof(T11), typeof(T12), + typeof(T13), typeof(T14), typeof(T15), typeof(T16) + ); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs new file mode 100644 index 0000000000..5577d2b52a --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs @@ -0,0 +1,331 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Reflection; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal abstract class Expression + { + public abstract ExpressionType Type { get; } + public static Expression Parse(string expression) + { + return ExpressionParser.Parse(expression.AsSpan()); + } + + public abstract ExpressionVariant Evaluate(ref ExpressionEvaluationContext context); + + protected abstract string Print(); + public override string ToString() => Print(); + + internal static string OperatorName(ExpressionType t) + { + var attr = typeof(ExpressionType).GetMember(t.ToString())[0] + .GetCustomAttribute(); + if (attr != null) + return attr.Name; + return t.ToString(); + } + } + + internal class PrettyPrintStringAttribute : Attribute + { + public string Name { get; } + + public PrettyPrintStringAttribute(string name) + { + Name = name; + } + } + + internal enum ExpressionType + { + // Binary operators + [PrettyPrintString("+")] + Add, + [PrettyPrintString("-")] + Subtract, + [PrettyPrintString("/")] + Divide, + [PrettyPrintString("*")] + Multiply, + [PrettyPrintString(">")] + MoreThan, + [PrettyPrintString("<")] + LessThan, + [PrettyPrintString(">=")] + MoreThanOrEqual, + [PrettyPrintString("<=")] + LessThanOrEqual, + [PrettyPrintString("&&")] + LogicalAnd, + [PrettyPrintString("||")] + LogicalOr, + [PrettyPrintString("%")] + Remainder, + [PrettyPrintString("==")] + Equals, + [PrettyPrintString("!=")] + NotEquals, + // Unary operators + [PrettyPrintString("!")] + Not, + [PrettyPrintString("-")] + UnaryMinus, + // The rest + MemberAccess, + Parameter, + FunctionCall, + Keyword, + Constant, + ConditionalExpression + } + + internal enum ExpressionKeyword + { + StartingValue, + CurrentValue, + FinalValue, + Target, + Pi, + True, + False + } + + internal class ConditionalExpression : Expression + { + public Expression Condition { get; } + public Expression TruePart { get; } + public Expression FalsePart { get; } + public override ExpressionType Type => ExpressionType.ConditionalExpression; + + public ConditionalExpression(Expression condition, Expression truePart, Expression falsePart) + { + Condition = condition; + TruePart = truePart; + FalsePart = falsePart; + } + + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + var cond = Condition.Evaluate(ref context); + if (cond.Type == VariantType.Boolean && cond.Boolean) + return TruePart.Evaluate(ref context); + return FalsePart.Evaluate(ref context); + } + + protected override string Print() => $"({Condition}) ? ({TruePart}) : ({FalsePart})"; + } + + internal class ConstantExpression : Expression + { + public float Constant { get; } + public override ExpressionType Type => ExpressionType.Constant; + + public ConstantExpression(float constant) + { + Constant = constant; + } + + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) => Constant; + protected override string Print() => Constant.ToString(CultureInfo.InvariantCulture); + } + + internal class FunctionCallExpression : Expression + { + public string Name { get; } + public List Parameters { get; } + public override ExpressionType Type => ExpressionType.FunctionCall; + + public FunctionCallExpression(string name, List parameters) + { + Name = name; + Parameters = parameters; + } + + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + if (context.ForeignFunctionInterface == null) + return default; + var args = new List(); + foreach (var expr in Parameters) + args.Add(expr.Evaluate(ref context)); + if (!context.ForeignFunctionInterface.Call(Name, args, out var res)) + return default; + return res; + } + + protected override string Print() + { + return Name + "( (" + string.Join("), (", Parameters) + ") )"; + } + } + + internal class MemberAccessExpression : Expression + { + public override ExpressionType Type => ExpressionType.MemberAccess; + public Expression Target { get; } + public string Member { get; } + + public MemberAccessExpression(Expression target, string member) + { + Target = target; + Member = string.Intern(member); + } + + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + if (Target is KeywordExpression ke + && ke.Keyword == ExpressionKeyword.Target) + return context.Target.GetProperty(Member); + if (Target is ParameterExpression pe) + { + var obj = context.Parameters?.GetObjectParameter(pe.Name); + if (obj != null) + return obj.GetProperty(Member); + } + + return Target.Evaluate(ref context).GetProperty(Member); + } + + protected override string Print() + { + return "(" + Target.ToString() + ")." + Member; + } + } + + internal class ParameterExpression : Expression + { + public string Name { get; } + public override ExpressionType Type => ExpressionType.Parameter; + + public ParameterExpression(string name) + { + Name = name; + } + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + return context.Parameters?.GetParameter(Name) ?? default; + } + + protected override string Print() + { + return "{" + Name + "}"; + } + } + + internal class KeywordExpression : Expression + { + public override ExpressionType Type => ExpressionType.Keyword; + public ExpressionKeyword Keyword { get; } + + public KeywordExpression(ExpressionKeyword keyword) + { + Keyword = keyword; + } + + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + if (Keyword == ExpressionKeyword.StartingValue) + return context.StartingValue; + if (Keyword == ExpressionKeyword.CurrentValue) + return context.CurrentValue; + if (Keyword == ExpressionKeyword.FinalValue) + return context.FinalValue; + if (Keyword == ExpressionKeyword.Target) + // should be handled by MemberAccess + return default; + if (Keyword == ExpressionKeyword.True) + return true; + if (Keyword == ExpressionKeyword.False) + return false; + if (Keyword == ExpressionKeyword.Pi) + return (float) Math.PI; + return default; + } + + protected override string Print() + { + return "[" + Keyword + "]"; + } + } + + internal class UnaryExpression : Expression + { + public Expression Parameter { get; } + public override ExpressionType Type { get; } + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + if (Type == ExpressionType.Not) + return !Parameter.Evaluate(ref context); + if (Type == ExpressionType.UnaryMinus) + return -Parameter.Evaluate(ref context); + return default; + } + + protected override string Print() + { + return OperatorName(Type) + Parameter; + } + + public UnaryExpression(Expression parameter, ExpressionType type) + { + Parameter = parameter; + Type = type; + } + } + + internal class BinaryExpression : Expression + { + public Expression Left { get; } + public Expression Right { get; } + public override ExpressionType Type { get; } + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) + { + var left = Left.Evaluate(ref context); + var right = Right.Evaluate(ref context); + if (Type == ExpressionType.Add) + return left + right; + if (Type == ExpressionType.Subtract) + return left - right; + if (Type == ExpressionType.Multiply) + return left * right; + if (Type == ExpressionType.Divide) + return left / right; + if (Type == ExpressionType.Remainder) + return left % right; + if (Type == ExpressionType.MoreThan) + return left > right; + if (Type == ExpressionType.LessThan) + return left < right; + if (Type == ExpressionType.MoreThanOrEqual) + return left > right; + if (Type == ExpressionType.LessThanOrEqual) + return left < right; + if (Type == ExpressionType.LogicalAnd) + return left.And(right); + if (Type == ExpressionType.LogicalOr) + return left.Or(right); + if (Type == ExpressionType.Equals) + return left.EqualsTo(right); + if (Type == ExpressionType.NotEquals) + return left.NotEqualsTo(right); + return default; + } + + protected override string Print() + { + return "(" + Left + OperatorName(Type) + Right + ")"; + } + + public BinaryExpression(Expression left, Expression right, ExpressionType type) + { + Left = left; + Right = right; + Type = type; + } + } + + + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs new file mode 100644 index 0000000000..a7ddabd70d --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal struct ExpressionEvaluationContext + { + public ExpressionVariant StartingValue { get; set; } + public ExpressionVariant CurrentValue { get; set; } + public ExpressionVariant FinalValue { get; set; } + public IExpressionObject Target { get; set; } + public IExpressionParameterCollection Parameters { get; set; } + public IExpressionForeignFunctionInterface ForeignFunctionInterface { get; set; } + } + + internal interface IExpressionObject + { + ExpressionVariant GetProperty(string name); + } + + internal interface IExpressionParameterCollection + { + public ExpressionVariant GetParameter(string name); + + public IExpressionObject GetObjectParameter(string name); + } + + internal interface IExpressionForeignFunctionInterface + { + bool Call(string name, IReadOnlyList arguments, out ExpressionVariant result); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParseException.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParseException.cs new file mode 100644 index 0000000000..6a207a3bf7 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParseException.cs @@ -0,0 +1,14 @@ +using System; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal class ExpressionParseException : Exception + { + public int Position { get; } + + public ExpressionParseException(string message, int position) : base(message) + { + Position = position; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs new file mode 100644 index 0000000000..5924bb8f1b --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; + +// ReSharper disable StringLiteralTypo + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal class ExpressionParser + { + public static Expression Parse(ReadOnlySpan s) + { + var p = new TokenParser(s); + var parsed = ParseTillTerminator(ref p, "", false, false, out _); + p.SkipWhitespace(); + if (p.Length != 0) + throw new ExpressionParseException("Unexpected data ", p.Position); + return parsed; + } + + private static ReadOnlySpan Dot => ".".AsSpan(); + static bool TryParseAtomic(ref TokenParser parser, + [MaybeNullWhen(returnValue: false)] out Expression expr) + { + // We can parse keywords, parameter names and constants + expr = null; + if (parser.TryParseKeywordLowerCase("this.startingvalue")) + expr = new KeywordExpression(ExpressionKeyword.StartingValue); + else if(parser.TryParseKeywordLowerCase("this.currentvalue")) + expr = new KeywordExpression(ExpressionKeyword.CurrentValue); + else if(parser.TryParseKeywordLowerCase("this.finalvalue")) + expr = new KeywordExpression(ExpressionKeyword.FinalValue); + else if(parser.TryParseKeywordLowerCase("pi")) + expr = new KeywordExpression(ExpressionKeyword.Pi); + else if(parser.TryParseKeywordLowerCase("true")) + expr = new KeywordExpression(ExpressionKeyword.True); + else if(parser.TryParseKeywordLowerCase("false")) + expr = new KeywordExpression(ExpressionKeyword.False); + else if (parser.TryParseKeywordLowerCase("this.target")) + expr = new KeywordExpression(ExpressionKeyword.Target); + + if (expr != null) + return true; + + if (parser.TryParseIdentifier(out var identifier)) + { + expr = new ParameterExpression(identifier.ToString()); + return true; + } + + if(parser.TryParseFloat(out var scalar)) + { + expr = new ConstantExpression(scalar); + return true; + } + + return false; + + } + + static bool TryParseOperator(ref TokenParser parser, out ExpressionType op) + { + op = (ExpressionType) (-1); + if (parser.TryConsume("||")) + op = ExpressionType.LogicalOr; + else if (parser.TryConsume("&&")) + op = ExpressionType.LogicalAnd; + else if (parser.TryConsume(">=")) + op = ExpressionType.MoreThanOrEqual; + else if (parser.TryConsume("<=")) + op = ExpressionType.LessThanOrEqual; + else if (parser.TryConsume("==")) + op = ExpressionType.Equals; + else if (parser.TryConsume("!=")) + op = ExpressionType.NotEquals; + else if (parser.TryConsumeAny("+-/*><%".AsSpan(), out var sop)) + { +#pragma warning disable CS8509 + op = sop switch +#pragma warning restore CS8509 + { + '+' => ExpressionType.Add, + '-' => ExpressionType.Subtract, + '/' => ExpressionType.Divide, + '*' => ExpressionType.Multiply, + '<' => ExpressionType.LessThan, + '>' => ExpressionType.MoreThan, + '%' => ExpressionType.Remainder + }; + } + else + return false; + + return true; + } + + + struct ExpressionOperatorGroup + { + private List _expressions; + private List _operators; + private Expression? _first; + + public bool NotEmpty => !Empty; + public bool Empty => _expressions == null && _first == null; + + public void AppendFirst(Expression expr) + { + if (NotEmpty) + throw new InvalidOperationException(); + _first = expr; + } + + public void AppendWithOperator(Expression expr, ExpressionType op) + { + if (_expressions == null) + { + if (_first == null) + throw new InvalidOperationException(); + _expressions = new List(); + _expressions.Add(_first); + _first = null; + _operators = new List(); + } + _expressions.Add(expr); + _operators.Add(op); + } + + // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/ + private static readonly ExpressionType[][] OperatorPrecedenceGroups = new[] + { + // multiplicative + new[] {ExpressionType.Multiply, ExpressionType.Divide, ExpressionType.Remainder}, + // additive + new[] {ExpressionType.Add, ExpressionType.Subtract}, + // relational + new[] {ExpressionType.MoreThan, ExpressionType.MoreThanOrEqual, ExpressionType.LessThan, ExpressionType.LessThanOrEqual}, + // equality + new[] {ExpressionType.Equals, ExpressionType.NotEquals}, + // conditional AND + new[] {ExpressionType.LogicalAnd}, + // conditional OR + new[]{ ExpressionType.LogicalOr}, + }; + + private static readonly ExpressionType[][] OperatorPrecedenceGroupsReversed = + OperatorPrecedenceGroups.Reverse().ToArray(); + + // a*b+c [a,b,c] [*,+], call with (0, 2) + // ToExpression(a*b) + ToExpression(c) + // a+b*c -> ToExpression(a) + ToExpression(b*c) + Expression ToExpression(int from, int to) + { + if (to - from == 0) + return _expressions[from]; + + if (to - from == 1) + return new BinaryExpression(_expressions[from], _expressions[to], _operators[from]); + + foreach (var grp in OperatorPrecedenceGroupsReversed) + { + for (var c = from; c < to; c++) + { + var currentOperator = _operators[c]; + foreach(var operatorFromGroup in grp) + if (currentOperator == operatorFromGroup) + { + // We are dividing the expression right here + var left = ToExpression(from, c); + var right = ToExpression(c + 1, to); + return new BinaryExpression(left, right, currentOperator); + } + } + } + + // We shouldn't ever get here, if we are, there is something wrong in the code + throw new ExpressionParseException("Expression parsing algorithm bug in ToExpression", 0); + } + + public Expression ToExpression() + { + if (_expressions == null) + return _first ?? throw new InvalidOperationException(); + return ToExpression(0, _expressions.Count - 1); + } + } + + static Expression ParseTillTerminator(ref TokenParser parser, string terminatorChars, + bool throwOnTerminator, + bool throwOnEnd, + out char? token) + { + ExpressionOperatorGroup left = default; + token = null; + while (true) + { + if (parser.TryConsumeAny(terminatorChars.AsSpan(), out var consumedToken)) + { + if (throwOnTerminator || left.Empty) + throw new ExpressionParseException($"Unexpected '{token}'", parser.Position - 1); + token = consumedToken; + return left.ToExpression(); + } + parser.SkipWhitespace(); + if (parser.Length == 0) + { + if (throwOnEnd || left.Empty) + throw new ExpressionParseException("Unexpected end of expression", parser.Position); + return left.ToExpression(); + } + + ExpressionType? op = null; + if (left.NotEmpty) + { + if (parser.TryConsume('?')) + { + var truePart = ParseTillTerminator(ref parser, ":", + false, true, out _); + // pass through the current parsing rules to consume the rest + var falsePart = ParseTillTerminator(ref parser, terminatorChars, throwOnTerminator, throwOnEnd, + out token); + + return new ConditionalExpression(left.ToExpression(), truePart, falsePart); + } + + // We expect a binary operator here + if (!TryParseOperator(ref parser, out var sop)) + throw new ExpressionParseException("Unexpected token", parser.Position); + op = sop; + } + + // We expect an expression to be parsed (either due to expecting a binary operator or parsing the first part + var applyNegation = false; + while (parser.TryConsume('!')) + applyNegation = !applyNegation; + + var applyUnaryMinus = false; + while (parser.TryConsume('-')) + applyUnaryMinus = !applyUnaryMinus; + + Expression? parsed; + + if (parser.TryConsume('(')) + parsed = ParseTillTerminator(ref parser, ")", false, true, out _); + else if (parser.TryParseCall(out var functionName)) + { + var parameterList = new List(); + while (true) + { + parameterList.Add(ParseTillTerminator(ref parser, ",)", false, true, out var closingToken)); + if (closingToken == ')') + break; + if (closingToken != ',') + throw new ExpressionParseException("Unexpected end of the expression", parser.Position); + } + + parsed = new FunctionCallExpression(functionName.ToString(), parameterList); + } + else if (TryParseAtomic(ref parser, out parsed)) + { + // do nothing + } + else + throw new ExpressionParseException("Unexpected token", parser.Position); + + + // Parse any following member accesses + while (parser.TryConsume('.')) + { + if(!parser.TryParseIdentifier(out var memberName)) + throw new ExpressionParseException("Unexpected token", parser.Position); + + parsed = new MemberAccessExpression(parsed, memberName.ToString()); + } + + // Apply ! operator + if (applyNegation) + parsed = new UnaryExpression(parsed, ExpressionType.Not); + + if (applyUnaryMinus) + { + if(parsed is ConstantExpression constexpr) + parsed = new ConstantExpression(-constexpr.Constant); + else parsed = new UnaryExpression(parsed, ExpressionType.UnaryMinus); + } + + if (left.Empty) + left.AppendFirst(parsed); + else + left.AppendWithOperator(parsed, op!.Value); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs new file mode 100644 index 0000000000..8c6af5cb0c --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs @@ -0,0 +1,739 @@ +using System; +using System.Globalization; +using System.Numerics; +using System.Runtime.InteropServices; +using Avalonia.Media; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal enum VariantType + { + Invalid, + Boolean, + Scalar, + Double, + Vector2, + Vector3, + Vector4, + AvaloniaMatrix, + Matrix3x2, + Matrix4x4, + Quaternion, + Color + } + + [StructLayout(LayoutKind.Explicit)] + internal struct ExpressionVariant + { + [FieldOffset(0)] public VariantType Type; + + [FieldOffset(4)] public bool Boolean; + [FieldOffset(4)] public float Scalar; + [FieldOffset(4)] public double Double; + [FieldOffset(4)] public Vector2 Vector2; + [FieldOffset(4)] public Vector3 Vector3; + [FieldOffset(4)] public Vector4 Vector4; + [FieldOffset(4)] public Matrix AvaloniaMatrix; + [FieldOffset(4)] public Matrix3x2 Matrix3x2; + [FieldOffset(4)] public Matrix4x4 Matrix4x4; + [FieldOffset(4)] public Quaternion Quaternion; + [FieldOffset(4)] public Color Color; + + + public ExpressionVariant GetProperty(string property) + { + if (Type == VariantType.Vector2) + { + if (ReferenceEquals(property, "X")) + return Vector2.X; + if (ReferenceEquals(property, "Y")) + return Vector2.Y; + return default; + } + + if (Type == VariantType.Vector3) + { + if (ReferenceEquals(property, "X")) + return Vector3.X; + if (ReferenceEquals(property, "Y")) + return Vector3.Y; + if (ReferenceEquals(property, "Z")) + return Vector3.Z; + if(ReferenceEquals(property, "XY")) + return new Vector2(Vector3.X, Vector3.Y); + if(ReferenceEquals(property, "YX")) + return new Vector2(Vector3.Y, Vector3.X); + if(ReferenceEquals(property, "XZ")) + return new Vector2(Vector3.X, Vector3.Z); + if(ReferenceEquals(property, "ZX")) + return new Vector2(Vector3.Z, Vector3.X); + if(ReferenceEquals(property, "YZ")) + return new Vector2(Vector3.Y, Vector3.Z); + if(ReferenceEquals(property, "ZY")) + return new Vector2(Vector3.Z, Vector3.Y); + return default; + } + + if (Type == VariantType.Vector4) + { + if (ReferenceEquals(property, "X")) + return Vector4.X; + if (ReferenceEquals(property, "Y")) + return Vector4.Y; + if (ReferenceEquals(property, "Z")) + return Vector4.Z; + if (ReferenceEquals(property, "W")) + return Vector4.W; + return default; + } + + if (Type == VariantType.Matrix3x2) + { + if (ReferenceEquals(property, "M11")) + return Matrix3x2.M11; + if (ReferenceEquals(property, "M12")) + return Matrix3x2.M12; + if (ReferenceEquals(property, "M21")) + return Matrix3x2.M21; + if (ReferenceEquals(property, "M22")) + return Matrix3x2.M22; + if (ReferenceEquals(property, "M31")) + return Matrix3x2.M31; + if (ReferenceEquals(property, "M32")) + return Matrix3x2.M32; + return default; + } + + if (Type == VariantType.AvaloniaMatrix) + { + if (ReferenceEquals(property, "M11")) + return AvaloniaMatrix.M11; + if (ReferenceEquals(property, "M12")) + return AvaloniaMatrix.M12; + if (ReferenceEquals(property, "M21")) + return AvaloniaMatrix.M21; + if (ReferenceEquals(property, "M22")) + return AvaloniaMatrix.M22; + if (ReferenceEquals(property, "M31")) + return AvaloniaMatrix.M31; + if (ReferenceEquals(property, "M32")) + return AvaloniaMatrix.M32; + return default; + } + + if (Type == VariantType.Matrix4x4) + { + if (ReferenceEquals(property, "M11")) + return Matrix4x4.M11; + if (ReferenceEquals(property, "M12")) + return Matrix4x4.M12; + if (ReferenceEquals(property, "M13")) + return Matrix4x4.M13; + if (ReferenceEquals(property, "M14")) + return Matrix4x4.M14; + if (ReferenceEquals(property, "M21")) + return Matrix4x4.M21; + if (ReferenceEquals(property, "M22")) + return Matrix4x4.M22; + if (ReferenceEquals(property, "M23")) + return Matrix4x4.M23; + if (ReferenceEquals(property, "M24")) + return Matrix4x4.M24; + if (ReferenceEquals(property, "M31")) + return Matrix4x4.M31; + if (ReferenceEquals(property, "M32")) + return Matrix4x4.M32; + if (ReferenceEquals(property, "M33")) + return Matrix4x4.M33; + if (ReferenceEquals(property, "M34")) + return Matrix4x4.M34; + if (ReferenceEquals(property, "M41")) + return Matrix4x4.M41; + if (ReferenceEquals(property, "M42")) + return Matrix4x4.M42; + if (ReferenceEquals(property, "M43")) + return Matrix4x4.M43; + if (ReferenceEquals(property, "M44")) + return Matrix4x4.M44; + return default; + } + + if (Type == VariantType.Quaternion) + { + if (ReferenceEquals(property, "X")) + return Quaternion.X; + if (ReferenceEquals(property, "Y")) + return Quaternion.Y; + if (ReferenceEquals(property, "Z")) + return Quaternion.Z; + if (ReferenceEquals(property, "W")) + return Quaternion.W; + return default; + } + + if (Type == VariantType.Color) + { + if (ReferenceEquals(property, "A")) + return Color.A; + if (ReferenceEquals(property, "R")) + return Color.R; + if (ReferenceEquals(property, "G")) + return Color.G; + if (ReferenceEquals(property, "B")) + return Color.B; + return default; + } + + return default; + } + + public static implicit operator ExpressionVariant(bool value) => + new ExpressionVariant + { + Type = VariantType.Boolean, + Boolean = value + }; + + public static implicit operator ExpressionVariant(float scalar) => + new ExpressionVariant + { + Type = VariantType.Scalar, + Scalar = scalar + }; + + public static implicit operator ExpressionVariant(double d) => + new ExpressionVariant + { + Type = VariantType.Double, + Double = d + }; + + + public static implicit operator ExpressionVariant(Vector2 value) => + new ExpressionVariant + { + Type = VariantType.Vector2, + Vector2 = value + }; + + + public static implicit operator ExpressionVariant(Vector3 value) => + new ExpressionVariant + { + Type = VariantType.Vector3, + Vector3 = value + }; + + + public static implicit operator ExpressionVariant(Vector4 value) => + new ExpressionVariant + { + Type = VariantType.Vector4, + Vector4 = value + }; + + public static implicit operator ExpressionVariant(Matrix3x2 value) => + new ExpressionVariant + { + Type = VariantType.Matrix3x2, + Matrix3x2 = value + }; + + public static implicit operator ExpressionVariant(Matrix value) => + new ExpressionVariant + { + Type = VariantType.Matrix3x2, + AvaloniaMatrix = value + }; + + public static implicit operator ExpressionVariant(Matrix4x4 value) => + new ExpressionVariant + { + Type = VariantType.Matrix4x4, + Matrix4x4 = value + }; + + public static implicit operator ExpressionVariant(Quaternion value) => + new ExpressionVariant + { + Type = VariantType.Quaternion, + Quaternion = value + }; + + public static implicit operator ExpressionVariant(Avalonia.Media.Color value) => + new ExpressionVariant + { + Type = VariantType.Color, + Color = value + }; + + public static ExpressionVariant operator +(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type != right.Type || left.Type == VariantType.Invalid) + return default; + + if (left.Type == VariantType.Scalar) + return left.Scalar + right.Scalar; + + if (left.Type == VariantType.Double) + return left.Double + right.Double; + + if (left.Type == VariantType.Vector2) + return left.Vector2 + right.Vector2; + + if (left.Type == VariantType.Vector3) + return left.Vector3 + right.Vector3; + + if (left.Type == VariantType.Vector4) + return left.Vector4 + right.Vector4; + + if (left.Type == VariantType.Matrix3x2) + return left.Matrix3x2 + right.Matrix3x2; + + if (left.Type == VariantType.AvaloniaMatrix) + return left.AvaloniaMatrix + right.AvaloniaMatrix; + + if (left.Type == VariantType.Matrix4x4) + return left.Matrix4x4 + right.Matrix4x4; + + if (left.Type == VariantType.Quaternion) + return left.Quaternion + right.Quaternion; + + return default; + } + + public static ExpressionVariant operator -(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type != right.Type || left.Type == VariantType.Invalid) + return default; + + if (left.Type == VariantType.Scalar) + return left.Scalar - right.Scalar; + + if (left.Type == VariantType.Double) + return left.Double - right.Double; + + if (left.Type == VariantType.Vector2) + return left.Vector2 - right.Vector2; + + if (left.Type == VariantType.Vector3) + return left.Vector3 - right.Vector3; + + if (left.Type == VariantType.Vector4) + return left.Vector4 - right.Vector4; + + if (left.Type == VariantType.Matrix3x2) + return left.Matrix3x2 - right.Matrix3x2; + + if (left.Type == VariantType.AvaloniaMatrix) + return left.AvaloniaMatrix - right.AvaloniaMatrix; + + if (left.Type == VariantType.Matrix4x4) + return left.Matrix4x4 - right.Matrix4x4; + + if (left.Type == VariantType.Quaternion) + return left.Quaternion - right.Quaternion; + + return default; + } + + public static ExpressionVariant operator -(ExpressionVariant left) + { + + if (left.Type == VariantType.Scalar) + return -left.Scalar; + + if (left.Type == VariantType.Double) + return -left.Double; + + if (left.Type == VariantType.Vector2) + return -left.Vector2; + + if (left.Type == VariantType.Vector3) + return -left.Vector3; + + if (left.Type == VariantType.Vector4) + return -left.Vector4; + + if (left.Type == VariantType.Matrix3x2) + return -left.Matrix3x2; + + if (left.Type == VariantType.AvaloniaMatrix) + return -left.AvaloniaMatrix; + + if (left.Type == VariantType.Matrix4x4) + return -left.Matrix4x4; + + if (left.Type == VariantType.Quaternion) + return -left.Quaternion; + + return default; + } + + public static ExpressionVariant operator *(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type == VariantType.Invalid || right.Type == VariantType.Invalid) + return default; + + if (left.Type == VariantType.Scalar && right.Type == VariantType.Scalar) + return left.Scalar * right.Scalar; + + if (left.Type == VariantType.Double && right.Type == VariantType.Double) + return left.Double * right.Double; + + if (left.Type == VariantType.Vector2 && right.Type == VariantType.Vector2) + return left.Vector2 * right.Vector2; + + if (left.Type == VariantType.Vector2 && right.Type == VariantType.Scalar) + return left.Vector2 * right.Scalar; + + if (left.Type == VariantType.Vector3 && right.Type == VariantType.Vector3) + return left.Vector3 * right.Vector3; + + if (left.Type == VariantType.Vector3 && right.Type == VariantType.Scalar) + return left.Vector3 * right.Scalar; + + if (left.Type == VariantType.Vector4 && right.Type == VariantType.Vector4) + return left.Vector4 * right.Vector4; + + if (left.Type == VariantType.Vector4 && right.Type == VariantType.Scalar) + return left.Vector4 * right.Scalar; + + if (left.Type == VariantType.Matrix3x2 && right.Type == VariantType.Matrix3x2) + return left.Matrix3x2 * right.Matrix3x2; + + if (left.Type == VariantType.Matrix3x2 && right.Type == VariantType.Scalar) + return left.Matrix3x2 * right.Scalar; + + if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.AvaloniaMatrix) + return left.AvaloniaMatrix * right.AvaloniaMatrix; + + if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.Scalar) + return left.AvaloniaMatrix * (double)right.Scalar; + + if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.Double) + return left.AvaloniaMatrix * right.Double; + + if (left.Type == VariantType.Matrix4x4 && right.Type == VariantType.Matrix4x4) + return left.Matrix4x4 * right.Matrix4x4; + + if (left.Type == VariantType.Matrix4x4 && right.Type == VariantType.Scalar) + return left.Matrix4x4 * right.Scalar; + + if (left.Type == VariantType.Quaternion && right.Type == VariantType.Quaternion) + return left.Quaternion * right.Quaternion; + + if (left.Type == VariantType.Quaternion && right.Type == VariantType.Scalar) + return left.Quaternion * right.Scalar; + + return default; + } + + public static ExpressionVariant operator /(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type == VariantType.Invalid || right.Type == VariantType.Invalid) + return default; + + if (left.Type == VariantType.Scalar && right.Type == VariantType.Scalar) + return left.Scalar / right.Scalar; + + if (left.Type == VariantType.Double && right.Type == VariantType.Double) + return left.Double / right.Double; + + if (left.Type == VariantType.Vector2 && right.Type == VariantType.Vector2) + return left.Vector2 / right.Vector2; + + if (left.Type == VariantType.Vector2 && right.Type == VariantType.Scalar) + return left.Vector2 / right.Scalar; + + if (left.Type == VariantType.Vector3 && right.Type == VariantType.Vector3) + return left.Vector3 / right.Vector3; + + if (left.Type == VariantType.Vector3 && right.Type == VariantType.Scalar) + return left.Vector3 / right.Scalar; + + if (left.Type == VariantType.Vector4 && right.Type == VariantType.Vector4) + return left.Vector4 / right.Vector4; + + if (left.Type == VariantType.Vector4 && right.Type == VariantType.Scalar) + return left.Vector4 / right.Scalar; + + if (left.Type == VariantType.Quaternion && right.Type == VariantType.Quaternion) + return left.Quaternion / right.Quaternion; + + return default; + } + + public ExpressionVariant EqualsTo(ExpressionVariant right) + { + if (Type != right.Type || Type == VariantType.Invalid) + return default; + + if (Type == VariantType.Scalar) + return Scalar == right.Scalar; + + + if (Type == VariantType.Double) + return Double == right.Double; + + if (Type == VariantType.Vector2) + return Vector2 == right.Vector2; + + if (Type == VariantType.Vector3) + return Vector3 == right.Vector3; + + if (Type == VariantType.Vector4) + return Vector4 == right.Vector4; + + if (Type == VariantType.Boolean) + return Boolean == right.Boolean; + + if (Type == VariantType.Matrix3x2) + return Matrix3x2 == right.Matrix3x2; + + if (Type == VariantType.AvaloniaMatrix) + return AvaloniaMatrix == right.AvaloniaMatrix; + + if (Type == VariantType.Matrix4x4) + return Matrix4x4 == right.Matrix4x4; + + if (Type == VariantType.Quaternion) + return Quaternion == right.Quaternion; + + return default; + } + + public ExpressionVariant NotEqualsTo(ExpressionVariant right) + { + var r = EqualsTo(right); + if (r.Type == VariantType.Boolean) + return !r.Boolean; + return default; + } + + public static ExpressionVariant operator !(ExpressionVariant v) + { + if (v.Type == VariantType.Boolean) + return !v.Boolean; + return default; + } + + public static ExpressionVariant operator %(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type == VariantType.Scalar && right.Type == VariantType.Scalar) + return left.Scalar % right.Scalar; + if (left.Type == VariantType.Double && right.Type == VariantType.Double) + return left.Double % right.Double; + return default; + } + + public static ExpressionVariant operator <(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type == VariantType.Scalar && right.Type == VariantType.Scalar) + return left.Scalar < right.Scalar; + if (left.Type == VariantType.Double && right.Type == VariantType.Double) + return left.Double < right.Double; + return default; + } + + public static ExpressionVariant operator >(ExpressionVariant left, ExpressionVariant right) + { + if (left.Type == VariantType.Scalar && right.Type == VariantType.Scalar) + return left.Scalar > right.Scalar; + + if (left.Type == VariantType.Double && right.Type == VariantType.Double) + return left.Double > right.Double; + return default; + } + + public ExpressionVariant And(ExpressionVariant right) + { + if (Type == VariantType.Boolean && right.Type == VariantType.Boolean) + return Boolean && right.Boolean; + return default; + } + + public ExpressionVariant Or(ExpressionVariant right) + { + if (Type == VariantType.Boolean && right.Type == VariantType.Boolean) + return Boolean && right.Boolean; + return default; + } + + public bool TryCast(out T res) where T : struct + { + if (typeof(T) == typeof(bool)) + { + if (Type == VariantType.Boolean) + { + res = (T) (object) Boolean; + return true; + } + } + + if (typeof(T) == typeof(float)) + { + if (Type == VariantType.Scalar) + { + res = (T) (object) Scalar; + return true; + } + } + + if (typeof(T) == typeof(double)) + { + if (Type == VariantType.Double) + { + res = (T) (object) Double; + return true; + } + } + + if (typeof(T) == typeof(Vector2)) + { + if (Type == VariantType.Vector2) + { + res = (T) (object) Vector2; + return true; + } + } + + if (typeof(T) == typeof(Vector3)) + { + if (Type == VariantType.Vector3) + { + res = (T) (object) Vector3; + return true; + } + } + + if (typeof(T) == typeof(Vector4)) + { + if (Type == VariantType.Vector4) + { + res = (T) (object) Vector4; + return true; + } + } + + if (typeof(T) == typeof(Matrix3x2)) + { + if (Type == VariantType.Matrix3x2) + { + res = (T) (object) Matrix3x2; + return true; + } + } + + if (typeof(T) == typeof(Matrix)) + { + if (Type == VariantType.AvaloniaMatrix) + { + res = (T) (object) Matrix3x2; + return true; + } + } + + if (typeof(T) == typeof(Matrix4x4)) + { + if (Type == VariantType.Matrix4x4) + { + res = (T) (object) Matrix4x4; + return true; + } + } + + if (typeof(T) == typeof(Quaternion)) + { + if (Type == VariantType.Quaternion) + { + res = (T) (object) Quaternion; + return true; + } + } + + if (typeof(T) == typeof(Avalonia.Media.Color)) + { + if (Type == VariantType.Color) + { + res = (T) (object) Color; + return true; + } + } + + res = default(T); + return false; + } + + public static ExpressionVariant Create(T v) where T : struct + { + if (typeof(T) == typeof(bool)) + return (bool) (object) v; + + if (typeof(T) == typeof(float)) + return (float) (object) v; + + if (typeof(T) == typeof(Vector2)) + return (Vector2) (object) v; + + if (typeof(T) == typeof(Vector3)) + return (Vector3) (object) v; + + if (typeof(T) == typeof(Vector4)) + return (Vector4) (object) v; + + if (typeof(T) == typeof(Matrix3x2)) + return (Matrix3x2) (object) v; + + if (typeof(T) == typeof(Matrix)) + return (Matrix) (object) v; + + if (typeof(T) == typeof(Matrix4x4)) + return (Matrix4x4) (object) v; + + if (typeof(T) == typeof(Quaternion)) + return (Quaternion) (object) v; + + if (typeof(T) == typeof(Avalonia.Media.Color)) + return (Avalonia.Media.Color) (object) v; + + throw new ArgumentException("Invalid variant type: " + typeof(T)); + } + + public T CastOrDefault() where T : struct + { + TryCast(out var r); + return r; + } + + public override string ToString() + { + if (Type == VariantType.Boolean) + return Boolean.ToString(); + if (Type == VariantType.Scalar) + return Scalar.ToString(CultureInfo.InvariantCulture); + if (Type == VariantType.Double) + return Double.ToString(CultureInfo.InvariantCulture); + if (Type == VariantType.Vector2) + return Vector2.ToString(); + if (Type == VariantType.Vector3) + return Vector3.ToString(); + if (Type == VariantType.Vector4) + return Vector4.ToString(); + if (Type == VariantType.Quaternion) + return Quaternion.ToString(); + if (Type == VariantType.Matrix3x2) + return Matrix3x2.ToString(); + if (Type == VariantType.AvaloniaMatrix) + return AvaloniaMatrix.ToString(); + if (Type == VariantType.Matrix4x4) + return Matrix4x4.ToString(); + if (Type == VariantType.Color) + return Color.ToString(); + if (Type == VariantType.Invalid) + return "Invalid"; + return "Unknown"; + } + } + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/TokenParser.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/TokenParser.cs new file mode 100644 index 0000000000..1050c7274c --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/TokenParser.cs @@ -0,0 +1,256 @@ +using System; +using System.Globalization; + +namespace Avalonia.Rendering.Composition.Expressions +{ + internal ref struct TokenParser + { + private ReadOnlySpan _s; + public int Position { get; private set; } + public TokenParser(ReadOnlySpan s) + { + _s = s; + Position = 0; + } + + public void SkipWhitespace() + { + while (true) + { + if (_s.Length > 0 && char.IsWhiteSpace(_s[0])) + Advance(1); + else + return; + } + } + + static bool IsAlphaNumeric(char ch) => (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z'); + + public bool TryConsume(char c) + { + SkipWhitespace(); + if (_s.Length == 0 || _s[0] != c) + return false; + + Advance(1); + return true; + } + public bool TryConsume(string s) + { + SkipWhitespace(); + if (_s.Length < s.Length) + return false; + for (var c = 0; c < s.Length; c++) + { + if (_s[c] != s[c]) + return false; + } + + Advance(s.Length); + return true; + } + + public bool TryConsumeAny(ReadOnlySpan chars, out char token) + { + SkipWhitespace(); + token = default; + if (_s.Length == 0) + return false; + + foreach (var c in chars) + { + if (c == _s[0]) + { + token = c; + Advance(1); + return true; + } + } + + return false; + } + + + public bool TryParseKeyword(string keyword) + { + SkipWhitespace(); + if (keyword.Length > _s.Length) + return false; + for(var c=0; c keyword.Length && IsAlphaNumeric(_s[keyword.Length])) + return false; + + Advance(keyword.Length); + return true; + } + + public bool TryParseKeywordLowerCase(string keywordInLowerCase) + { + SkipWhitespace(); + if (keywordInLowerCase.Length > _s.Length) + return false; + for(var c=0; c keywordInLowerCase.Length && IsAlphaNumeric(_s[keywordInLowerCase.Length])) + return false; + + Advance(keywordInLowerCase.Length); + return true; + } + + public void Advance(int c) + { + _s = _s.Slice(c); + Position += c; + } + + public int Length => _s.Length; + + public bool TryParseIdentifier(ReadOnlySpan extraValidChars, out ReadOnlySpan res) + { + res = ReadOnlySpan.Empty; + SkipWhitespace(); + if (_s.Length == 0) + return false; + var first = _s[0]; + if (!((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z'))) + return false; + int len = 1; + for (var c = 1; c < _s.Length; c++) + { + var ch = _s[c]; + if (IsAlphaNumeric(ch)) + len++; + else + { + var found = false; + foreach(var vc in extraValidChars) + if (vc == ch) + { + found = true; + break; + } + + if (found) + len++; + else + break; + } + } + + res = _s.Slice(0, len); + Advance(len); + return true; + } + + public bool TryParseIdentifier(out ReadOnlySpan res) + { + res = ReadOnlySpan.Empty; + SkipWhitespace(); + if (_s.Length == 0) + return false; + var first = _s[0]; + if (!((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z'))) + return false; + int len = 1; + for (var c = 1; c < _s.Length; c++) + { + var ch = _s[c]; + if (IsAlphaNumeric(ch)) + len++; + else + break; + } + + res = _s.Slice(0, len); + Advance(len); + return true; + } + + public bool TryParseCall(out ReadOnlySpan res) + { + res = ReadOnlySpan.Empty; + SkipWhitespace(); + if (_s.Length == 0) + return false; + var first = _s[0]; + if (!((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z'))) + return false; + int len = 1; + for (var c = 1; c < _s.Length; c++) + { + var ch = _s[c]; + if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch<= 'Z') || ch == '.') + len++; + else + break; + } + + res = _s.Slice(0, len); + + // Find '(' + for (var c = len; c < _s.Length; c++) + { + if(char.IsWhiteSpace(_s[c])) + continue; + if(_s[c]=='(') + { + Advance(c + 1); + return true; + } + + return false; + + } + + return false; + + } + + + public bool TryParseFloat(out float res) + { + res = 0; + SkipWhitespace(); + if (_s.Length == 0) + return false; + + var len = 0; + var dotCount = 0; + for (var c = 0; c < _s.Length; c++) + { + var ch = _s[c]; + if (ch >= '0' && ch <= '9') + len = c + 1; + else if (ch == '.' && dotCount == 0) + { + len = c + 1; + dotCount++; + } + else + break; + } + + var span = _s.Slice(0, len); + +#if NETSTANDARD2_0 + if (!float.TryParse(span.ToString(), NumberStyles.Number, CultureInfo.InvariantCulture, out res)) + return false; +#else + if (!float.TryParse(span, NumberStyles.Number, CultureInfo.InvariantCulture, out res)) + return false; +#endif + Advance(len); + return true; + } + + public override string ToString() => _s.ToString(); + + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/ICompositionSurface.cs b/src/Avalonia.Base/Rendering/Composition/ICompositionSurface.cs new file mode 100644 index 0000000000..9ef31c30e0 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/ICompositionSurface.cs @@ -0,0 +1,9 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition +{ + public interface ICompositionSurface + { + internal ServerCompositionSurface Server { get; } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs b/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs new file mode 100644 index 0000000000..5e91bcb3d4 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs @@ -0,0 +1,46 @@ +using System.Numerics; + +namespace Avalonia.Rendering.Composition +{ + static class MatrixUtils + { + public static Matrix4x4 ComputeTransform(Vector2 size, Vector2 anchorPoint, Vector3 centerPoint, + Matrix4x4 transformMatrix, Vector3 scale, float rotationAngle, Quaternion orientation, Vector3 offset) + { + // The math here follows the *observed* UWP behavior since there are no docs on how it's supposed to work + + var anchor = size * anchorPoint; + var mat = Matrix4x4.CreateTranslation(-anchor.X, -anchor.Y, 0); + + var center = new Vector3(centerPoint.X, centerPoint.Y, centerPoint.Z); + + if (!transformMatrix.IsIdentity) + mat = transformMatrix * mat; + + + if (scale != new Vector3(1, 1, 1)) + mat *= Matrix4x4.CreateScale(scale, center); + + //TODO: RotationAxis support + if (rotationAngle != 0) + mat *= Matrix4x4.CreateRotationZ(rotationAngle, center); + + if (orientation != Quaternion.Identity) + { + if (centerPoint != default) + { + mat *= Matrix4x4.CreateTranslation(-center) + * Matrix4x4.CreateFromQuaternion(orientation) + * Matrix4x4.CreateTranslation(center); + } + else + mat *= Matrix4x4.CreateFromQuaternion(orientation); + } + + if (offset != default) + mat *= Matrix4x4.CreateTranslation(offset); + + return mat; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs new file mode 100644 index 0000000000..f5dfa92897 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs @@ -0,0 +1,142 @@ +using System.Numerics; +using Avalonia.Media; +using Avalonia.Media.Imaging; +using Avalonia.Platform; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Utilities; + +namespace Avalonia.Rendering.Composition.Server; + +internal class CompositorDrawingContextProxy : IDrawingContextImpl +{ + private IDrawingContextImpl _impl; + + public CompositorDrawingContextProxy(IDrawingContextImpl impl) + { + _impl = impl; + } + + public Matrix PreTransform { get; set; } = Matrix.Identity; + + public void Dispose() + { + _impl.Dispose(); + } + + Matrix _transform; + public Matrix Transform + { + get => _transform; + set => _impl.Transform = PreTransform * (_transform = value); + } + + public void Clear(Color color) + { + _impl.Clear(color); + } + + public void DrawBitmap(IRef source, double opacity, Rect sourceRect, Rect destRect, + BitmapInterpolationMode bitmapInterpolationMode = BitmapInterpolationMode.Default) + { + _impl.DrawBitmap(source, opacity, sourceRect, destRect, bitmapInterpolationMode); + } + + public void DrawBitmap(IRef source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect) + { + _impl.DrawBitmap(source, opacityMask, opacityMaskRect, destRect); + } + + public void DrawLine(IPen pen, Point p1, Point p2) + { + _impl.DrawLine(pen, p1, p2); + } + + public void DrawGeometry(IBrush? brush, IPen? pen, IGeometryImpl geometry) + { + _impl.DrawGeometry(brush, pen, geometry); + } + + public void DrawRectangle(IBrush? brush, IPen? pen, RoundedRect rect, BoxShadows boxShadows = default) + { + _impl.DrawRectangle(brush, pen, rect, boxShadows); + } + + public void DrawEllipse(IBrush? brush, IPen? pen, Rect rect) + { + _impl.DrawEllipse(brush, pen, rect); + } + + public void DrawGlyphRun(IBrush foreground, GlyphRun glyphRun) + { + _impl.DrawGlyphRun(foreground, glyphRun); + } + + public IDrawingContextLayerImpl CreateLayer(Size size) + { + return _impl.CreateLayer(size); + } + + public void PushClip(Rect clip) + { + _impl.PushClip(clip); + } + + public void PushClip(RoundedRect clip) + { + _impl.PushClip(clip); + } + + public void PopClip() + { + _impl.PopClip(); + } + + public void PushOpacity(double opacity) + { + _impl.PushOpacity(opacity); + } + + public void PopOpacity() + { + _impl.PopOpacity(); + } + + public void PushOpacityMask(IBrush mask, Rect bounds) + { + _impl.PushOpacityMask(mask, bounds); + } + + public void PopOpacityMask() + { + _impl.PopOpacityMask(); + } + + public void PushGeometryClip(IGeometryImpl clip) + { + _impl.PushGeometryClip(clip); + } + + public void PopGeometryClip() + { + _impl.PopGeometryClip(); + } + + public void PushBitmapBlendMode(BitmapBlendingMode blendingMode) + { + _impl.PushBitmapBlendMode(blendingMode); + } + + public void PopBitmapBlendMode() + { + _impl.PopBitmapBlendMode(); + } + + public void Custom(ICustomDrawOperation custom) + { + _impl.Custom(custom); + } + + public Matrix CutTransform(Matrix4x4 transform) => new Matrix(transform.M11, transform.M12, transform.M21, + transform.M22, transform.M41, + transform.M42); +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs b/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs new file mode 100644 index 0000000000..372fa4d9ce --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs @@ -0,0 +1,46 @@ +namespace Avalonia.Rendering.Composition.Server +{ + internal class ReadbackIndices + { + private readonly object _lock = new object(); + public int ReadIndex { get; private set; } = 0; + public int WriteIndex { get; private set; } = -1; + public ulong ReadRevision { get; private set; } + public ulong WriteRevision { get; private set; } + private ulong[] _revisions = new ulong[3]; + + + public void NextRead() + { + lock (_lock) + { + for (var c = 0; c < 3; c++) + { + if (c != WriteIndex && c != ReadIndex && _revisions[c] > ReadRevision) + { + ReadIndex = c; + ReadRevision = _revisions[c]; + return; + } + } + } + } + + public void NextWrite(ulong revision) + { + lock (_lock) + { + for (var c = 0; c < 3; c++) + { + if (c != WriteIndex && c != ReadIndex) + { + WriteIndex = c; + WriteRevision = revision; + _revisions[c] = revision; + return; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionBrush.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionBrush.cs new file mode 100644 index 0000000000..eb041aaf88 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionBrush.cs @@ -0,0 +1,7 @@ +namespace Avalonia.Rendering.Composition.Server +{ + internal abstract partial class ServerCompositionBrush : ServerObject + { + + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs new file mode 100644 index 0000000000..397c968d04 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs @@ -0,0 +1,41 @@ +using System.Numerics; +using Avalonia.Collections.Pooled; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Drawing; +using Avalonia.Rendering.Composition.Transport; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Utilities; + +namespace Avalonia.Rendering.Composition.Server; + +internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisual +{ + private CompositionDrawList? _renderCommands; + + public ServerCompositionDrawListVisual(ServerCompositor compositor) : base(compositor) + { + } + + protected override void ApplyCore(ChangeSet changes) + { + var ch = (DrawListVisualChanges)changes; + if (ch.DrawCommandsIsSet) + { + _renderCommands?.Dispose(); + _renderCommands = ch.AcquireDrawCommands(); + } + base.ApplyCore(changes); + } + + protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + if (_renderCommands != null) + { + foreach (var cmd in _renderCommands) + { + cmd.Item.Render(canvas); + } + } + base.RenderCore(canvas, transform); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionGradientBrush.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionGradientBrush.cs new file mode 100644 index 0000000000..0948b9692f --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionGradientBrush.cs @@ -0,0 +1,15 @@ +using System; + +namespace Avalonia.Rendering.Composition.Server +{ + internal abstract partial class ServerCompositionGradientBrush : ServerCompositionBrush + { + public ServerCompositionGradientStopCollection Stops { get; } + public ServerCompositionGradientBrush(ServerCompositor compositor) : base(compositor) + { + Stops = new ServerCompositionGradientStopCollection(compositor); + } + + public override long LastChangedBy => Math.Max(base.LastChangedBy, (long)Stops.LastChangedBy); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs new file mode 100644 index 0000000000..c421cdcfb0 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs @@ -0,0 +1,22 @@ +using Avalonia.Media; + +namespace Avalonia.Rendering.Composition.Server +{ + internal partial class ServerCompositionLinearGradientBrush + { + /* + protected override void UpdateBackendBrush(ICbBrush brush) + { + var stopColors = new Color[Stops.List.Count]; + var offsets = new float[Stops.List.Count]; + for (var c = 0; c < Stops.List.Count; c++) + { + stopColors[c] = Stops.List[c].Color; + offsets[c] = Stops.List[c].Offset; + } + + ((ICbLinearGradientBrush) brush).Update(StartPoint, EndPoint, stopColors, offsets, ExtendMode); + }*/ + + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionSurface.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionSurface.cs new file mode 100644 index 0000000000..462a193a86 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionSurface.cs @@ -0,0 +1,9 @@ +namespace Avalonia.Rendering.Composition.Server +{ + internal abstract class ServerCompositionSurface : ServerObject + { + protected ServerCompositionSurface(ServerCompositor compositor) : base(compositor) + { + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs new file mode 100644 index 0000000000..493529e111 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -0,0 +1,53 @@ +using System; +using System.Numerics; +using System.Threading; +using Avalonia.Media; +using Avalonia.Platform; + +namespace Avalonia.Rendering.Composition.Server +{ + internal partial class ServerCompositionTarget + { + private readonly ServerCompositor _compositor; + private readonly Func _renderTargetFactory; + private static long s_nextId = 1; + public long Id { get; } + private ulong _frame = 1; + private IRenderTarget? _renderTarget; + + public ReadbackIndices Readback { get; } = new(); + + public ServerCompositionTarget(ServerCompositor compositor, Func renderTargetFactory) : + base(compositor) + { + _compositor = compositor; + _renderTargetFactory = renderTargetFactory; + Id = Interlocked.Increment(ref s_nextId); + } + + partial void OnIsEnabledChanged() + { + if (IsEnabled) + _compositor.AddCompositionTarget(this); + else + _compositor.RemoveCompositionTarget(this); + } + + public void Render() + { + if (Root == null) + return; + _renderTarget ??= _renderTargetFactory(); + + Compositor.UpdateServerTime(); + using (var context = _renderTarget.CreateDrawingContext(null)) + { + context.Clear(Colors.Transparent); + Root.Render(new CompositorDrawingContextProxy(context), Root.CombinedTransformMatrix); + } + + Readback.NextWrite(_frame); + _frame++; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs new file mode 100644 index 0000000000..e56f85acdf --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Server +{ + internal class ServerCompositor : IRenderLoopTask + { + private readonly IRenderLoop _renderLoop; + private readonly Queue _batches = new Queue(); + public long LastBatchId { get; private set; } + public Stopwatch Clock { get; } = Stopwatch.StartNew(); + public TimeSpan ServerNow { get; private set; } + private List _activeTargets = new(); + + public ServerCompositor(IRenderLoop renderLoop) + { + _renderLoop = renderLoop; + _renderLoop.Add(this); + } + + public void EnqueueBatch(Batch batch) + { + lock (_batches) + _batches.Enqueue(batch); + } + + internal void UpdateServerTime() => ServerNow = Clock.Elapsed; + + List _reusableToCompleteList = new(); + void ApplyPendingBatches() + { + while (true) + { + Batch batch; + lock (_batches) + { + if(_batches.Count == 0) + break; + batch = _batches.Dequeue(); + } + + foreach (var change in batch.Changes) + { + if (change.Dispose) + { + //TODO + } + change.Target!.Apply(change); + change.Reset(); + } + + _reusableToCompleteList.Add(batch); + LastBatchId = batch.SequenceId; + } + } + + void CompletePendingBatches() + { + foreach(var batch in _reusableToCompleteList) + batch.Complete(); + _reusableToCompleteList.Clear(); + } + + bool IRenderLoopTask.NeedsUpdate => false; + void IRenderLoopTask.Update(TimeSpan time) + { + } + + void IRenderLoopTask.Render() + { + ApplyPendingBatches(); + foreach (var t in _activeTargets) + t.Render(); + + CompletePendingBatches(); + } + + public void AddCompositionTarget(ServerCompositionTarget target) + { + _activeTargets.Add(target); + } + + public void RemoveCompositionTarget(ServerCompositionTarget target) + { + _activeTargets.Remove(target); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs new file mode 100644 index 0000000000..ac112b846f --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs @@ -0,0 +1,29 @@ +using System.Numerics; +using Avalonia.Platform; + +namespace Avalonia.Rendering.Composition.Server +{ + internal class ServerCompositionContainerVisual : ServerCompositionVisual + { + public ServerCompositionVisualCollection Children { get; } + + + protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + base.RenderCore(canvas, transform); + + foreach (var ch in Children) + { + var t = transform; + + t = ch.CombinedTransformMatrix * t; + ch.Render(canvas, t); + } + } + + public ServerCompositionContainerVisual(ServerCompositor compositor) : base(compositor) + { + Children = new ServerCompositionVisualCollection(compositor); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs new file mode 100644 index 0000000000..5f3eb051a4 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs @@ -0,0 +1,31 @@ +using System.Numerics; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Server +{ + class ServerCustomDrawVisual : ServerCompositionContainerVisual + { + private readonly ICustomDrawVisualRenderer _renderer; + private TData? _data; + public ServerCustomDrawVisual(ServerCompositor compositor, ICustomDrawVisualRenderer renderer) : base(compositor) + { + _renderer = renderer; + } + + protected override void ApplyCore(ChangeSet changes) + { + var c = (CustomDrawVisualChanges) changes; + if (c.Data.IsSet) + _data = c.Data.Value; + + base.ApplyCore(changes); + } + + protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + _renderer.Render(canvas, _data); + base.RenderCore(canvas, transform); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs new file mode 100644 index 0000000000..09ef119e6b --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Server +{ + class ServerList : ServerObject where T : ServerObject + { + public List List { get; } = new List(); + protected override void ApplyCore(ChangeSet changes) + { + var c = (ListChangeSet) changes; + if (c.HasListChanges) + { + foreach (var lc in c.ListChanges) + { + if(lc.Action == ListChangeAction.Clear) + List.Clear(); + if(lc.Action == ListChangeAction.RemoveAt) + List.RemoveAt(lc.Index); + if(lc.Action == ListChangeAction.InsertAt) + List.Insert(lc.Index, lc.Added!); + if (lc.Action == ListChangeAction.ReplaceAt) + List[lc.Index] = lc.Added!; + } + } + } + + public override long LastChangedBy + { + get + { + var seq = base.LastChangedBy; + foreach (var i in List) + seq = Math.Max(i.LastChangedBy, seq); + return seq; + } + } + + public List.Enumerator GetEnumerator() => List.GetEnumerator(); + + public ServerList(ServerCompositor compositor) : base(compositor) + { + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs new file mode 100644 index 0000000000..072377cd7e --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs @@ -0,0 +1,36 @@ +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Server +{ + internal abstract class ServerObject : IExpressionObject + { + public ServerCompositor Compositor { get; } + + public virtual long LastChangedBy => ItselfLastChangedBy; + public long ItselfLastChangedBy { get; private set; } + + public ServerObject(ServerCompositor compositor) + { + Compositor = compositor; + } + + protected virtual void ApplyCore(ChangeSet changes) + { + + } + + public void Apply(ChangeSet changes) + { + ApplyCore(changes); + ItselfLastChangedBy = changes.Batch!.SequenceId; + } + + public virtual ExpressionVariant GetPropertyForAnimation(string name) + { + return default; + } + + ExpressionVariant IExpressionObject.GetProperty(string name) => GetPropertyForAnimation(name); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs new file mode 100644 index 0000000000..60569867de --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs @@ -0,0 +1,16 @@ +using System.Numerics; +using Avalonia.Media.Immutable; +using Avalonia.Platform; + +namespace Avalonia.Rendering.Composition.Server +{ + internal partial class ServerCompositionSolidColorVisual + { + protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + canvas.Transform = canvas.CutTransform(transform); + canvas.DrawRectangle(new ImmutableSolidColorBrush(Color), null, new RoundedRect(new Rect(new Size(Size)))); + base.RenderCore(canvas, transform); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerSpriteVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerSpriteVisual.cs new file mode 100644 index 0000000000..c658dc8ae3 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerSpriteVisual.cs @@ -0,0 +1,20 @@ +using System.Numerics; +using Avalonia.Platform; + +namespace Avalonia.Rendering.Composition.Server +{ + internal partial class ServerCompositionSpriteVisual + { + + protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + if (Brush != null) + { + //SetTransform(canvas, transform); + //canvas.FillRect((Vector2)Size, (ICbBrush)Brush.Brush!); + } + + base.RenderCore(canvas, transform); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs new file mode 100644 index 0000000000..37e188fb47 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -0,0 +1,92 @@ +using System.Numerics; +using Avalonia.Platform; +using Avalonia.Rendering.Composition.Transport; + +namespace Avalonia.Rendering.Composition.Server +{ + unsafe partial class ServerCompositionVisual : ServerObject + { + protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + + } + + public void Render(CompositorDrawingContextProxy canvas, Matrix4x4 transform) + { + if(Visible == false) + return; + if(Opacity == 0) + return; + canvas.PreTransform = canvas.CutTransform(transform); + canvas.Transform = Matrix.Identity; + if (Opacity != 1) + canvas.PushOpacity(Opacity); + if(ClipToBounds) + canvas.PushClip(new Rect(new Size(Size.X, Size.Y))); + if (Clip != null) + canvas.PushGeometryClip(Clip); + + RenderCore(canvas, transform); + + if (Clip != null) + canvas.PopGeometryClip(); + if (ClipToBounds) + canvas.PopClip(); + if(Opacity != 1) + canvas.PopOpacity(); + } + + private ReadbackData _readback0, _readback1, _readback2; + + + public ref ReadbackData GetReadback(int idx) + { + if (idx == 0) + return ref _readback0; + if (idx == 1) + return ref _readback1; + return ref _readback2; + } + + public Matrix4x4 CombinedTransformMatrix + { + get + { + if (Root == null) + return default; + + var res = MatrixUtils.ComputeTransform(Size, AnchorPoint, CenterPoint, TransformMatrix, + Scale, RotationAngle, Orientation, Offset); + var i = Root.Readback; + ref var readback = ref GetReadback(i.WriteIndex); + readback.Revision = i.WriteRevision; + readback.Matrix = res; + readback.TargetId = Root.Id; + + return res; + } + } + + public struct ReadbackData + { + public Matrix4x4 Matrix; + public bool Visible; + public ulong Revision; + public long TargetId; + } + + partial void ApplyChangesExtra(CompositionVisualChanges c) + { + if (c.Parent.IsSet) + Parent = c.Parent.Value; + if (c.Root.IsSet) + Root = c.Root.Value; + } + + public ServerCompositionTarget? Root { get; private set; } + + public ServerCompositionVisual? Parent { get; private set; } + } + + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs new file mode 100644 index 0000000000..7b64c01d09 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Avalonia.Rendering.Composition.Transport +{ + internal class Batch + { + private static long _nextSequenceId = 1; + private static ConcurrentBag> _pool = new ConcurrentBag>(); + public long SequenceId { get; } + + public Batch() + { + SequenceId = Interlocked.Increment(ref _nextSequenceId); + if (!_pool.TryTake(out var lst)) + lst = new List(); + Changes = lst; + } + private TaskCompletionSource _tcs = new TaskCompletionSource(); + public List Changes { get; private set; } + public TimeSpan CommitedAt { get; set; } + + public void Complete() + { + Changes.Clear(); + _pool.Add(Changes); + Changes = null!; + + _tcs.TrySetResult(0); + } + + public Task Completed => _tcs.Task; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs b/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs new file mode 100644 index 0000000000..cbee350ab3 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs @@ -0,0 +1,82 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using Avalonia.Rendering.Composition.Animations; + +namespace Avalonia.Rendering.Composition.Transport +{ + struct Change + { + private T? _value; + + public bool IsSet { get; private set; } + + public T? Value + { + get + { + if(!IsSet) + throw new InvalidOperationException(); + return _value; + } + set + { + IsSet = true; + _value = value; + } + } + + public void Reset() + { + _value = default; + IsSet = false; + } + } + + struct AnimatedChange + { + private T? _value; + private IAnimationInstance? _animation; + + public bool IsValue { get; private set; } + public bool IsAnimation { get; private set; } + + public T Value + { + get + { + if(!IsValue) + throw new InvalidOperationException(); + return _value!; + } + set + { + IsAnimation = false; + _animation = null; + IsValue = true; + _value = value; + } + } + + public IAnimationInstance Animation + { + get + { + if(!IsAnimation) + throw new InvalidOperationException(); + return _animation!; + } + set + { + IsValue = false; + _value = default; + IsAnimation = true; + _animation = value; + } + } + + public void Reset() + { + this = default; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs new file mode 100644 index 0000000000..898885dce6 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs @@ -0,0 +1,36 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + internal abstract class ChangeSet + { + private readonly IChangeSetPool _pool; + public Batch Batch = null!; + public ServerObject? Target; + public bool Dispose; + + public ChangeSet(IChangeSetPool pool) + { + _pool = pool; + } + + public virtual void Reset() + { + Batch = null!; + Target = null; + Dispose = false; + } + + public void Return() + { + _pool.Return(this); + } + } + + internal class CompositionObjectChanges : ChangeSet + { + public CompositionObjectChanges(IChangeSetPool pool) : base(pool) + { + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs new file mode 100644 index 0000000000..ea97cd7d44 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Concurrent; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + interface IChangeSetPool + { + void Return(ChangeSet changes); + ChangeSet Get(ServerObject target, Batch batch); + } + + class ChangeSetPool : IChangeSetPool where T : ChangeSet + { + private readonly Func _factory; + private readonly ConcurrentBag _pool = new ConcurrentBag(); + + public ChangeSetPool(Func factory) + { + _factory = factory; + } + + public void Return(T changes) + { + changes.Reset(); + _pool.Add(changes); + } + + void IChangeSetPool.Return(ChangeSet changes) => Return((T) changes); + ChangeSet IChangeSetPool.Get(ServerObject target, Batch batch) => Get(target, batch); + + public T Get(ServerObject target, Batch batch) + { + if (!_pool.TryTake(out var res)) + res = _factory(this); + res.Target = target; + res.Batch = batch; + res.Dispose = false; + return res; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs new file mode 100644 index 0000000000..aed041b62e --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs @@ -0,0 +1,20 @@ +namespace Avalonia.Rendering.Composition.Transport +{ + class CustomDrawVisualChanges : CompositionVisualChanges + { + public CustomDrawVisualChanges(IChangeSetPool pool) : base(pool) + { + } + + public Change Data; + + public override void Reset() + { + Data.Reset(); + base.Reset(); + } + + public new static ChangeSetPool> Pool { get; } = + new ChangeSetPool>(pool => new CustomDrawVisualChanges(pool)); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs new file mode 100644 index 0000000000..215c03b229 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using Avalonia.Collections.Pooled; +using Avalonia.Rendering.Composition.Drawing; +using Avalonia.Rendering.SceneGraph; +using Avalonia.Utilities; + +namespace Avalonia.Rendering.Composition.Transport; + +internal class DrawListVisualChanges : CompositionVisualChanges +{ + private CompositionDrawList? _drawCommands; + + public DrawListVisualChanges(IChangeSetPool pool) : base(pool) + { + } + + public CompositionDrawList? DrawCommands + { + get => _drawCommands; + set + { + _drawCommands?.Dispose(); + _drawCommands = value; + DrawCommandsIsSet = true; + } + } + + public bool DrawCommandsIsSet { get; private set; } + + public CompositionDrawList? AcquireDrawCommands() + { + var rv = _drawCommands; + _drawCommands = null; + DrawCommandsIsSet = false; + return rv; + } + + public override void Reset() + { + _drawCommands?.Dispose(); + _drawCommands = null; + DrawCommandsIsSet = false; + base.Reset(); + } + + public new static ChangeSetPool Pool { get; } = + new ChangeSetPool(pool => new(pool)); +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs new file mode 100644 index 0000000000..ee6e4231f8 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs @@ -0,0 +1,19 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + internal class ListChange where T : ServerObject + { + public int Index; + public ListChangeAction Action; + public T? Added; + } + + internal enum ListChangeAction + { + InsertAt, + RemoveAt, + Clear, + ReplaceAt + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs new file mode 100644 index 0000000000..9bb101a080 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + class ListChangeSet : ChangeSet where T : ServerObject + { + private List>? _listChanges; + public List> ListChanges => _listChanges ??= new List>(); + public bool HasListChanges => _listChanges != null; + + public override void Reset() + { + _listChanges?.Clear(); + base.Reset(); + } + + public ListChangeSet(IChangeSetPool pool) : base(pool) + { + } + + public static readonly ChangeSetPool> Pool = + new ChangeSetPool>(pool => new ListChangeSet(pool)); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs new file mode 100644 index 0000000000..1add3aa990 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs @@ -0,0 +1,92 @@ +using System.Collections; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + class ServerListProxyHelper : IList + where TServer : ServerObject + where TClient : CompositionObject + { + private readonly IGetChanges _parent; + private readonly List _list = new List(); + + public interface IGetChanges + { + ListChangeSet GetChanges(); + } + + public ServerListProxyHelper(IGetChanges parent) + { + _parent = parent; + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + public List.Enumerator GetEnumerator() => _list.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public void Add(TClient item) => Insert(_list.Count, item); + + public void Clear() + { + _list.Clear(); + _parent.GetChanges().ListChanges.Add(new ListChange + { + Action = ListChangeAction.Clear + }); + } + + public bool Contains(TClient item) => _list.Contains(item); + + public void CopyTo(TClient[] array, int arrayIndex) => _list.CopyTo(array, arrayIndex); + + public bool Remove(TClient item) + { + var idx = _list.IndexOf(item); + if (idx == -1) + return false; + RemoveAt(idx); + return true; + } + + public int Count => _list.Count; + public bool IsReadOnly => false; + public int IndexOf(TClient item) => _list.IndexOf(item); + + public void Insert(int index, TClient item) + { + _list.Insert(index, item); + _parent.GetChanges().ListChanges.Add(new ListChange + { + Action = ListChangeAction.InsertAt, + Index = index, + Added = (TServer) item.Server + }); + } + + public void RemoveAt(int index) + { + _list.RemoveAt(index); + _parent.GetChanges().ListChanges.Add(new ListChange + { + Action = ListChangeAction.RemoveAt, + Index = index + }); + } + + public TClient this[int index] + { + get => _list[index]; + set + { + _list[index] = value; + _parent.GetChanges().ListChanges.Add(new ListChange + { + Action = ListChangeAction.ReplaceAt, + Index = index, + Added = (TServer) value.Server + }); + } + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs new file mode 100644 index 0000000000..c87fb96967 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs @@ -0,0 +1,16 @@ +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport +{ + partial class CompositionVisualChanges + { + public Change Parent; + public Change Root; + + partial void ResetExtra() + { + Parent.Reset(); + Root.Reset(); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Utils/CubicBezier.cs b/src/Avalonia.Base/Rendering/Composition/Utils/CubicBezier.cs new file mode 100644 index 0000000000..8c85d7978b --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Utils/CubicBezier.cs @@ -0,0 +1,302 @@ +// ReSharper disable InconsistentNaming +// Ported from Chromium project https://github.com/chromium/chromium/blob/374d31b7704475fa59f7b2cb836b3b68afdc3d79/ui/gfx/geometry/cubic_bezier.cc + +using System; + +// ReSharper disable CompareOfFloatsByEqualityOperator +// ReSharper disable CommentTypo +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable TooWideLocalVariableScope +// ReSharper disable UnusedMember.Global +#pragma warning disable 649 + +namespace Avalonia.Rendering.Composition.Utils +{ + internal unsafe struct CubicBezier + { + const int CUBIC_BEZIER_SPLINE_SAMPLES = 11; + double ax_; + double bx_; + double cx_; + + double ay_; + double by_; + double cy_; + + double start_gradient_; + double end_gradient_; + + double range_min_; + double range_max_; + private bool monotonically_increasing_; + + fixed double spline_samples_[CUBIC_BEZIER_SPLINE_SAMPLES]; + + public CubicBezier(double p1x, double p1y, double p2x, double p2y) : this() + { + InitCoefficients(p1x, p1y, p2x, p2y); + InitGradients(p1x, p1y, p2x, p2y); + InitRange(p1y, p2y); + InitSpline(); + } + + public readonly double SampleCurveX(double t) + { + // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. + return ((ax_ * t + bx_) * t + cx_) * t; + } + + readonly double SampleCurveY(double t) + { + return ((ay_ * t + by_) * t + cy_) * t; + } + + readonly double SampleCurveDerivativeX(double t) + { + return (3.0 * ax_ * t + 2.0 * bx_) * t + cx_; + } + + readonly double SampleCurveDerivativeY(double t) + { + return (3.0 * ay_ * t + 2.0 * by_) * t + cy_; + } + + public readonly double SolveWithEpsilon(double x, double epsilon) + { + if (x < 0.0) + return 0.0 + start_gradient_ * x; + if (x > 1.0) + return 1.0 + end_gradient_ * (x - 1.0); + return SampleCurveY(SolveCurveX(x, epsilon)); + } + + void InitCoefficients(double p1x, + double p1y, + double p2x, + double p2y) + { + // Calculate the polynomial coefficients, implicit first and last control + // points are (0,0) and (1,1). + cx_ = 3.0 * p1x; + bx_ = 3.0 * (p2x - p1x) - cx_; + ax_ = 1.0 - cx_ - bx_; + + cy_ = 3.0 * p1y; + by_ = 3.0 * (p2y - p1y) - cy_; + ay_ = 1.0 - cy_ - by_; + +#if DEBUG + // Bezier curves with x-coordinates outside the range [0,1] for internal + // control points may have multiple values for t for a given value of x. + // In this case, calls to SolveCurveX may produce ambiguous results. + monotonically_increasing_ = p1x >= 0 && p1x <= 1 && p2x >= 0 && p2x <= 1; +#endif + } + + void InitGradients(double p1x, + double p1y, + double p2x, + double p2y) + { + // End-point gradients are used to calculate timing function results + // outside the range [0, 1]. + // + // There are four possibilities for the gradient at each end: + // (1) the closest control point is not horizontally coincident with regard to + // (0, 0) or (1, 1). In this case the line between the end point and + // the control point is tangent to the bezier at the end point. + // (2) the closest control point is coincident with the end point. In + // this case the line between the end point and the far control + // point is tangent to the bezier at the end point. + // (3) both internal control points are coincident with an endpoint. There + // are two special case that fall into this category: + // CubicBezier(0, 0, 0, 0) and CubicBezier(1, 1, 1, 1). Both are + // equivalent to linear. + // (4) the closest control point is horizontally coincident with the end + // point, but vertically distinct. In this case the gradient at the + // end point is Infinite. However, this causes issues when + // interpolating. As a result, we break down to a simple case of + // 0 gradient under these conditions. + + if (p1x > 0) + start_gradient_ = p1y / p1x; + else if (p1y == 0 && p2x > 0) + start_gradient_ = p2y / p2x; + else if (p1y == 0 && p2y == 0) + start_gradient_ = 1; + else + start_gradient_ = 0; + + if (p2x < 1) + end_gradient_ = (p2y - 1) / (p2x - 1); + else if (p2y == 1 && p1x < 1) + end_gradient_ = (p1y - 1) / (p1x - 1); + else if (p2y == 1 && p1y == 1) + end_gradient_ = 1; + else + end_gradient_ = 0; + } + + const double kBezierEpsilon = 1e-7; + + void InitRange(double p1y, double p2y) + { + range_min_ = 0; + range_max_ = 1; + if (0 <= p1y && p1y < 1 && 0 <= p2y && p2y <= 1) + return; + + double epsilon = kBezierEpsilon; + + // Represent the function's derivative in the form at^2 + bt + c + // as in sampleCurveDerivativeY. + // (Technically this is (dy/dt)*(1/3), which is suitable for finding zeros + // but does not actually give the slope of the curve.) + double a = 3.0 * ay_; + double b = 2.0 * by_; + double c = cy_; + + // Check if the derivative is constant. + if (Math.Abs(a) < epsilon && Math.Abs(b) < epsilon) + return; + + // Zeros of the function's derivative. + double t1; + double t2 = 0; + + if (Math.Abs(a) < epsilon) + { + // The function's derivative is linear. + t1 = -c / b; + } + else + { + // The function's derivative is a quadratic. We find the zeros of this + // quadratic using the quadratic formula. + double discriminant = b * b - 4 * a * c; + if (discriminant < 0) + return; + double discriminant_sqrt = Math.Sqrt(discriminant); + t1 = (-b + discriminant_sqrt) / (2 * a); + t2 = (-b - discriminant_sqrt) / (2 * a); + } + + double sol1 = 0; + double sol2 = 0; + + // If the solution is in the range [0,1] then we include it, otherwise we + // ignore it. + + // An interesting fact about these beziers is that they are only + // actually evaluated in [0,1]. After that we take the tangent at that point + // and linearly project it out. + if (0 < t1 && t1 < 1) + sol1 = SampleCurveY(t1); + + if (0 < t2 && t2 < 1) + sol2 = SampleCurveY(t2); + + range_min_ = Math.Min(Math.Min(range_min_, sol1), sol2); + range_max_ = Math.Max(Math.Max(range_max_, sol1), sol2); + } + + void InitSpline() + { + double delta_t = 1.0 / (CUBIC_BEZIER_SPLINE_SAMPLES - 1); + for (int i = 0; i < CUBIC_BEZIER_SPLINE_SAMPLES; i++) + { + spline_samples_[i] = SampleCurveX(i * delta_t); + } + } + + const int kMaxNewtonIterations = 4; + + + public readonly double SolveCurveX(double x, double epsilon) + { + if (x < 0 || x > 1) + throw new ArgumentException(); + + double t0 = 0; + double t1 = 0; + double t2 = x; + double x2 = 0; + double d2; + int i; + +#if DEBUG + if (!monotonically_increasing_) + throw new InvalidOperationException(); +#endif + + // Linear interpolation of spline curve for initial guess. + double delta_t = 1.0 / (CUBIC_BEZIER_SPLINE_SAMPLES - 1); + for (i = 1; i < CUBIC_BEZIER_SPLINE_SAMPLES; i++) + { + if (x <= spline_samples_[i]) + { + t1 = delta_t * i; + t0 = t1 - delta_t; + t2 = t0 + (t1 - t0) * (x - spline_samples_[i - 1]) / + (spline_samples_[i] - spline_samples_[i - 1]); + break; + } + } + + // Perform a few iterations of Newton's method -- normally very fast. + // See https://en.wikipedia.org/wiki/Newton%27s_method. + double newton_epsilon = Math.Min(kBezierEpsilon, epsilon); + for (i = 0; i < kMaxNewtonIterations; i++) + { + x2 = SampleCurveX(t2) - x; + if (Math.Abs(x2) < newton_epsilon) + return t2; + d2 = SampleCurveDerivativeX(t2); + if (Math.Abs(d2) < kBezierEpsilon) + break; + t2 = t2 - x2 / d2; + } + + if (Math.Abs(x2) < epsilon) + return t2; + + // Fall back to the bisection method for reliability. + while (t0 < t1) + { + x2 = SampleCurveX(t2); + if (Math.Abs(x2 - x) < epsilon) + return t2; + if (x > x2) + t0 = t2; + else + t1 = t2; + t2 = (t1 + t0) * .5; + } + + // Failure. + return t2; + } + + public readonly double Solve(double x) + { + return SolveWithEpsilon(x, kBezierEpsilon); + } + + public readonly double SlopeWithEpsilon(double x, double epsilon) + { + x = MathExt.Clamp(x, 0.0, 1.0); + double t = SolveCurveX(x, epsilon); + double dx = SampleCurveDerivativeX(t); + double dy = SampleCurveDerivativeY(t); + return dy / dx; + } + + public readonly double Slope(double x) + { + return SlopeWithEpsilon(x, kBezierEpsilon); + } + + public readonly double RangeMin => range_min_; + public readonly double RangeMax => range_max_; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Utils/MathExt.cs b/src/Avalonia.Base/Rendering/Composition/Utils/MathExt.cs new file mode 100644 index 0000000000..0be19a8e9d --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Utils/MathExt.cs @@ -0,0 +1,23 @@ +using System; + +namespace Avalonia.Rendering.Composition.Utils +{ + static class MathExt + { + public static float Clamp(float value, float min, float max) + { + var amax = Math.Max(min, max); + var amin = Math.Min(min, max); + return Math.Min(Math.Max(value, amin), amax); + } + + public static double Clamp(double value, double min, double max) + { + var amax = Math.Max(min, max); + var amin = Math.Min(min, max); + return Math.Min(Math.Max(value, amin), amax); + } + + + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs new file mode 100644 index 0000000000..1e6d7f8abb --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -0,0 +1,64 @@ +using System.Numerics; + +namespace Avalonia.Rendering.Composition +{ + public abstract partial class CompositionVisual + { + private CompositionVisual? _parent; + private CompositionTarget? _root; + + public CompositionVisual? Parent + { + get => _parent; + internal set + { + if (_parent == value) + return; + _parent = value; + Changes.Parent.Value = value?.Server; + Root = _parent?.Root; + } + } + + // TODO: hide behind private-ish API + public CompositionTarget? Root + { + get => _root; + internal set + { + var changed = _root != value; + _root = value; + Changes.Root.Value = value?.Server; + if (changed) + OnRootChanged(); + } + } + + private protected virtual void OnRootChanged() + { + } + + + internal Matrix4x4? TryGetServerTransform() + { + if (Root == null) + return null; + var i = Root.Server.Readback; + ref var readback = ref Server.GetReadback(i.ReadIndex); + + // CompositionVisual wasn't visible + if (readback.Revision < i.ReadRevision) + return null; + + // CompositionVisual was reparented (potential race here) + if (readback.TargetId != Root.Server.Id) + return null; + + return readback.Matrix; + } + + internal object? Tag { get; set; } + + internal virtual bool HitTest(Vector2 point) => true; + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs new file mode 100644 index 0000000000..35f33c3b38 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs @@ -0,0 +1,64 @@ +using System; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition +{ + public partial class CompositionVisualCollection : CompositionObject + { + private CompositionVisual _owner; + internal CompositionVisualCollection(CompositionVisual parent, ServerCompositionVisualCollection server) : base(parent.Compositor, server) + { + _owner = parent; + InitializeDefaults(); + } + + public void InsertAbove(CompositionVisual newChild, CompositionVisual sibling) + { + var idx = _list.IndexOf(sibling); + if (idx == -1) + throw new InvalidOperationException(); + + Insert(idx + 1, newChild); + } + + public void InsertBelow(CompositionVisual newChild, CompositionVisual sibling) + { + var idx = _list.IndexOf(sibling); + if (idx == -1) + throw new InvalidOperationException(); + Insert(idx, newChild); + } + + public void InsertAtTop(CompositionVisual newChild) => Insert(_list.Count, newChild); + + public void InsertAtBottom(CompositionVisual newChild) => Insert(0, newChild); + + public void RemoveAll() => Clear(); + + partial void OnAdded(CompositionVisual item) => item.Parent = _owner; + + partial void OnBeforeReplace(CompositionVisual oldItem, CompositionVisual newItem) + { + if (oldItem != newItem) + OnBeforeAdded(newItem); + } + + partial void OnReplace(CompositionVisual oldItem, CompositionVisual newItem) + { + if (oldItem != newItem) + { + OnRemoved(oldItem); + OnAdded(newItem); + } + } + + partial void OnRemoved(CompositionVisual item) => item.Parent = null; + + + partial void OnBeforeAdded(CompositionVisual item) + { + if (item.Parent != null) + throw new InvalidOperationException("Visual already has a parent"); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/IRenderer.cs b/src/Avalonia.Base/Rendering/IRenderer.cs index e998f78d5c..8d6aabf440 100644 --- a/src/Avalonia.Base/Rendering/IRenderer.cs +++ b/src/Avalonia.Base/Rendering/IRenderer.cs @@ -1,6 +1,7 @@ using System; using Avalonia.VisualTree; using System.Collections.Generic; +using Avalonia.Rendering.Composition; namespace Avalonia.Rendering { @@ -87,4 +88,9 @@ namespace Avalonia.Rendering /// void Stop(); } + + public interface IRendererWithCompositor : IRenderer + { + Compositor Compositor { get; } + } } diff --git a/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs b/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs index 5225b85020..3f495c619c 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Numerics; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Utilities; diff --git a/src/Avalonia.Base/Size.cs b/src/Avalonia.Base/Size.cs index 69c3ae7319..5f20206200 100644 --- a/src/Avalonia.Base/Size.cs +++ b/src/Avalonia.Base/Size.cs @@ -52,6 +52,17 @@ namespace Avalonia _width = width; _height = height; } + +#if !BUILDTASK + /// + /// Initializes a new instance of the structure. + /// + /// The vector to take values from. + public Size(System.Numerics.Vector2 vector2) : this(vector2.X, vector2.Y) + { + + } +#endif /// /// Gets the aspect ratio of the size. diff --git a/src/Avalonia.Base/Threading/DispatcherPriority.cs b/src/Avalonia.Base/Threading/DispatcherPriority.cs index a93e4f406d..b4bf603f74 100644 --- a/src/Avalonia.Base/Threading/DispatcherPriority.cs +++ b/src/Avalonia.Base/Threading/DispatcherPriority.cs @@ -62,10 +62,20 @@ namespace Avalonia.Threading /// public static readonly DispatcherPriority Render = new(5); + /// + /// The job will be processed with the same priority as composition batch commit. + /// + public static readonly DispatcherPriority CompositionBatch = new(6); + + /// + /// The job will be processed with the same priority as composition updates. + /// + public static readonly DispatcherPriority Composition = new(7); + /// /// The job will be processed with the same priority as render. /// - public static readonly DispatcherPriority Layout = new(6); + public static readonly DispatcherPriority Layout = new(8); /// /// The job will be processed with the same priority as data binding. @@ -75,7 +85,7 @@ namespace Avalonia.Threading /// /// The job will be processed before other asynchronous operations. /// - public static readonly DispatcherPriority Send = new(7); + public static readonly DispatcherPriority Send = new(9); /// /// Maximum possible priority diff --git a/src/Avalonia.Base/Visual.cs b/src/Avalonia.Base/Visual.cs index 4fd21f02f9..64341be0c7 100644 --- a/src/Avalonia.Base/Visual.cs +++ b/src/Avalonia.Base/Visual.cs @@ -1,3 +1,7 @@ + + +#nullable enable + using System; using System.Collections; using System.Collections.Specialized; @@ -8,11 +12,10 @@ using Avalonia.LogicalTree; using Avalonia.Media; using Avalonia.Metadata; using Avalonia.Rendering; +using Avalonia.Rendering.Composition; +using Avalonia.Rendering.Composition.Server; using Avalonia.Utilities; using Avalonia.VisualTree; - -#nullable enable - namespace Avalonia { /// @@ -288,6 +291,8 @@ namespace Avalonia /// protected IRenderRoot? VisualRoot => _visualRoot ?? (this as IRenderRoot); + internal CompositionDrawListVisual? CompositionVisual { get; private set; } + /// /// Gets a value indicating whether this control is attached to a visual root. /// @@ -432,6 +437,10 @@ namespace Avalonia } EnableTransitions(); + if (_visualRoot.Renderer is IRendererWithCompositor compositingRenderer) + { + AttachToCompositor(compositingRenderer.Compositor); + } OnAttachedToVisualTree(e); AttachedToVisualTree?.Invoke(this, e); InvalidateVisual(); @@ -452,6 +461,14 @@ namespace Avalonia } } + internal CompositionVisual AttachToCompositor(Compositor compositor) + { + if (CompositionVisual == null || CompositionVisual.Compositor != compositor) + CompositionVisual = new CompositionDrawListVisual(compositor, + new ServerCompositionDrawListVisual(compositor.Server), this); + return CompositionVisual; + } + /// /// Calls the method /// for this control and all of its visual descendants. @@ -564,7 +581,7 @@ namespace Avalonia { newValue.Changed += sender.RenderTransformChanged; } - + sender.InvalidateVisual(); } } diff --git a/src/Avalonia.Base/composition-schema.xml b/src/Avalonia.Base/composition-schema.xml new file mode 100644 index 0000000000..cf864dac2d --- /dev/null +++ b/src/Avalonia.Base/composition-schema.xml @@ -0,0 +1,70 @@ + + + System.Numerics + Avalonia.Rendering.Composition.Server + Avalonia.Rendering.Composition.Transport + Avalonia.Rendering.Composition.Animations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs b/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs index addc248d58..984f76adb6 100644 --- a/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs +++ b/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Numerics; using System.Runtime.InteropServices; using Avalonia.Media; using Avalonia.Platform; @@ -344,6 +345,7 @@ namespace Avalonia.Headless } public Matrix Transform { get; set; } + public void Clear(Color color) { diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs new file mode 100644 index 0000000000..f079a339df --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs @@ -0,0 +1,21 @@ +using System.IO; +using System.Xml.Serialization; +using Microsoft.CodeAnalysis; + +namespace Avalonia.SourceGenerator.CompositionGenerator; + +[Generator(LanguageNames.CSharp)] +public class CompositionRoslynGenerator : IIncrementalGenerator +{ + public void Initialize(IncrementalGeneratorInitializationContext context) + { + var schema = context.AdditionalTextsProvider.Where(static file => file.Path.EndsWith("composition-schema.xml")); + var configs = schema.Select((t, _) => + (GConfig)new XmlSerializer(typeof(GConfig)).Deserialize(new StringReader(t.GetText().ToString()))); + context.RegisterSourceOutput(configs, (spc, config) => + { + var generator = new Generator(spc, config); + generator.Generate(); + }); + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs new file mode 100644 index 0000000000..8b6aca33cd --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs @@ -0,0 +1,116 @@ +#nullable disable +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + + + [XmlRoot("NComposition")] + public class GConfig + { + [XmlElement("Using")] + public List Usings { get; set; } = new List(); + + [XmlElement(typeof(GManualClass), ElementName = "Manual")] + public List ManualClasses { get; set; } = new List(); + + [XmlElement(typeof(GClass), ElementName = "Object")] + [XmlElement(typeof(GBrush), ElementName = "Brush")] + [XmlElement(typeof(GList), ElementName = "List")] + public List Classes { get; set; } = new List(); + + [XmlElement(typeof(GAnimationType), ElementName = "KeyFrameAnimation")] + public List KeyFrameAnimations { get; set; } = new List(); + } + + public class GUsing + { + [XmlText] + public string Name { get; set; } + } + + public class GManualClass + { + [XmlAttribute] + public string Name { get; set; } + + [XmlAttribute] + public string ServerName { get; set; } + } + + public class GImplements + { + [XmlAttribute] + public string Name { get; set; } + [XmlAttribute] + public string ServerName { get; set; } + } + + public class GClass + { + [XmlAttribute] + public string Name { get; set; } + + [XmlAttribute] + public string Inherits { get; set; } + + [XmlAttribute] + public string ChangesBase { get; set; } + + [XmlAttribute] + public string ServerBase { get; set; } + + [XmlAttribute] + public bool CustomCtor { get; set; } + + [XmlAttribute] + public bool CustomServerCtor { get; set; } + + [XmlElement(typeof(GImplements), ElementName = "Implements")] + public List Implements { get; set; } = new List(); + + [XmlAttribute] + public bool Abstract { get; set; } + + [XmlElement(typeof(GProperty), ElementName = "Property")] + public List Properties { get; set; } = new List(); + } + + public class GBrush : GClass + { + [XmlAttribute] + public bool CustomUpdate { get; set; } + + public GBrush() + { + Inherits = "CompositionBrush"; + } + } + + public class GList : GClass + { + [XmlAttribute] + public string ItemType { get; set; } + } + + public class GProperty + { + [XmlAttribute] + public string Name { get; set; } + [XmlAttribute] + public string Type { get; set; } + [XmlAttribute] + public string DefaultValue { get; set; } + [XmlAttribute] + public bool Animated { get; set; } + } + + public class GAnimationType + { + [XmlAttribute] + public string Name { get; set; } + [XmlAttribute] + public string Type { get; set; } + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs new file mode 100644 index 0000000000..43a4a4afa7 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs @@ -0,0 +1,90 @@ +using System; +using System.Linq; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + public static class Extensions + { + public static ClassDeclarationSyntax AddModifiers(this ClassDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static MethodDeclarationSyntax AddModifiers(this MethodDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static PropertyDeclarationSyntax AddModifiers(this PropertyDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static ConstructorDeclarationSyntax AddModifiers(this ConstructorDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static AccessorDeclarationSyntax AddModifiers(this AccessorDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static string WithLowerFirst(this string s) + { + if (string.IsNullOrEmpty(s)) + return s; + return char.ToLowerInvariant(s[0]) + s.Substring(1); + } + + public static ExpressionSyntax MemberAccess(params string[] identifiers) + { + if (identifiers == null || identifiers.Length == 0) + throw new ArgumentException(); + var expr = (ExpressionSyntax)IdentifierName(identifiers[0]); + for (var c = 1; c < identifiers.Length; c++) + expr = MemberAccess(expr, identifiers[c]); + return expr; + } + + public static ExpressionSyntax MemberAccess(ExpressionSyntax expr, params string[] identifiers) + { + foreach (var i in identifiers) + expr = MemberAccess(expr, i); + return expr; + } + + public static MemberAccessExpressionSyntax MemberAccess(ExpressionSyntax expr, string identifier) => + MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, IdentifierName(identifier)); + + public static ExpressionSyntax ConditionalMemberAccess(ExpressionSyntax expr, string member, bool checkNull) + { + if (checkNull) + return ConditionalAccessExpression(expr, MemberBindingExpression(IdentifierName(member))); + return MemberAccess(expr, member); + } + + public static ClassDeclarationSyntax WithBaseType(this ClassDeclarationSyntax cl, string bt) + { + return cl.AddBaseListTypes(SimpleBaseType(SyntaxFactory.ParseTypeName(bt))); + } + + public static string StripPrefix(this string s, string prefix) => string.IsNullOrEmpty(s) + ? s + : s.StartsWith(prefix) + ? s.Substring(prefix.Length) + : s; + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs new file mode 100644 index 0000000000..7d5146c5f5 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs @@ -0,0 +1,59 @@ +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + public partial class Generator + { + void GenerateAnimations() + { + var code = $@"using System.Numerics; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Expressions; + +namespace Avalonia.Rendering.Composition +{{ +"; + + foreach (var a in _config.KeyFrameAnimations) + { + var name = a.Name ?? a.Type; + + code += $@" + public class {name}KeyFrameAnimation : KeyFrameAnimation + {{ + public {name}KeyFrameAnimation(Compositor compositor) : base(compositor) + {{ + }} + + internal override IAnimationInstance CreateInstance(Avalonia.Rendering.Composition.Server.ServerObject targetObject, ExpressionVariant? finalValue) + {{ + return new KeyFrameAnimationInstance<{a.Type}>({name}Interpolator.Instance, _keyFrames.Snapshot(), CreateSnapshot(true), + finalValue?.CastOrDefault<{a.Type}>(), targetObject, + DelayBehavior, DelayTime, Direction, Duration, IterationBehavior, + IterationCount, StopBehavior); + }} + + private KeyFrames<{a.Type}> _keyFrames = new KeyFrames<{a.Type}>(); + private protected override IKeyFrames KeyFrames => _keyFrames; + + public void InsertKeyFrame(float normalizedProgressKey, {a.Type} value, CompositionEasingFunction easingFunction) + {{ + _keyFrames.Insert(normalizedProgressKey, value, easingFunction); + }} + + public void InsertKeyFrame(float normalizedProgressKey, {a.Type} value) + {{ + _keyFrames.Insert(normalizedProgressKey, value, Compositor.DefaultEasing); + }} + }} + + public partial class Compositor + {{ + public {name}KeyFrameAnimation Create{name}KeyFrameAnimation() => new {name}KeyFrameAnimation(this); + }} +"; + } + + code += "}"; + _output.AddSource("CompositionAnimations.cs", code); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs new file mode 100644 index 0000000000..593386f713 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs @@ -0,0 +1,121 @@ +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + public partial class Generator + { + private const string ListProxyTemplate = @" +class Template +{ + private ServerListProxyHelper _list = null!; + + ListChangeSet + ServerListProxyHelper.IGetChanges. + GetChanges() => Changes; + + public List.Enumerator GetEnumerator() => _list.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => + GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable) _list).GetEnumerator(); + + public void Add(ItemTypeName item) + { + OnBeforeAdded(item); + _list.Add(item); + OnAdded(item); + } + + public void Clear() + { + OnBeforeClear(); + _list.Clear(); + OnClear(); + } + + public bool Contains(ItemTypeName item) => _list.Contains(item); + + public void CopyTo(ItemTypeName[] array, int arrayIndex) => _list.CopyTo(array, arrayIndex); + + public bool Remove(ItemTypeName item) + { + var removed = _list.Remove(item); + if(removed) + OnRemoved(item); + return removed; + } + + public int Count => _list.Count; + + public bool IsReadOnly => _list.IsReadOnly; + + public int IndexOf(ItemTypeName item) => _list.IndexOf(item); + + public void Insert(int index, ItemTypeName item) + { + OnBeforeAdded(item); + _list.Insert(index, item); + OnAdded(item); + } + + public void RemoveAt(int index) + { + var item = _list[index]; + _list.RemoveAt(index); + OnRemoved(item); + } + + public ItemTypeName this[int index] + { + get => _list[index]; + set + { + var old = _list[index]; + OnBeforeReplace(old, value); + _list[index] = value; + OnReplace(old, value); + } + } + + partial void OnBeforeAdded(ItemTypeName item); + partial void OnAdded(ItemTypeName item); + partial void OnRemoved(ItemTypeName item); + partial void OnBeforeClear(); + partial void OnBeforeReplace(ItemTypeName oldItem, ItemTypeName newItem); + partial void OnReplace(ItemTypeName oldItem, ItemTypeName newItem); + partial void OnClear(); +} +"; + + private ClassDeclarationSyntax AppendListProxy(GList list, ClassDeclarationSyntax cl) + { + + var itemType = list.ItemType; + var serverItemType = ServerName(itemType); + + cl = cl.AddBaseListTypes(SimpleBaseType( + ParseTypeName("ServerListProxyHelper<" + itemType + ", " + serverItemType + ">.IGetChanges")), + SimpleBaseType(ParseTypeName("IList<" + itemType + ">")) + ); + var code = ListProxyTemplate.Replace("ListTypeName", list.Name) + .Replace("ItemTypeName", itemType); + + var parsed = ParseCompilationUnit(code); + var parsedClass = (ClassDeclarationSyntax)parsed.Members.First(); + + cl = cl.AddMembers(parsedClass.Members.ToArray()); + + var defs = cl.Members.OfType().First(m => m.Identifier.Text == "InitializeDefaults"); + + cl = cl.ReplaceNode(defs.Body, defs.Body.AddStatements( + + ParseStatement($"_list = new ServerListProxyHelper<{itemType}, {serverItemType}>(this);"))); + + return cl; + } + + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.Utils.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.Utils.cs new file mode 100644 index 0000000000..b53c247991 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.Utils.cs @@ -0,0 +1,66 @@ +using System.IO; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + public partial class Generator + { + static void CleanDirectory(string path) + { + Directory.CreateDirectory(path); + Directory.Delete(path, true); + Directory.CreateDirectory(path); + } + + CompilationUnitSyntax Unit() + => CompilationUnit().WithUsings(List(new[] + { + "System", + "System.Text", + "System.Collections", + "System.Collections.Generic" + } + .Concat(_config.Usings + .Select(x => x.Name)).Select(u => UsingDirective(IdentifierName(u))))); + + void SaveTo(CompilationUnitSyntax unit, params string[] path) + { + var text = @" +#nullable enable +#pragma warning disable CS0108, CS0114 + +" + + + unit.NormalizeWhitespace().ToFullString(); + _output.AddSource(string.Join("_", path), text); + } + + + SyntaxToken Semicolon() => Token(SyntaxKind.SemicolonToken); + + + FieldDeclarationSyntax DeclareConstant(string type, string name, LiteralExpressionSyntax value) + => FieldDeclaration( + VariableDeclaration(ParseTypeName(type), + SingletonSeparatedList( + VariableDeclarator(name).WithInitializer(EqualsValueClause(value)) + )) + ).WithSemicolonToken(Semicolon()) + .WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.ConstKeyword))); + + FieldDeclarationSyntax DeclareField(string type, string name, params SyntaxKind[] modifiers) => + DeclareField(type, name, null, modifiers); + + FieldDeclarationSyntax DeclareField(string type, string name, EqualsValueClauseSyntax initializer, + params SyntaxKind[] modifiers) => + FieldDeclaration( + VariableDeclaration(ParseTypeName(type), + SingletonSeparatedList( + VariableDeclarator(name).WithInitializer(initializer)))) + .WithSemicolonToken(Semicolon()) + .WithModifiers(TokenList(modifiers.Select(x => Token(x)))); + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs new file mode 100644 index 0000000000..43ef4a96e8 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs @@ -0,0 +1,504 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using static Avalonia.SourceGenerator.CompositionGenerator.Extensions; +namespace Avalonia.SourceGenerator.CompositionGenerator +{ + partial class Generator + { + private readonly SourceProductionContext _output; + private readonly GConfig _config; + private readonly HashSet _objects; + private readonly HashSet _brushes; + private readonly Dictionary _manuals; + public Generator(SourceProductionContext output, GConfig config) + { + _output = output; + _config = config; + _manuals = _config.ManualClasses.ToDictionary(x => x.Name); + _objects = new HashSet(_config.ManualClasses.Select(x => x.Name) + .Concat(_config.Classes.Select(x => x.Name))); + _brushes = new HashSet(_config.Classes.OfType().Select(x => x.Name)) {"CompositionBrush"}; + } + + + + public void Generate() + { + foreach (var cl in _config.Classes) + GenerateClass(cl); + + GenerateAnimations(); + } + + + + string ServerName(string c) => c != null ? ("Server" + c) : "ServerObject"; + string ChangesName(string c) => c != null ? (c + "Changes") : "ChangeSet"; + + void GenerateClass(GClass cl) + { + var list = cl as GList; + + var unit = Unit(); + + var clientNs = NamespaceDeclaration(IdentifierName("Avalonia.Rendering.Composition")); + var serverNs = NamespaceDeclaration(IdentifierName("Avalonia.Rendering.Composition.Server")); + var transportNs = NamespaceDeclaration(IdentifierName("Avalonia.Rendering.Composition.Transport")); + + var inherits = cl.Inherits ?? "CompositionObject"; + var abstractModifier = cl.Abstract ? new[] {SyntaxKind.AbstractKeyword} : null; + + var client = ClassDeclaration(cl.Name) + .AddModifiers(abstractModifier) + .AddModifiers(SyntaxKind.PublicKeyword, SyntaxKind.UnsafeKeyword, SyntaxKind.PartialKeyword) + .WithBaseType(inherits); + + var serverName = ServerName(cl.Name); + var serverBase = cl.ServerBase ?? ServerName(cl.Inherits); + if (list != null) + serverBase = "ServerList<" + ServerName(list.ItemType) + ">"; + + var server = ClassDeclaration(serverName) + .AddModifiers(abstractModifier) + .AddModifiers(SyntaxKind.UnsafeKeyword, SyntaxKind.PartialKeyword) + .WithBaseType(serverBase); + + string changesName = ChangesName(cl.Name); + var changesBase = ChangesName(cl.ChangesBase ?? cl.Inherits); + + if (list != null) + changesBase = "ListChangeSet<" + ServerName(list.ItemType) + ">"; + + var changeSetPoolType = "ChangeSetPool<" + changesName + ">"; + var transport = ClassDeclaration(changesName) + .AddModifiers(SyntaxKind.UnsafeKeyword, SyntaxKind.PartialKeyword) + .WithBaseType(changesBase) + .AddMembers(DeclareField(changeSetPoolType, "Pool", + EqualsValueClause( + ParseExpression($"new {changeSetPoolType}(pool => new {changesName}(pool))") + ), + SyntaxKind.PublicKeyword, + SyntaxKind.StaticKeyword, SyntaxKind.ReadOnlyKeyword)) + .AddMembers(ParseMemberDeclaration($"public {changesName}(IChangeSetPool pool) : base(pool){{}}")); + + client = client + .AddMembers( + PropertyDeclaration(ParseTypeName("IChangeSetPool"), "ChangeSetPool") + .AddModifiers(SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, + SyntaxKind.OverrideKeyword) + .WithExpressionBody( + ArrowExpressionClause(MemberAccess(changesName, "Pool"))) + .WithSemicolonToken(Semicolon())) + .AddMembers(PropertyDeclaration(ParseTypeName(changesName), "Changes") + .AddModifiers(SyntaxKind.PrivateKeyword, SyntaxKind.NewKeyword) + .WithExpressionBody(ArrowExpressionClause(CastExpression(ParseTypeName(changesName), + MemberAccess(BaseExpression(), "Changes")))) + .WithSemicolonToken(Semicolon())); + + if (!cl.CustomCtor) + { + client = client.AddMembers(PropertyDeclaration(ParseTypeName(serverName), "Server") + .AddModifiers(SyntaxKind.InternalKeyword, SyntaxKind.NewKeyword) + .AddAccessorListAccessors(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) + .WithSemicolonToken(Semicolon()))); + client = client.AddMembers( + ConstructorDeclaration(cl.Name) + .AddModifiers(SyntaxKind.InternalKeyword) + .WithParameterList(ParameterList(SeparatedList(new[] + { + Parameter(Identifier("compositor")).WithType(ParseTypeName("Compositor")), + Parameter(Identifier("server")).WithType(ParseTypeName(serverName)), + }))) + .WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, + ArgumentList(SeparatedList(new[] + { + Argument(IdentifierName("compositor")), + Argument(IdentifierName("server")), + })))).WithBody(Block( + ExpressionStatement( + AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + IdentifierName("Server"), + CastExpression(ParseTypeName(serverName), IdentifierName("server")))), + ExpressionStatement(InvocationExpression(IdentifierName("InitializeDefaults"))) + ))); + } + + if (!cl.CustomServerCtor) + { + server = server.AddMembers( + ConstructorDeclaration(serverName) + .AddModifiers(SyntaxKind.InternalKeyword) + .WithParameterList(ParameterList(SeparatedList(new[] + { + Parameter(Identifier("compositor")).WithType(ParseTypeName("ServerCompositor")), + }))) + .WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, + ArgumentList(SeparatedList(new[] + { + Argument(IdentifierName("compositor")), + })))).WithBody(Block())); + } + + + var changesVarName = "c"; + var changesVar = IdentifierName(changesVarName); + + server = server.AddMembers( + MethodDeclaration(ParseTypeName("void"), "ApplyChangesExtra") + .AddParameterListParameters(Parameter(Identifier("c")).WithType(ParseTypeName(changesName))) + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + + transport = transport.AddMembers( + MethodDeclaration(ParseTypeName("void"), "ResetExtra") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + + var applyMethodBody = Block( + ExpressionStatement(InvocationExpression(MemberAccess(IdentifierName("base"), "ApplyCore"), + ArgumentList(SeparatedList(new[] {Argument(IdentifierName("changes"))})))), + LocalDeclarationStatement(VariableDeclaration(ParseTypeName("var")) + .WithVariables(SingletonSeparatedList( + VariableDeclarator(changesVarName) + .WithInitializer(EqualsValueClause(CastExpression(ParseTypeName(changesName), + IdentifierName("changes"))))))), + ExpressionStatement(InvocationExpression(IdentifierName("ApplyChangesExtra")) + .AddArgumentListArguments(Argument(IdentifierName("c")))) + ); + + var resetBody = Block(); + var startAnimationBody = Block(); + var getPropertyBody = Block(); + var serverGetPropertyBody = Block(); + + var defaultsMethodBody = Block(); + + foreach (var prop in cl.Properties) + { + var fieldName = "_" + prop.Name.WithLowerFirst(); + var propType = ParseTypeName(prop.Type); + var filteredPropertyType = prop.Type.TrimEnd('?'); + var isObject = _objects.Contains(filteredPropertyType); + var isNullable = prop.Type.EndsWith("?"); + + + + + client = client + .AddMembers(DeclareField(prop.Type, fieldName)) + .AddMembers(PropertyDeclaration(propType, prop.Name) + .AddModifiers(SyntaxKind.PublicKeyword) + .AddAccessorListAccessors( + AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, + Block(ReturnStatement(IdentifierName(fieldName)))), + AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, + Block( + ParseStatement("var changed = false;"), + IfStatement(BinaryExpression(SyntaxKind.NotEqualsExpression, + IdentifierName(fieldName), + IdentifierName("value")), + Block( + ParseStatement("On" + prop.Name + "Changing();"), + ParseStatement("changed = true;"), + GeneratePropertySetterAssignment(prop, fieldName, isObject, isNullable)) + ), + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(fieldName), IdentifierName("value"))), + ParseStatement($"if(changed) On" + prop.Name + "Changed();") + )) + )) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changed") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changing") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + + + var animatedServer = prop.Animated; + + var serverPropertyType = ((isObject ? "Server" : "") + prop.Type); + if (_manuals.TryGetValue(filteredPropertyType, out var manual) && manual.ServerName != null) + serverPropertyType = manual.ServerName + (isNullable ? "?" : ""); + + + transport = transport + .AddMembers(DeclareField((animatedServer ? "Animated" : "") + "Change<" + serverPropertyType + ">", + prop.Name, SyntaxKind.PublicKeyword)); + + if (animatedServer) + server = server.AddMembers( + DeclareField("AnimatedValueStore<" + serverPropertyType + ">", fieldName), + PropertyDeclaration(ParseTypeName(serverPropertyType), prop.Name) + .AddModifiers(SyntaxKind.PublicKeyword) + .WithExpressionBody(ArrowExpressionClause( + InvocationExpression(MemberAccess(fieldName, "GetAnimated"), + ArgumentList(SingletonSeparatedList(Argument(IdentifierName("Compositor"))))))) + .WithSemicolonToken(Semicolon()) + ); + else + { + server = server + .AddMembers(DeclareField(serverPropertyType, fieldName)) + .AddMembers(PropertyDeclaration(ParseTypeName(serverPropertyType), prop.Name) + .AddModifiers(SyntaxKind.PublicKeyword) + .AddAccessorListAccessors( + AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, + Block(ReturnStatement(IdentifierName(fieldName)))), + AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, + Block( + ParseStatement("var changed = false;"), + IfStatement(BinaryExpression(SyntaxKind.NotEqualsExpression, + IdentifierName(fieldName), + IdentifierName("value")), + Block( + ParseStatement("On" + prop.Name + "Changing();"), + ParseStatement($"changed = true;")) + ), + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(fieldName), IdentifierName("value"))), + ParseStatement($"if(changed) On" + prop.Name + "Changed();") + )) + )) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changed") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changing") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + } + + if (animatedServer) + applyMethodBody = applyMethodBody.AddStatements( + IfStatement(MemberAccess(changesVar, prop.Name, "IsValue"), + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(fieldName), MemberAccess(changesVar, prop.Name, "Value")))), + IfStatement(MemberAccess(changesVar, prop.Name, "IsAnimation"), + ExpressionStatement( + InvocationExpression(MemberAccess(fieldName, "SetAnimation"), + ArgumentList(SeparatedList(new[] + { + Argument(changesVar), + Argument(MemberAccess(changesVar, prop.Name, "Animation")) + }))))) + ); + else + applyMethodBody = applyMethodBody.AddStatements( + IfStatement(MemberAccess(changesVar, prop.Name, "IsSet"), + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(prop.Name), MemberAccess(changesVar, prop.Name, "Value")))) + + ); + + + resetBody = resetBody.AddStatements( + ExpressionStatement(InvocationExpression(MemberAccess(prop.Name, "Reset")))); + + if (animatedServer) + startAnimationBody = ApplyStartAnimation(startAnimationBody, prop, fieldName); + + getPropertyBody = ApplyGetProperty(getPropertyBody, prop); + serverGetPropertyBody = ApplyGetProperty(getPropertyBody, prop); + + if (prop.DefaultValue != null) + { + defaultsMethodBody = defaultsMethodBody.AddStatements( + ExpressionStatement( + AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(prop.Name), ParseExpression(prop.DefaultValue)))); + } + } + + if (cl is GBrush brush && !cl.Abstract) + { + var brushName = brush.Name.StripPrefix("Composition"); + /* + server = server.AddMembers( + MethodDeclaration(ParseTypeName("ICbBrush"), "CreateBackendBrush") + .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) + .WithExpressionBody(ArrowExpressionClause( + InvocationExpression(MemberAccess("Compositor", "Backend", "Create" + brushName)) + )).WithSemicolonToken(Semicolon()) + ); + if (!brush.CustomUpdate) + server = server.AddMembers( + MethodDeclaration(ParseTypeName("void"), "UpdateBackendBrush") + .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) + .AddParameterListParameters(Parameter(Identifier("brush")) + .WithType(ParseTypeName("ICbBrush"))) + .AddBodyStatements( + ExpressionStatement( + InvocationExpression( + MemberAccess( + ParenthesizedExpression( + CastExpression(ParseTypeName("ICb" + brushName), IdentifierName("brush"))), "Update"), + ArgumentList(SeparatedList(cl.Properties.Select(x => + { + if(x.Type.TrimEnd('?') == "ICompositionSurface") + return Argument( + ConditionalAccessExpression(IdentifierName(x.Name), + MemberBindingExpression(IdentifierName("BackendSurface"))) + ); + if (_brushes.Contains(x.Type)) + return Argument( + ConditionalAccessExpression(IdentifierName(x.Name), + MemberBindingExpression(IdentifierName("Brush"))) + ); + return Argument(IdentifierName(x.Name)); + })))) + ))); + +*/ + } + + server = server.AddMembers( + MethodDeclaration(ParseTypeName("void"), "ApplyCore") + .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) + .AddParameterListParameters( + Parameter(Identifier("changes")).WithType(ParseTypeName("ChangeSet"))) + .WithBody(applyMethodBody)); + + client = client.AddMembers( + MethodDeclaration(ParseTypeName("void"), "InitializeDefaults").WithBody(defaultsMethodBody)); + + transport = transport.AddMembers(MethodDeclaration(ParseTypeName("void"), "Reset") + .AddModifiers(SyntaxKind.PublicKeyword, SyntaxKind.OverrideKeyword) + .WithBody(resetBody.AddStatements( + ExpressionStatement(InvocationExpression(IdentifierName("ResetExtra"))), + ExpressionStatement(InvocationExpression(MemberAccess("base", "Reset")))))); + + if (list != null) + client = AppendListProxy(list, client); + + if (startAnimationBody.Statements.Count != 0) + client = WithStartAnimation(client, startAnimationBody); + + client = WithGetProperty(client, getPropertyBody, false); + server = WithGetProperty(server, serverGetPropertyBody, true); + + if(cl.Implements.Count > 0) + foreach (var impl in cl.Implements) + { + client = client.WithBaseList(client.BaseList.AddTypes(SimpleBaseType(ParseTypeName(impl.Name)))); + if (impl.ServerName != null) + server = server.WithBaseList( + server.BaseList.AddTypes(SimpleBaseType(ParseTypeName(impl.ServerName)))); + + client = client.AddMembers( + ParseMemberDeclaration($"{impl.ServerName} {impl.Name}.Server => Server;")); + } + + + SaveTo(unit.AddMembers(clientNs.AddMembers(client)), + cl.Name + ".generated.cs"); + SaveTo(unit.AddMembers(serverNs.AddMembers(server)), + "Server", "Server" + cl.Name + ".generated.cs"); + SaveTo(unit.AddMembers(transportNs.AddMembers(transport)), + "Transport", cl.Name + "Changes.generated.cs"); + } + + StatementSyntax GeneratePropertySetterAssignment(GProperty prop, string fieldName, bool isObject, bool isNullable) + { + var normalChangesAssignment = (StatementSyntax)ExpressionStatement(AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + MemberAccess((ExpressionSyntax) IdentifierName("Changes"), prop.Name, + "Value"), + isObject + ? + ConditionalMemberAccess(IdentifierName("value"), "Server", isNullable) + : IdentifierName("value"))); + if (!prop.Animated) + return normalChangesAssignment; + + var code = $@" +{{ + if(animation is CompositionAnimation a) + Changes.{prop.Name}.Animation = a.CreateInstance(this.Server, value); + else + {{ + var saved = Changes.{prop.Name}; + if(!StartAnimationGroup(animation, ""{prop.Name}"", value)) + Changes.{prop.Name}.Value = value; + }} +}} + +"; + + return IfStatement( + ParseExpression( + $"ImplicitAnimations != null && ImplicitAnimations.TryGetValue(\"{prop.Name}\", out var animation) == true"), + ParseStatement(code), + ElseClause(normalChangesAssignment) + ); + } + + BlockSyntax ApplyStartAnimation(BlockSyntax body, GProperty prop, string fieldName) + { + var code = $@" +if (propertyName == ""{prop.Name}"") +{{ +var current = {fieldName}; +var server = animation.CreateInstance(this.Server, finalValue); +Changes.{prop.Name}.Animation = server; +return; +}} +"; + return body.AddStatements(ParseStatement(code)); + } + + private static HashSet VariantPropertyTypes = new HashSet + { + "bool", + "float", + "Vector2", + "Vector3", + "Vector4", + "Matrix3x2", + "Matrix4x4", + "Quaternion", + "CompositionColor" + }; + + BlockSyntax ApplyGetProperty(BlockSyntax body, GProperty prop) + { + if (VariantPropertyTypes.Contains(prop.Type)) + return body.AddStatements( + ParseStatement($"if(name == \"{prop.Name}\")\n return {prop.Name};\n") + ); + + return body; + } + + ClassDeclarationSyntax WithGetProperty(ClassDeclarationSyntax cl, BlockSyntax body, bool server) + { + if (body.Statements.Count == 0) + return cl; + body = body.AddStatements( + ParseStatement("return base.GetPropertyForAnimation(name);")); + var method = ((MethodDeclarationSyntax) ParseMemberDeclaration( + $"{(server ? "public" : "internal")} override Avalonia.Rendering.Composition.Expressions.ExpressionVariant GetPropertyForAnimation(string name){{}}")) + .WithBody(body); + + return cl.AddMembers(method); + } + + ClassDeclarationSyntax WithStartAnimation(ClassDeclarationSyntax cl, BlockSyntax body) + { + body = body.AddStatements( + ExpressionStatement(InvocationExpression(MemberAccess("base", "StartAnimation"), + ArgumentList(SeparatedList(new[] + { + Argument(IdentifierName("propertyName")), + Argument(IdentifierName("animation")), + Argument(IdentifierName("finalValue")), + })))) + ); + return cl.AddMembers( + ((MethodDeclarationSyntax) ParseMemberDeclaration( + "internal override void StartAnimation(string propertyName, CompositionAnimation animation, Avalonia.Rendering.Composition.Expressions.ExpressionVariant? finalValue){}")) + .WithBody(body)); + + + } + + } +} \ No newline at end of file diff --git a/src/Avalonia.X11/X11Platform.cs b/src/Avalonia.X11/X11Platform.cs index ec3f29c806..7a64b39575 100644 --- a/src/Avalonia.X11/X11Platform.cs +++ b/src/Avalonia.X11/X11Platform.cs @@ -13,6 +13,7 @@ using Avalonia.OpenGL; using Avalonia.OpenGL.Egl; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.Rendering.Composition; using Avalonia.X11; using Avalonia.X11.Glx; using Avalonia.X11.NativeDialogs; @@ -29,6 +30,7 @@ namespace Avalonia.X11 public XI2Manager XI2; public X11Info Info { get; private set; } public IX11Screens X11Screens { get; private set; } + public Compositor Compositor { get; private set; } public IScreenImpl Screens { get; private set; } public X11PlatformOptions Options { get; private set; } public IntPtr OrphanedWindow { get; private set; } @@ -101,7 +103,9 @@ namespace Avalonia.X11 GlxPlatformOpenGlInterface.TryInitialize(Info, Options.GlProfiles); } - + if (options.UseCompositor) + Compositor = Compositor.Create(AvaloniaLocator.Current.GetService()!); + } public IntPtr DeferredDisplay { get; set; } @@ -222,6 +226,8 @@ namespace Avalonia /// Immediate re-renders the whole scene when some element is changed on the scene. Deferred re-renders only changed elements. /// public bool UseDeferredRendering { get; set; } = true; + + public bool UseCompositor { get; set; } /// /// Determines whether to use IME. diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index 066156a652..37cfeb0624 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -18,6 +18,7 @@ using Avalonia.OpenGL; using Avalonia.OpenGL.Egl; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.Rendering.Composition; using Avalonia.Threading; using Avalonia.X11.Glx; using static Avalonia.X11.XLib; @@ -360,13 +361,15 @@ namespace Avalonia.X11 if (customRendererFactory != null) return customRendererFactory.Create(root, loop); - - return _platform.Options.UseDeferredRendering ? - new DeferredRenderer(root, loop) - { - RenderOnlyOnRenderThread = true - } : - (IRenderer)new X11ImmediateRendererProxy(root, loop); + + return _platform.Options.UseDeferredRendering + ? _platform.Options.UseCompositor + ? new CompositingRenderer(root, this._platform.Compositor) + : new DeferredRenderer(root, loop) + { + RenderOnlyOnRenderThread = true + } + : (IRenderer)new X11ImmediateRendererProxy(root, loop); } void OnEvent(ref XEvent ev) diff --git a/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs index a259d8fab9..1243c90214 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Numerics; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Rendering; @@ -73,6 +74,12 @@ namespace Avalonia.Direct2D1.Media set { _deviceContext.Transform = value.ToDirect2D(); } } + public Matrix4x4 Transform4x4 + { + get => throw new NotSupportedException(); + set => throw new NotSupportedException(); + } + /// public void Clear(Color color) { From 4274e78a321b37412c77915638535e1d12304c6e Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 9 May 2022 21:43:22 +0300 Subject: [PATCH 030/393] Win32 --- samples/ControlCatalog.NetCore/Program.cs | 3 ++- .../Rendering/Composition/CompositingRenderer.cs | 4 ++-- src/Windows/Avalonia.Win32/Win32Platform.cs | 8 ++++++++ src/Windows/Avalonia.Win32/WindowImpl.cs | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 2a0755b900..6196aac153 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -115,7 +115,8 @@ namespace ControlCatalog.NetCore }) .With(new Win32PlatformOptions { - EnableMultitouch = true + EnableMultitouch = true, + UseCompositor = true }) .UseSkia() .AfterSetup(builder => diff --git a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs index 07ac54b634..65ed0d17ad 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs @@ -177,7 +177,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor public void Stop() { - _target.IsEnabled = true; + _target.IsEnabled = false; } public void Dispose() @@ -191,4 +191,4 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor public Compositor Compositor => _compositor; -} \ No newline at end of file +} diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index dc5e5324c4..32705a2cc6 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -14,6 +14,7 @@ using Avalonia.Input.Platform; using Avalonia.OpenGL; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.Rendering.Composition; using Avalonia.Threading; using Avalonia.Utilities; using Avalonia.Win32.Input; @@ -48,6 +49,8 @@ namespace Avalonia /// Immediate re-renders the whole scene when some element is changed on the scene. Deferred re-renders only changed elements. /// public bool UseDeferredRendering { get; set; } = true; + + public bool UseCompositor { get; set; } /// /// Enables ANGLE for Windows. For every Windows version that is above Windows 7, the default is true otherwise it's false. @@ -132,6 +135,8 @@ namespace Avalonia.Win32 public static bool UseDeferredRendering => Options.UseDeferredRendering; internal static bool UseOverlayPopups => Options.OverlayPopups; public static Win32PlatformOptions Options { get; private set; } + + internal static Compositor Compositor { get; private set; } public Size DoubleClickSize => new Size( UnmanagedMethods.GetSystemMetrics(UnmanagedMethods.SystemMetric.SM_CXDOUBLECLK), @@ -181,6 +186,9 @@ namespace Avalonia.Win32 if (OleContext.Current != null) AvaloniaLocator.CurrentMutable.Bind().ToSingleton(); + + if (Options.UseCompositor) + Compositor = Compositor.Create(AvaloniaLocator.Current.GetRequiredService()); } public bool HasMessages() diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index f0036236ec..e61121f23e 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -14,6 +14,7 @@ using Avalonia.OpenGL.Egl; using Avalonia.OpenGL.Surfaces; using Avalonia.Platform; using Avalonia.Rendering; +using Avalonia.Rendering.Composition; using Avalonia.Win32.Automation; using Avalonia.Win32.Input; using Avalonia.Win32.Interop; @@ -500,6 +501,9 @@ namespace Avalonia.Win32 if (customRendererFactory != null) return customRendererFactory.Create(root, loop); + if (Win32Platform.Compositor != null) + return new CompositingRenderer(root, Win32Platform.Compositor); + return Win32Platform.UseDeferredRendering ? _isUsingComposition ? new DeferredRenderer(root, loop) From 7a3b5f051f02e2e0689df3232ffac5b76f6d986b Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 9 May 2022 23:20:39 +0300 Subject: [PATCH 031/393] Make ThreadSafeObjectPool actually thread safe --- src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs b/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs index c6845485dc..05995f2069 100644 --- a/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs +++ b/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs @@ -5,7 +5,6 @@ namespace Avalonia.Threading public class ThreadSafeObjectPool where T : class, new() { private Stack _stack = new Stack(); - private object _lock = new object(); public static ThreadSafeObjectPool Default { get; } = new ThreadSafeObjectPool(); public T Get() @@ -20,7 +19,7 @@ namespace Avalonia.Threading public void Return(T obj) { - lock (_stack) + lock (_lock) { _stack.Push(obj); } From 6d46006d075e05a4de377e8f85b1b93199e348f3 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 9 May 2022 23:30:02 +0300 Subject: [PATCH 032/393] Removed some matrix operations --- .../Composition/Expressions/ExpressionVariant.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs index 8c6af5cb0c..086c8ce276 100644 --- a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionVariant.cs @@ -290,9 +290,6 @@ namespace Avalonia.Rendering.Composition.Expressions if (left.Type == VariantType.Matrix3x2) return left.Matrix3x2 + right.Matrix3x2; - if (left.Type == VariantType.AvaloniaMatrix) - return left.AvaloniaMatrix + right.AvaloniaMatrix; - if (left.Type == VariantType.Matrix4x4) return left.Matrix4x4 + right.Matrix4x4; @@ -325,9 +322,6 @@ namespace Avalonia.Rendering.Composition.Expressions if (left.Type == VariantType.Matrix3x2) return left.Matrix3x2 - right.Matrix3x2; - if (left.Type == VariantType.AvaloniaMatrix) - return left.AvaloniaMatrix - right.AvaloniaMatrix; - if (left.Type == VariantType.Matrix4x4) return left.Matrix4x4 - right.Matrix4x4; @@ -407,12 +401,6 @@ namespace Avalonia.Rendering.Composition.Expressions if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.AvaloniaMatrix) return left.AvaloniaMatrix * right.AvaloniaMatrix; - - if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.Scalar) - return left.AvaloniaMatrix * (double)right.Scalar; - - if (left.Type == VariantType.AvaloniaMatrix && right.Type == VariantType.Double) - return left.AvaloniaMatrix * right.Double; if (left.Type == VariantType.Matrix4x4 && right.Type == VariantType.Matrix4x4) return left.Matrix4x4 * right.Matrix4x4; From 16dde385d0d8c6b9f7711a801b67a8f4440b3a57 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 11 May 2022 00:59:00 +0300 Subject: [PATCH 033/393] WIP: Matrix3x3, some invalidation support, dirty rects drawing --- samples/RenderDemo/App.xaml.cs | 4 + .../Composition/CompositingRenderer.cs | 26 ++++-- .../Composition/CompositionDrawListVisual.cs | 3 +- .../Composition/CompositionTarget.cs | 24 +++--- .../Rendering/Composition/Compositor.cs | 1 + .../Rendering/Composition/MatrixUtils.cs | 20 +++++ .../Composition/Server/DrawingContextProxy.cs | 4 - .../Composition/Server/FpsCounter.cs | 73 ++++++++++++++++ .../Server/ServerCompositionDrawListVisual.cs | 20 +++++ .../Server/ServerCompositionTarget.cs | 83 ++++++++++++++++++- .../Server/ServerContainerVisual.cs | 7 ++ .../Server/ServerSolidColorVisual.cs | 2 +- .../Composition/Server/ServerVisual.cs | 52 ++++++++---- .../Transport/CompositionTargetChanges.cs | 11 +++ .../Rendering/Composition/Visual.cs | 2 +- .../Rendering/Composition/VisualCollection.cs | 5 ++ .../Threading/ThreadSafeObjectPool.cs | 4 +- src/Avalonia.Base/composition-schema.xml | 4 + 18 files changed, 297 insertions(+), 48 deletions(-) create mode 100644 src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs diff --git a/samples/RenderDemo/App.xaml.cs b/samples/RenderDemo/App.xaml.cs index 8054b06964..8f4e02df01 100644 --- a/samples/RenderDemo/App.xaml.cs +++ b/samples/RenderDemo/App.xaml.cs @@ -29,6 +29,10 @@ namespace RenderDemo .With(new Win32PlatformOptions { OverlayPopups = true, + }) + .With(new X11PlatformOptions + { + UseCompositor = true }) .UsePlatformDetect() .LogToTrace(); diff --git a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs index 07ac54b634..22fc6a77d4 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs @@ -37,9 +37,19 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor _target.Root = ((Visual)root!.VisualRoot!).AttachToCompositor(compositor); _update = Update; } - - public bool DrawFps { get; set; } - public bool DrawDirtyRects { get; set; } + + public bool DrawFps + { + get => _target.DrawFps; + set => _target.DrawFps = value; + } + + public bool DrawDirtyRects + { + get => _target.DrawDirtyRects; + set => _target.DrawDirtyRects = value; + } + public event EventHandler? SceneInvalidated; void QueueUpdate() @@ -57,7 +67,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor public IEnumerable HitTest(Point p, IVisual root, Func filter) { - var res = _target.TryHitTest(new Vector2((float)p.X, (float)p.Y)); + var res = _target.TryHitTest(p); if(res == null) yield break; for (var index = res.Count - 1; index >= 0; index--) @@ -146,7 +156,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor renderTransform *= mirrorMatrix; } - comp.TransformMatrix = renderTransform; + comp.TransformMatrix = MatrixUtils.ToMatrix4x4(renderTransform); _recorder.BeginUpdate(comp.DrawList ?? new CompositionDrawList()); visual.Render(_recordingContext); @@ -159,6 +169,8 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor SyncChildren(v); _dirty.Clear(); _recalculateChildren.Clear(); + _target.Size = _root.ClientSize; + _target.Scaling = _root.RenderScaling; } public void Resized(Size size) @@ -169,7 +181,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor { // We render only on the render thread for now Update(); - + _target.RequestRedraw(); Compositor.RequestCommitAsync().Wait(); } @@ -177,7 +189,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor public void Stop() { - _target.IsEnabled = true; + _target.IsEnabled = false; } public void Dispose() diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs index 9f02055412..b19c311663 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -29,11 +29,10 @@ internal class CompositionDrawListVisual : CompositionContainerVisual Visual = visual; } - internal override bool HitTest(Vector2 point) + internal override bool HitTest(Point pt) { if (DrawList == null) return false; - var pt = new Point(point.X, point.Y); if (Visual is ICustomHitTest custom) return custom.HitTest(pt); foreach (var op in DrawList) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs index a8835ca668..8d052389c2 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs @@ -18,7 +18,7 @@ namespace Avalonia.Rendering.Composition Root.Root = null; } - public PooledList? TryHitTest(Vector2 point) + public PooledList? TryHitTest(Point point) { Server.Readback.NextRead(); if (Root == null) @@ -28,12 +28,12 @@ namespace Avalonia.Rendering.Composition return res; } - public Vector2? TryTransformToVisual(CompositionVisual visual, Vector2 point) + public Point? TryTransformToVisual(CompositionVisual visual, Point point) { if (visual.Root != this) return null; var v = visual; - var m = Matrix3x2.Identity; + var m = Matrix.Identity; while (v != null) { if (!TryGetInvertedTransform(v, out var cm)) @@ -42,10 +42,10 @@ namespace Avalonia.Rendering.Composition v = v.Parent; } - return Vector2.Transform(point, m); + return point * m; } - bool TryGetInvertedTransform(CompositionVisual visual, out Matrix3x2 matrix) + bool TryGetInvertedTransform(CompositionVisual visual, out Matrix matrix) { var m = visual.TryGetServerTransform(); if (m == null) @@ -54,24 +54,22 @@ namespace Avalonia.Rendering.Composition return false; } - // TODO: Use Matrix3x3 - var m32 = new Matrix3x2(m.Value.M11, m.Value.M12, m.Value.M21, m.Value.M22, m.Value.M41, m.Value.M42); - - return Matrix3x2.Invert(m32, out matrix); + var m33 = MatrixUtils.ToMatrix(m.Value); + return m33.TryInvert(out matrix); } - bool TryTransformTo(CompositionVisual visual, ref Vector2 v) + bool TryTransformTo(CompositionVisual visual, ref Point v) { if (TryGetInvertedTransform(visual, out var m)) { - v = Vector2.Transform(v, m); + v = v * m; return true; } return false; } - bool HitTestCore(CompositionVisual visual, Vector2 point, PooledList result) + bool HitTestCore(CompositionVisual visual, Point point, PooledList result) { //TODO: Check readback too if (visual.Visible == false) @@ -103,5 +101,7 @@ namespace Avalonia.Rendering.Composition return false; } + + public void RequestRedraw() => Changes.RedrawRequested.Value = true; } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Compositor.cs b/src/Avalonia.Base/Rendering/Composition/Compositor.cs index 217d8dd803..14d779dbc4 100644 --- a/src/Avalonia.Base/Rendering/Composition/Compositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Compositor.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Numerics; using System.Threading.Tasks; +using Avalonia.Media; using Avalonia.Platform; using Avalonia.Rendering.Composition.Animations; using Avalonia.Rendering.Composition.Server; diff --git a/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs b/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs index 5e91bcb3d4..2cb500cae4 100644 --- a/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs +++ b/src/Avalonia.Base/Rendering/Composition/MatrixUtils.cs @@ -42,5 +42,25 @@ namespace Avalonia.Rendering.Composition return mat; } + + public static Matrix4x4 ToMatrix4x4(Matrix matrix) => + new Matrix4x4( + (float)matrix.M11, (float)matrix.M12, 0, (float)matrix.M13, + (float)matrix.M21, (float)matrix.M22, 0, (float)matrix.M23, + 0, 0, 1, 0, + (float)matrix.M31, (float)matrix.M32, 0, (float)matrix.M33 + ); + + public static Matrix ToMatrix(Matrix4x4 matrix44) => + new Matrix( + matrix44.M11, + matrix44.M12, + matrix44.M14, + matrix44.M21, + matrix44.M22, + matrix44.M24, + matrix44.M41, + matrix44.M42, + matrix44.M44); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs index f5dfa92897..7d061e86a9 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs @@ -135,8 +135,4 @@ internal class CompositorDrawingContextProxy : IDrawingContextImpl { _impl.Custom(custom); } - - public Matrix CutTransform(Matrix4x4 transform) => new Matrix(transform.M11, transform.M12, transform.M21, - transform.M22, transform.M41, - transform.M42); } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs b/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs new file mode 100644 index 0000000000..8c2e6e774a --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs @@ -0,0 +1,73 @@ +using System; +using System.Diagnostics; +using System.Globalization; +using Avalonia.Media; +using Avalonia.Media.TextFormatting; +using Avalonia.Platform; +using Avalonia.Utilities; + +namespace Avalonia.Rendering.Composition.Server; + +internal class FpsCounter +{ + private readonly GlyphTypeface _typeface; + private readonly bool _useManualFpsCounting; + private readonly Stopwatch _stopwatch = Stopwatch.StartNew(); + private int _framesThisSecond; + private int _fps; + private TimeSpan _lastFpsUpdate; + private GlyphRun[] _runs = new GlyphRun[10]; + + public FpsCounter(GlyphTypeface typeface, bool useManualFpsCounting = false) + { + for (var c = 0; c <= 9; c++) + { + var s = c.ToString(); + var glyph = typeface.GetGlyph((uint)(s[0])); + _runs[c] = new GlyphRun(typeface, 18, new ReadOnlySlice(s.AsMemory()), new ushort[] { glyph }); + } + _typeface = typeface; + _useManualFpsCounting = useManualFpsCounting; + } + + public void FpsTick() => _framesThisSecond++; + + public void RenderFps(IDrawingContextImpl context) + { + var now = _stopwatch.Elapsed; + var elapsed = now - _lastFpsUpdate; + + if (!_useManualFpsCounting) + ++_framesThisSecond; + + if (elapsed.TotalSeconds > 1) + { + _fps = (int)(_framesThisSecond / elapsed.TotalSeconds); + _framesThisSecond = 0; + _lastFpsUpdate = now; + } + + var fpsLine = _fps.ToString("000"); + double width = 0; + double height = 0; + foreach (var ch in fpsLine) + { + var run = _runs[ch - '0']; + width += run.Size.Width; + height = Math.Max(height, run.Size.Height); + } + + var rect = new Rect(0, 0, width + 3, height + 3); + + context.DrawRectangle(Brushes.Black, null, rect); + + double offset = 0; + foreach (var ch in fpsLine) + { + var run = _runs[ch - '0']; + context.Transform = Matrix.CreateTranslation(offset, 0); + context.DrawGlyphRun(Brushes.White, run); + offset += run.Size.Width; + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs index 397c968d04..f0384c36fc 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs @@ -16,6 +16,25 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua { } + Rect? _contentBounds; + + public override Rect ContentBounds + { + get + { + if (_contentBounds == null) + { + var rect = Rect.Empty; + if(_renderCommands!=null) + foreach (var cmd in _renderCommands) + rect = rect.Union(cmd.Item.Bounds); + _contentBounds = rect; + } + + return _contentBounds.Value; + } + } + protected override void ApplyCore(ChangeSet changes) { var ch = (DrawListVisualChanges)changes; @@ -23,6 +42,7 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua { _renderCommands?.Dispose(); _renderCommands = ch.AcquireDrawCommands(); + _contentBounds = null; } base.ApplyCore(changes); } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index 493529e111..04ec711455 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -2,7 +2,10 @@ using System; using System.Numerics; using System.Threading; using Avalonia.Media; +using Avalonia.Media.Immutable; using Avalonia.Platform; +using Avalonia.Rendering.Composition.Transport; +using Avalonia.Utilities; namespace Avalonia.Rendering.Composition.Server { @@ -14,6 +17,13 @@ namespace Avalonia.Rendering.Composition.Server public long Id { get; } private ulong _frame = 1; private IRenderTarget? _renderTarget; + private FpsCounter _fpsCounter = new FpsCounter(Typeface.Default.GlyphTypeface); + private Rect _dirtyRect; + private Random _random = new(); + private Size _layerSize; + private IDrawingContextLayerImpl? _layer; + private bool _redrawRequested; + public ReadbackIndices Readback { get; } = new(); @@ -33,6 +43,11 @@ namespace Avalonia.Rendering.Composition.Server _compositor.RemoveCompositionTarget(this); } + partial void ApplyChangesExtra(CompositionTargetChanges c) + { + _redrawRequested = true; + } + public void Render() { if (Root == null) @@ -40,14 +55,76 @@ namespace Avalonia.Rendering.Composition.Server _renderTarget ??= _renderTargetFactory(); Compositor.UpdateServerTime(); - using (var context = _renderTarget.CreateDrawingContext(null)) + + Root.Update(this, Matrix4x4.Identity); + + if(_dirtyRect.IsEmpty && !_redrawRequested) + return; + _redrawRequested = false; + using (var targetContext = _renderTarget.CreateDrawingContext(null)) { - context.Clear(Colors.Transparent); - Root.Render(new CompositorDrawingContextProxy(context), Root.CombinedTransformMatrix); + var layerSize = Size * Scaling; + if (layerSize != _layerSize || _layer == null) + { + _layer?.Dispose(); + _layer = null; + _layer = targetContext.CreateLayer(layerSize); + _layerSize = layerSize; + } + + if (!_dirtyRect.IsEmpty) + { + using (var context = _layer.CreateDrawingContext(null)) + { + context.PushClip(_dirtyRect); + context.Clear(Colors.Transparent); + Root.Render(new CompositorDrawingContextProxy(context), Root.CombinedTransformMatrix); + context.PopClip(); + } + } + + targetContext.DrawBitmap(RefCountable.CreateUnownedNotClonable(_layer), 1, new Rect(_layerSize), + new Rect(_layerSize)); + + + if (DrawDirtyRects) + { + targetContext.DrawRectangle(new ImmutableSolidColorBrush( + new Color(30, (byte)_random.Next(255), (byte)_random.Next(255), + (byte)_random.Next(255))) + , null, _dirtyRect); + } + + if(DrawFps) + _fpsCounter.RenderFps(targetContext); + _dirtyRect = Rect.Empty; + } Readback.NextWrite(_frame); _frame++; } + + private static Rect SnapToDevicePixels(Rect rect, double scale) + { + return new Rect( + new Point( + Math.Floor(rect.X * scale) / scale, + Math.Floor(rect.Y * scale) / scale), + new Point( + Math.Ceiling(rect.Right * scale) / scale, + Math.Ceiling(rect.Bottom * scale) / scale)); + } + + public void AddDirtyRect(Rect rect) + { + var snapped = SnapToDevicePixels(rect, Scaling); + _dirtyRect = _dirtyRect.Union(snapped); + } + + public void Invalidate() + { + _redrawRequested = true; + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs index ac112b846f..3f0995b257 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs @@ -21,6 +21,13 @@ namespace Avalonia.Rendering.Composition.Server } } + public override void Update(ServerCompositionTarget root, Matrix4x4 transform) + { + base.Update(root, transform); + foreach (var child in Children) + child.Update(root, GlobalTransformMatrix); + } + public ServerCompositionContainerVisual(ServerCompositor compositor) : base(compositor) { Children = new ServerCompositionVisualCollection(compositor); diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs index 60569867de..786779bb2d 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerSolidColorVisual.cs @@ -8,7 +8,7 @@ namespace Avalonia.Rendering.Composition.Server { protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { - canvas.Transform = canvas.CutTransform(transform); + canvas.Transform = MatrixUtils.ToMatrix(transform); canvas.DrawRectangle(new ImmutableSolidColorBrush(Color), null, new RoundedRect(new Rect(new Size(Size)))); base.RenderCore(canvas, transform); } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 37e188fb47..90b580bfa7 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -6,6 +6,7 @@ namespace Avalonia.Rendering.Composition.Server { unsafe partial class ServerCompositionVisual : ServerObject { + private bool _isDirty; protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { @@ -17,7 +18,7 @@ namespace Avalonia.Rendering.Composition.Server return; if(Opacity == 0) return; - canvas.PreTransform = canvas.CutTransform(transform); + canvas.PreTransform = MatrixUtils.ToMatrix(transform); canvas.Transform = Matrix.Identity; if (Opacity != 1) canvas.PushOpacity(Opacity); @@ -25,7 +26,8 @@ namespace Avalonia.Rendering.Composition.Server canvas.PushClip(new Rect(new Size(Size.X, Size.Y))); if (Clip != null) canvas.PushGeometryClip(Clip); - + + //TODO: Check clip RenderCore(canvas, transform); if (Clip != null) @@ -48,22 +50,31 @@ namespace Avalonia.Rendering.Composition.Server return ref _readback2; } - public Matrix4x4 CombinedTransformMatrix + public Matrix4x4 CombinedTransformMatrix { get; private set; } + public Matrix4x4 GlobalTransformMatrix { get; private set; } + + public virtual void Update(ServerCompositionTarget root, Matrix4x4 transform) { - get + var res = MatrixUtils.ComputeTransform(Size, AnchorPoint, CenterPoint, TransformMatrix, + Scale, RotationAngle, Orientation, Offset); + var i = Root!.Readback; + ref var readback = ref GetReadback(i.WriteIndex); + readback.Revision = i.WriteRevision; + readback.Matrix = res; + readback.TargetId = Root.Id; + //TODO: check effective opacity too + IsVisibleInFrame = Visible && Opacity > 0; + CombinedTransformMatrix = res; + GlobalTransformMatrix = res * transform; + //TODO: Cache + TransformedBounds = ContentBounds.TransformToAABB(MatrixUtils.ToMatrix(GlobalTransformMatrix)); + + if (!IsVisibleInFrame) + _isDirty = false; + else if (_isDirty) { - if (Root == null) - return default; - - var res = MatrixUtils.ComputeTransform(Size, AnchorPoint, CenterPoint, TransformMatrix, - Scale, RotationAngle, Orientation, Offset); - var i = Root.Readback; - ref var readback = ref GetReadback(i.WriteIndex); - readback.Revision = i.WriteRevision; - readback.Matrix = res; - readback.TargetId = Root.Id; - - return res; + Root.AddDirtyRect(TransformedBounds); + _isDirty = false; } } @@ -81,11 +92,20 @@ namespace Avalonia.Rendering.Composition.Server Parent = c.Parent.Value; if (c.Root.IsSet) Root = c.Root.Value; + _isDirty = true; + + if (IsVisibleInFrame) + Root?.AddDirtyRect(TransformedBounds); + else + Root?.Invalidate(); } public ServerCompositionTarget? Root { get; private set; } public ServerCompositionVisual? Parent { get; private set; } + public bool IsVisibleInFrame { get; set; } + public Rect TransformedBounds { get; set; } + public virtual Rect ContentBounds => new Rect(0, 0, Size.X, Size.Y); } diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs new file mode 100644 index 0000000000..014adc7bbe --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs @@ -0,0 +1,11 @@ +namespace Avalonia.Rendering.Composition.Transport; + +partial class CompositionTargetChanges +{ + public Change RedrawRequested; + + partial void ResetExtra() + { + RedrawRequested.Reset(); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index 1e6d7f8abb..25fce01de3 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -59,6 +59,6 @@ namespace Avalonia.Rendering.Composition internal object? Tag { get; set; } - internal virtual bool HitTest(Vector2 point) => true; + internal virtual bool HitTest(Point point) => true; } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs index 35f33c3b38..fef4caf675 100644 --- a/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs +++ b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs @@ -54,6 +54,11 @@ namespace Avalonia.Rendering.Composition partial void OnRemoved(CompositionVisual item) => item.Parent = null; + partial void OnBeforeClear() + { + foreach (var i in this) + i.Parent = null; + } partial void OnBeforeAdded(CompositionVisual item) { diff --git a/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs b/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs index 05995f2069..827a02334a 100644 --- a/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs +++ b/src/Avalonia.Base/Threading/ThreadSafeObjectPool.cs @@ -9,7 +9,7 @@ namespace Avalonia.Threading public T Get() { - lock (_lock) + lock (_stack) { if(_stack.Count == 0) return new T(); @@ -19,7 +19,7 @@ namespace Avalonia.Threading public void Return(T obj) { - lock (_lock) + lock (_stack) { _stack.Push(obj); } diff --git a/src/Avalonia.Base/composition-schema.xml b/src/Avalonia.Base/composition-schema.xml index cf864dac2d..eb1ffe1922 100644 --- a/src/Avalonia.Base/composition-schema.xml +++ b/src/Avalonia.Base/composition-schema.xml @@ -25,6 +25,10 @@ + + + + From 0e8672017b4ba40c78413dc73a1e2ba0dcad971a Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 11 May 2022 20:08:14 +0300 Subject: [PATCH 034/393] Workaround for #8118 --- src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 90b580bfa7..bf5b8bf292 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -30,6 +30,9 @@ namespace Avalonia.Rendering.Composition.Server //TODO: Check clip RenderCore(canvas, transform); + canvas.PreTransform = MatrixUtils.ToMatrix(transform); + canvas.Transform = Matrix.Identity; + if (Clip != null) canvas.PopGeometryClip(); if (ClipToBounds) From b2556d62f5e5c6869ef8baf890a5688d024a93e5 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 16 May 2022 11:40:25 +0200 Subject: [PATCH 035/393] Fix some layout rounding issues. Fixes for #8092: - Always round sizes up, not to the nearest pixel, thereby ensuring that `DesiredSize`s don't get rounded down where possible. - Apply rounding to `Padding` and `BorderThickness` in measure pass as well as arrange pass, to ensure that `DesiredSize` takes this rounding into account. --- src/Avalonia.Base/Layout/LayoutHelper.cs | 71 ++++++++- src/Avalonia.Base/Layout/Layoutable.cs | 24 +-- src/Avalonia.Base/Point.cs | 14 +- .../DataGridColumn.cs | 2 +- .../Presenters/ContentPresenter.cs | 4 +- .../Layout/LayoutableTests.cs | 31 ---- .../Layout/LayoutableTests_LayoutRounding.cs | 140 ++++++++++++++++++ .../Rendering/SceneGraph/SceneBuilderTests.cs | 1 + .../BorderTests.cs | 65 ++++++++ .../DecoratorTests.cs | 41 +++++ .../ContentPresenterTests_Layout.cs | 66 ++++++++- .../Primitives/TrackTests.cs | 4 +- tests/Avalonia.UnitTests/TestRoot.cs | 7 +- ...estrictedHeight_VerticalAlign.expected.png | Bin 752 -> 767 bytes ...estrictedHeight_VerticalAlign.expected.png | Bin 557 -> 532 bytes 15 files changed, 414 insertions(+), 56 deletions(-) create mode 100644 tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_LayoutRounding.cs diff --git a/src/Avalonia.Base/Layout/LayoutHelper.cs b/src/Avalonia.Base/Layout/LayoutHelper.cs index d24be57d2b..404d19906a 100644 --- a/src/Avalonia.Base/Layout/LayoutHelper.cs +++ b/src/Avalonia.Base/Layout/LayoutHelper.cs @@ -36,11 +36,28 @@ namespace Avalonia.Layout public static Size MeasureChild(ILayoutable? control, Size availableSize, Thickness padding, Thickness borderThickness) { - return MeasureChild(control, availableSize, padding + borderThickness); + if (IsParentLayoutRounded(control, out double scale)) + { + padding = RoundLayoutThickness(padding, scale, scale); + borderThickness = RoundLayoutThickness(borderThickness, scale, scale); + } + + if (control != null) + { + control.Measure(availableSize.Deflate(padding + borderThickness)); + return control.DesiredSize.Inflate(padding + borderThickness); + } + + return new Size().Inflate(padding + borderThickness); } public static Size MeasureChild(ILayoutable? control, Size availableSize, Thickness padding) { + if (IsParentLayoutRounded(control, out double scale)) + { + padding = RoundLayoutThickness(padding, scale, scale); + } + if (control != null) { control.Measure(availableSize.Deflate(padding)); @@ -137,7 +154,7 @@ namespace Avalonia.Layout /// /// Rounds a size to integer values for layout purposes, compensating for high DPI screen - /// coordinates. + /// coordinates by rounding the size up to the nearest pixel. /// /// Input size. /// DPI along x-dimension. @@ -149,9 +166,9 @@ namespace Avalonia.Layout /// associated with the UseLayoutRounding property and should not be used as a general rounding /// utility. /// - public static Size RoundLayoutSize(Size size, double dpiScaleX, double dpiScaleY) + public static Size RoundLayoutSizeUp(Size size, double dpiScaleX, double dpiScaleY) { - return new Size(RoundLayoutValue(size.Width, dpiScaleX), RoundLayoutValue(size.Height, dpiScaleY)); + return new Size(RoundLayoutValueUp(size.Width, dpiScaleX), RoundLayoutValueUp(size.Height, dpiScaleY)); } /// @@ -178,10 +195,9 @@ namespace Avalonia.Layout ); } - - /// - /// Calculates the value to be used for layout rounding at high DPI. + /// Calculates the value to be used for layout rounding at high DPI by rounding the value + /// up or down to the nearest pixel. /// /// Input value to be rounded. /// Ratio of screen's DPI to layout DPI @@ -217,7 +233,46 @@ namespace Avalonia.Layout return newValue; } - + + /// + /// Calculates the value to be used for layout rounding at high DPI by rounding the value up + /// to the nearest pixel. + /// + /// Input value to be rounded. + /// Ratio of screen's DPI to layout DPI + /// Adjusted value that will produce layout rounding on screen at high dpi. + /// + /// This is a layout helper method. It takes DPI into account and also does not return + /// the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper + /// associated with the UseLayoutRounding property and should not be used as a general rounding + /// utility. + /// + public static double RoundLayoutValueUp(double value, double dpiScale) + { + double newValue; + + // If DPI == 1, don't use DPI-aware rounding. + if (!MathUtilities.IsOne(dpiScale)) + { + newValue = Math.Ceiling(value * dpiScale) / dpiScale; + + // If rounding produces a value unacceptable to layout (NaN, Infinity or MaxValue), + // use the original value. + if (double.IsNaN(newValue) || + double.IsInfinity(newValue) || + MathUtilities.AreClose(newValue, double.MaxValue)) + { + newValue = value; + } + } + else + { + newValue = Math.Ceiling(value); + } + + return newValue; + } + /// /// Calculates the min and max height for a control. Ported from WPF. /// diff --git a/src/Avalonia.Base/Layout/Layoutable.cs b/src/Avalonia.Base/Layout/Layoutable.cs index df7aa937a0..0b74d5915a 100644 --- a/src/Avalonia.Base/Layout/Layoutable.cs +++ b/src/Avalonia.Base/Layout/Layoutable.cs @@ -549,6 +549,14 @@ namespace Avalonia.Layout if (IsVisible) { var margin = Margin; + var useLayoutRounding = UseLayoutRounding; + var scale = 1.0; + + if (useLayoutRounding) + { + scale = LayoutHelper.GetLayoutScale(this); + margin = LayoutHelper.RoundLayoutThickness(margin, scale, scale); + } ApplyStyling(); ApplyTemplate(); @@ -585,16 +593,14 @@ namespace Avalonia.Layout height = Math.Min(height, MaxHeight); height = Math.Max(height, MinHeight); - width = Math.Min(width, availableSize.Width); - height = Math.Min(height, availableSize.Height); - - if (UseLayoutRounding) + if (useLayoutRounding) { - var scale = LayoutHelper.GetLayoutScale(this); - width = LayoutHelper.RoundLayoutValue(width, scale); - height = LayoutHelper.RoundLayoutValue(height, scale); + (width, height) = LayoutHelper.RoundLayoutSizeUp(new Size(width, height), scale, scale); } + width = Math.Min(width, availableSize.Width); + height = Math.Min(height, availableSize.Height); + return NonNegative(new Size(width, height).Inflate(margin)); } else @@ -679,8 +685,8 @@ namespace Avalonia.Layout if (useLayoutRounding) { - size = LayoutHelper.RoundLayoutSize(size, scale, scale); - availableSizeMinusMargins = LayoutHelper.RoundLayoutSize(availableSizeMinusMargins, scale, scale); + size = LayoutHelper.RoundLayoutSizeUp(size, scale, scale); + availableSizeMinusMargins = LayoutHelper.RoundLayoutSizeUp(availableSizeMinusMargins, scale, scale); } size = ArrangeOverride(size).Constrain(size); diff --git a/src/Avalonia.Base/Point.cs b/src/Avalonia.Base/Point.cs index 67e7d71fbc..2f226caff4 100644 --- a/src/Avalonia.Base/Point.cs +++ b/src/Avalonia.Base/Point.cs @@ -192,7 +192,7 @@ namespace Avalonia } /// - /// Returns a boolean indicating whether the point is equal to the other given point. + /// Returns a boolean indicating whether the point is equal to the other given point (bitwise). /// /// The other point to test equality against. /// True if this point is equal to other; False otherwise. @@ -204,6 +204,18 @@ namespace Avalonia // ReSharper enable CompareOfFloatsByEqualityOperator } + /// + /// Returns a boolean indicating whether the point is equal to the other given point + /// (numerically). + /// + /// The other point to test equality against. + /// True if this point is equal to other; False otherwise. + public bool NearlyEquals(Point other) + { + return MathUtilities.AreClose(_x, other._x) && + MathUtilities.AreClose(_y, other._y); + } + /// /// Checks for equality between a point and an object. /// diff --git a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs index f3ea48ff80..c415f477d4 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs @@ -855,7 +855,7 @@ namespace Avalonia.Controls if (OwningGrid != null && OwningGrid.UseLayoutRounding) { var scale = LayoutHelper.GetLayoutScale(HeaderCell); - var roundSize = LayoutHelper.RoundLayoutSize(new Size(leftEdge + ActualWidth, 1), scale, scale); + var roundSize = LayoutHelper.RoundLayoutSizeUp(new Size(leftEdge + ActualWidth, 1), scale, scale); LayoutRoundedWidth = roundSize.Width - leftEdge; } else diff --git a/src/Avalonia.Controls/Presenters/ContentPresenter.cs b/src/Avalonia.Controls/Presenters/ContentPresenter.cs index 996cb29534..c67678837b 100644 --- a/src/Avalonia.Controls/Presenters/ContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ContentPresenter.cs @@ -635,8 +635,8 @@ namespace Avalonia.Controls.Presenters if (useLayoutRounding) { - sizeForChild = LayoutHelper.RoundLayoutSize(sizeForChild, scale, scale); - availableSize = LayoutHelper.RoundLayoutSize(availableSize, scale, scale); + sizeForChild = LayoutHelper.RoundLayoutSizeUp(sizeForChild, scale, scale); + availableSize = LayoutHelper.RoundLayoutSizeUp(availableSize, scale, scale); } switch (horizontalContentAlignment) diff --git a/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests.cs b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests.cs index 87fa8cf1f3..f5adaf904e 100644 --- a/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests.cs +++ b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests.cs @@ -173,37 +173,6 @@ namespace Avalonia.Base.UnitTests.Layout target.Verify(x => x.InvalidateMeasure(root), Times.Once()); } - [Theory] - [InlineData(16, 6, 5.333333333333333)] - [InlineData(18, 10, 4)] - public void UseLayoutRounding_Arranges_Center_Alignment_Correctly_With_Fractional_Scaling( - double containerWidth, - double childWidth, - double expectedX) - { - Border target; - var root = new TestRoot - { - LayoutScaling = 1.5, - UseLayoutRounding = true, - Child = new Decorator - { - Width = containerWidth, - Height = 100, - Child = target = new Border - { - Width = childWidth, - HorizontalAlignment = HorizontalAlignment.Center, - } - } - }; - - root.Measure(new Size(100, 100)); - root.Arrange(new Rect(target.DesiredSize)); - - Assert.Equal(new Rect(expectedX, 0, childWidth, 100), target.Bounds); - } - [Fact] public void LayoutUpdated_Is_Called_At_End_Of_Layout_Pass() { diff --git a/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_LayoutRounding.cs b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_LayoutRounding.cs new file mode 100644 index 0000000000..77f1a8882d --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_LayoutRounding.cs @@ -0,0 +1,140 @@ +using Avalonia.Controls; +using Avalonia.Layout; +using Avalonia.UnitTests; +using Xunit; +using Xunit.Sdk; + +namespace Avalonia.Base.UnitTests.Layout +{ + public class LayoutableTests_LayoutRounding + { + [Theory] + [InlineData(100, 100)] + [InlineData(101, 101.33333333333333)] + [InlineData(103, 103.33333333333333)] + public void Measure_Adjusts_DesiredSize_Upwards_When_Constraint_Allows(double desiredSize, double expectedSize) + { + var target = new TestLayoutable(new Size(desiredSize, desiredSize)); + var root = CreateRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + Assert.Equal(new Size(expectedSize, expectedSize), target.DesiredSize); + } + + [Fact] + public void Measure_Constrains_Adjusted_DesiredSize_To_Constraint() + { + var target = new TestLayoutable(new Size(101, 101)); + var root = CreateRoot(1.5, target, constraint: new Size(101, 101)); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // Desired width/height with layout rounding is 101.3333 but constraint is 101,101 so + // layout rounding should be ignored. + Assert.Equal(new Size(101, 101), target.DesiredSize); + } + + [Fact] + public void Measure_Adjusts_DesiredSize_Upwards_When_Margin_Present() + { + var target = new TestLayoutable(new Size(101, 101), margin: 1); + var root = CreateRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel margin is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Final size = 101.3333 + 2.6666 = 104 + AssertEqual(new Size(104, 104), target.DesiredSize); + } + + [Fact] + public void Arrange_Adjusts_Bounds_Upwards_With_Margin() + { + var target = new TestLayoutable(new Size(101, 101), margin: 1); + var root = CreateRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel margin is rounded up to 1.3333 + // - Size of 101 gets rounded up to 101.3333 + AssertEqual(new Point(1.3333333333333333, 1.3333333333333333), target.Bounds.Position); + AssertEqual(new Size(101.33333333333333, 101.33333333333333), target.Bounds.Size); + } + + [Theory] + [InlineData(16, 6, 5.333333333333333)] + [InlineData(18, 10, 4)] + public void Arranges_Center_Alignment_Correctly_With_Fractional_Scaling( + double containerWidth, + double childWidth, + double expectedX) + { + Border target; + var root = new TestRoot + { + LayoutScaling = 1.5, + UseLayoutRounding = true, + Child = new Decorator + { + Width = containerWidth, + Height = 100, + Child = target = new Border + { + Width = childWidth, + HorizontalAlignment = HorizontalAlignment.Center, + } + } + }; + + root.Measure(new Size(100, 100)); + root.Arrange(new Rect(target.DesiredSize)); + + Assert.Equal(new Rect(expectedX, 0, childWidth, 100), target.Bounds); + } + + private static TestRoot CreateRoot( + double scaling, + Control child, + Size? constraint = null) + { + return new TestRoot + { + LayoutScaling = scaling, + UseLayoutRounding = true, + Child = child, + ClientSize = constraint ?? new Size(1000, 1000), + }; + } + + private static void AssertEqual(Point expected, Point actual) + { + if (!expected.NearlyEquals(actual)) + { + throw new EqualException(expected, actual); + } + } + + private static void AssertEqual(Size expected, Size actual) + { + if (!expected.NearlyEquals(actual)) + { + throw new EqualException(expected, actual); + } + } + + private class TestLayoutable : Control + { + private Size _desiredSize; + + public TestLayoutable(Size desiredSize, double margin = 0) + { + _desiredSize = desiredSize; + Margin = new Thickness(margin); + } + + protected override Size MeasureOverride(Size availableSize) => _desiredSize; + } + } +} diff --git a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs index 01afe85b8b..be873c4b67 100644 --- a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs +++ b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs @@ -805,6 +805,7 @@ namespace Avalonia.Base.UnitTests.Rendering.SceneGraph Canvas canvas; var tree = new TestRoot { + ClientSize = new Size(100, 100), Child = decorator = new Decorator { Margin = new Thickness(0, 10, 0, 0), diff --git a/tests/Avalonia.Controls.UnitTests/BorderTests.cs b/tests/Avalonia.Controls.UnitTests/BorderTests.cs index ab33eaaff9..7af7d1cee2 100644 --- a/tests/Avalonia.Controls.UnitTests/BorderTests.cs +++ b/tests/Avalonia.Controls.UnitTests/BorderTests.cs @@ -1,6 +1,8 @@ +using Avalonia.Layout; using Avalonia.Media; using Avalonia.Rendering; using Avalonia.UnitTests; +using Avalonia.VisualTree; using Moq; using Xunit; @@ -60,5 +62,68 @@ namespace Avalonia.Controls.UnitTests renderer.Verify(x => x.AddDirty(target), Times.Once); } + + public class UseLayoutRounding + { + [Fact] + public void Measure_Rounds_Padding() + { + var target = new Border + { + Padding = new Thickness(1), + Child = new Canvas + { + Width = 101, + Height = 101, + } + }; + + var root = CreatedRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel padding is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Desired size = 101.3333 + 2.6666 = 104 + Assert.Equal(new Size(104, 104), target.DesiredSize); + } + + [Fact] + public void Measure_Rounds_BorderThickness() + { + var target = new Border + { + BorderThickness = new Thickness(1), + Child = new Canvas + { + Width = 101, + Height = 101, + } + }; + + var root = CreatedRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel border thickness is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Desired size = 101.3333 + 2.6666 = 104 + Assert.Equal(new Size(104, 104), target.DesiredSize); + } + + private static TestRoot CreatedRoot( + double scaling, + Control child, + Size? constraint = null) + { + return new TestRoot + { + LayoutScaling = scaling, + UseLayoutRounding = true, + Child = child, + ClientSize = constraint ?? new Size(1000, 1000), + }; + } + } } } diff --git a/tests/Avalonia.Controls.UnitTests/DecoratorTests.cs b/tests/Avalonia.Controls.UnitTests/DecoratorTests.cs index 65749efbf9..fe58cd4c7f 100644 --- a/tests/Avalonia.Controls.UnitTests/DecoratorTests.cs +++ b/tests/Avalonia.Controls.UnitTests/DecoratorTests.cs @@ -1,6 +1,7 @@ using System.Collections.Specialized; using System.Linq; using Avalonia.LogicalTree; +using Avalonia.UnitTests; using Xunit; namespace Avalonia.Controls.UnitTests @@ -116,5 +117,45 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(new Size(16, 16), target.DesiredSize); } + + public class UseLayoutRounding + { + [Fact] + public void Measure_Rounds_Padding() + { + var target = new Decorator + { + Padding = new Thickness(1), + Child = new Canvas + { + Width = 101, + Height = 101, + } + }; + + var root = CreatedRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel padding is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Desired size = 101.3333 + 2.6666 = 104 + Assert.Equal(new Size(104, 104), target.DesiredSize); + } + + private static TestRoot CreatedRoot( + double scaling, + Control child, + Size? constraint = null) + { + return new TestRoot + { + LayoutScaling = scaling, + UseLayoutRounding = true, + Child = child, + ClientSize = constraint ?? new Size(1000, 1000), + }; + } + } } } diff --git a/tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs b/tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs index ed44fbfc32..e82050528f 100644 --- a/tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs +++ b/tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Layout.cs @@ -1,5 +1,6 @@ using Avalonia.Controls.Presenters; using Avalonia.Layout; +using Avalonia.UnitTests; using Xunit; namespace Avalonia.Controls.UnitTests.Presenters @@ -232,5 +233,68 @@ namespace Avalonia.Controls.UnitTests.Presenters Assert.Equal(new Rect(32, 32, 0, 0), content.Bounds); } + + public class UseLayoutRounding + { + [Fact] + public void Measure_Rounds_Padding() + { + var target = new ContentPresenter + { + Padding = new Thickness(1), + Content = new Canvas + { + Width = 101, + Height = 101, + } + }; + + var root = CreatedRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel padding is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Desired size = 101.3333 + 2.6666 = 104 + Assert.Equal(new Size(104, 104), target.DesiredSize); + } + + [Fact] + public void Measure_Rounds_BorderThickness() + { + var target = new ContentPresenter + { + BorderThickness = new Thickness(1), + Content = new Canvas + { + Width = 101, + Height = 101, + } + }; + + var root = CreatedRoot(1.5, target); + + root.LayoutManager.ExecuteInitialLayoutPass(); + + // - 1 pixel border thickness is rounded up to 1.3333; for both sides it is 2.6666 + // - Size of 101 gets rounded up to 101.3333 + // - Desired size = 101.3333 + 2.6666 = 104 + Assert.Equal(new Size(104, 104), target.DesiredSize); + } + + private static TestRoot CreatedRoot( + double scaling, + Control child, + Size? constraint = null) + { + return new TestRoot + { + LayoutScaling = scaling, + UseLayoutRounding = true, + Child = child, + ClientSize = constraint ?? new Size(1000, 1000), + }; + } + } } -} \ No newline at end of file +} diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs index 59276a94d0..f4001a8ca1 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs @@ -67,7 +67,7 @@ namespace Avalonia.Controls.UnitTests.Primitives target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); - Assert.Equal(new Rect(33, 0, 33, 12), thumb.Bounds); + Assert.Equal(new Rect(33, 0, 34, 12), thumb.Bounds); } [Fact] @@ -92,7 +92,7 @@ namespace Avalonia.Controls.UnitTests.Primitives target.Measure(new Size(100, 100)); target.Arrange(new Rect(0, 0, 100, 100)); - Assert.Equal(new Rect(0, 33, 12, 33), thumb.Bounds); + Assert.Equal(new Rect(0, 33, 12, 34), thumb.Bounds); } [Fact] diff --git a/tests/Avalonia.UnitTests/TestRoot.cs b/tests/Avalonia.UnitTests/TestRoot.cs index 4601dd7e5b..41e29a85c4 100644 --- a/tests/Avalonia.UnitTests/TestRoot.cs +++ b/tests/Avalonia.UnitTests/TestRoot.cs @@ -41,7 +41,7 @@ namespace Avalonia.UnitTests Child = child; } - public Size ClientSize { get; set; } = new Size(100, 100); + public Size ClientSize { get; set; } = new Size(1000, 1000); public Size MaxClientSize { get; set; } = Size.Infinity; @@ -110,5 +110,10 @@ namespace Avalonia.UnitTests } Visit(this, true); } + + protected override Size MeasureOverride(Size availableSize) + { + return base.MeasureOverride(ClientSize); + } } } diff --git a/tests/TestFiles/Direct2D1/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png b/tests/TestFiles/Direct2D1/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png index e8624fa457f37565fdc483c474424991e7b696d3..8ca7acb845855a306af678ca22bf356780b0cba5 100644 GIT binary patch delta 679 zcmV;Y0$Ba<1^)$*K~kwnL_t(|UhUekZWBQe#_=;P6++?#fR>V$0tr#VYaoFHqUQ}j zqTo5`httHZz&q=s2Hqv))HO`Y32D$yLd9>u&fZ`DxwlC}=FnUCDFn zb~hwfB%e-?y6(N?m3510L7y(9cZxMYmZy?;*7ZBU6*{8087t3497`|8dQtY)w2jpd zI48ECk8!M=KM(V@`+Pai$bR5kf9XB6Z)|uhd2QVdQz!pLdV0cBZb@`8HRag;K+M;? z;aHdSi`N5*K2`Hla({5Vt(ZOZ#NSvK4$N0EeFe#vL8PG9QqUXUpNcg}-LZ0FO;UF( z=Ij4hlf?awSyyP(qe}|-ZJRF&dLiyeK3W$J+vcl@g4WHd?g*yxM3N(Nf2xO0VUmpqHFGSJWiy@&1&RWbC@rm ztb!hX=IF_7iN`(3BkN9*wOMz~y2TtNqsE0K)nnFRNDefgl-zmV71Czl57L(8d1Q-wI5&g@gbA N002ovPDHLkV1j5cRr>${ delta 663 zcmV;I0%-mJ1@HxsK~kDYL_t(|UhUgIa??N*$8nhhgpv-9Kst&PbZ~-{bWo>HI%eP$ zbliY0bTFi#WQHbHCZVECE@0mCYC&Ev)~@tc(Vy>U=9gVr&L&sF5? z2a=zgt*ZJWIdk3Ow4gWZj_kMw*zr#C&2{Yze1z^>+>Eo|l*ZA6u^yCDYTA#}F7b|b z1-+DUQlBp7XTR-n+9lr6_JMtu-Y0j%e~v?mF0?|+c*2;U(Dpd(9@K4;4-y?YmRFK4 z^g(@eT|_WHMd&L`zBFy;-KXYy|(KU{b8zDnNKxsvFW zH-0;ezHL90^u_#aD^}3IBtx9|jEVjQPyh0jnrD(F8Df4|Lt|DbXw1sJ6tu3b_2LwN zfr_3W`0X%Otk(2a znEu5s`c3DXRyVzJM1r%nkRJ0aMM(FjDeD5@R(^af#<|TF^PCdjI796AKN{2Wx1| x3I&Z>NnUc)osL*?lhFbeli&gb8GzoZ>JL{KmA-v_Vov}7002ovPDHLkV1ik5Q|$l% diff --git a/tests/TestFiles/Skia/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png b/tests/TestFiles/Skia/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png index 7bd622050e00416936f55efbc6d96232c67bd8c8..a76c6a5b2a824ec785875d92dd0b38407e3049c3 100644 GIT binary patch delta 490 zcmZ3>GKFP=N&RV07srr_IdAW5%)1;Q!uDXlX#W9ggKvom4qEyL4~4P0&0{{ck2_jY zz?fNE$h%Z>(W=lXQ?j31ZCk(J|C5mA@slS#KgDbNF)^S4hwFN;%CwgrT&UI0`gre( zyBn{Z`^PAr`Jt|XYkILgL&iym%_{3BPpMbF-QIRwbLpF=FDusivZW`ln|z07Z}8Ve zAHMMX-Jp@P^FYYz`%&?e|M>j%d7pLG=tA@w(@X6Ni@OMP+s%{|8UZRef2 zOxJB?{S~_W*Ou5%Gj2?N7|#)W?H1GDRgZPpV+}8q9Cgq?Fkj{U;Tz2DaF{%vno$(gm^S9kO54e|f1`v3Z(cq0>#J*i*%C*Mn*p3gV8zGmi= zcRgFP)>dv@6<_N1-{NIR@src0`e9#J_nmMI=P`-C@@dwgWy2)Tif!}f*BA9YQBr<>Yv<0+ed$LhGhl$6qoFtRV$DAqv>tEFoHy;= zjj8AUHLmvgqjP}4f0`Ym-l@|ncRSzK*B<`-V%Iyxa-Mt3j*FJP@}0!LwOcIxMdrlE z`EBc_9=&?AZmz%QzU4W~PG3(r%l<3q)s%g)(bchAU-i5`|6g~~!uOv(cvj{7-f@I; zZO^|R^Na=Arn~kV?eHzSTz#h~bwk)M4ct2k#G&)%(W*Dsx)C6j$|eyBU2 z#3_f(+TH&xR=QqWGxcS(?x8Q~dmJTy>788NygzpSjqgWi)>y6GoVM2Iepc=R`^UZi z3We58xyrynyb(IzS%pj{N(kv(qntpW!+KP9r*m+Cc8U!>XmlI yb8njNTQ2ZS)p@fv+pJj4eL2tLs~9ojqI);H&U7`F+X Date: Mon, 16 May 2022 17:08:53 +0200 Subject: [PATCH 036/393] Fix comparison. --- .../Converters/MenuScrollingVisibilityConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Converters/MenuScrollingVisibilityConverter.cs b/src/Avalonia.Controls/Converters/MenuScrollingVisibilityConverter.cs index 6ab2f4c517..9d859a753a 100644 --- a/src/Avalonia.Controls/Converters/MenuScrollingVisibilityConverter.cs +++ b/src/Avalonia.Controls/Converters/MenuScrollingVisibilityConverter.cs @@ -26,7 +26,7 @@ namespace Avalonia.Controls.Converters if (visibility == ScrollBarVisibility.Auto) { - if (extent == viewport) + if (MathUtilities.AreClose(extent, viewport)) { return false; } From 9ac37065dca2a23006617dc649debd3392e23b38 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Tue, 24 May 2022 19:49:43 +0300 Subject: [PATCH 037/393] Animations now work... more or less? --- samples/ControlCatalog/MainView.xaml | 3 + .../Pages/CompositionPage.axaml | 45 +++++ .../Pages/CompositionPage.axaml.cs | 157 ++++++++++++++++++ .../Animations/AnimatedValueStore.cs | 88 +++++++++- .../Animations/AnimationInstanceBase.cs | 77 +++++++++ .../Animations/CompositionAnimation.cs | 2 +- .../Animations/ExpressionAnimationInstance.cs | 25 +-- .../Animations/IAnimationInstance.cs | 7 +- .../Animations/KeyFrameAnimationInstance.cs | 59 +++++-- .../Composition/Animations/KeyFrames.cs | 2 +- .../Composition/CompositionPropertySet.cs | 12 +- .../Composition/ElementCompositionPreview.cs | 6 + .../Composition/Expressions/Expression.cs | 45 ++++- .../ExpressionEvaluationContext.cs | 1 + .../Expressions/ExpressionTrackedValues.cs | 57 +++++++ .../Composition/Server/FpsCounter.cs | 27 ++- .../Server/ServerCompositionTarget.cs | 5 +- .../Composition/Server/ServerCompositor.cs | 20 +++ .../Composition/Server/ServerObject.cs | 82 ++++++++- .../Composition/Server/ServerVisual.cs | 22 ++- .../Rendering/Composition/Visual.cs | 1 - .../Utilities/RefTrackingDictionary.cs | 67 ++++++++ .../Avalonia.SourceGenerator.csproj | 1 + .../CompositionRoslynGenerator.cs | 26 +-- .../CompositionGenerator/Generator.cs | 102 ++++++++++-- .../ICompositionGeneratorSink.cs | 6 + .../RoslynCompositionGeneratorSink.cs | 15 ++ 27 files changed, 873 insertions(+), 87 deletions(-) create mode 100644 samples/ControlCatalog/Pages/CompositionPage.axaml create mode 100644 samples/ControlCatalog/Pages/CompositionPage.axaml.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Animations/AnimationInstanceBase.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/ElementCompositionPreview.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionTrackedValues.cs create mode 100644 src/Avalonia.Base/Utilities/RefTrackingDictionary.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/ICompositionGeneratorSink.cs create mode 100644 src/Avalonia.SourceGenerator/CompositionGenerator/RoslynCompositionGeneratorSink.cs diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 59d724db69..2ce5ab3934 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -13,6 +13,9 @@ + + + diff --git a/samples/ControlCatalog/Pages/CompositionPage.axaml b/samples/ControlCatalog/Pages/CompositionPage.axaml new file mode 100644 index 0000000000..592290fde5 --- /dev/null +++ b/samples/ControlCatalog/Pages/CompositionPage.axaml @@ -0,0 +1,45 @@ + + + Implicit animations + + + + + + + + + + + + + + + + + + + + + + + Resize me + + + + + + + \ No newline at end of file diff --git a/samples/ControlCatalog/Pages/CompositionPage.axaml.cs b/samples/ControlCatalog/Pages/CompositionPage.axaml.cs new file mode 100644 index 0000000000..b37231243d --- /dev/null +++ b/samples/ControlCatalog/Pages/CompositionPage.axaml.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; +using Avalonia.Markup.Xaml.Templates; +using Avalonia.Media; +using Avalonia.Rendering.Composition; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.VisualTree; + +namespace ControlCatalog.Pages; + +public partial class CompositionPage : UserControl +{ + private ImplicitAnimationCollection _implicitAnimations; + + public CompositionPage() + { + AvaloniaXamlLoader.Load(this); + } + + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + this.FindControl("Items").Items = CreateColorItems(); + } + + private List CreateColorItems() + { + var list = new List(); + + list.Add(new ColorItem(Color.FromArgb(255, 255, 185, 0))); + list.Add(new ColorItem(Color.FromArgb(255, 231, 72, 86))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 120, 215))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 153, 188))); + list.Add(new ColorItem(Color.FromArgb(255, 122, 117, 116))); + list.Add(new ColorItem(Color.FromArgb(255, 118, 118, 118))); + list.Add(new ColorItem(Color.FromArgb(255, 255, 141, 0))); + list.Add(new ColorItem(Color.FromArgb(255, 232, 17, 35))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 99, 177))); + list.Add(new ColorItem(Color.FromArgb(255, 45, 125, 154))); + list.Add(new ColorItem(Color.FromArgb(255, 93, 90, 88))); + list.Add(new ColorItem(Color.FromArgb(255, 76, 74, 72))); + list.Add(new ColorItem(Color.FromArgb(255, 247, 99, 12))); + list.Add(new ColorItem(Color.FromArgb(255, 234, 0, 94))); + list.Add(new ColorItem(Color.FromArgb(255, 142, 140, 216))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 183, 195))); + list.Add(new ColorItem(Color.FromArgb(255, 104, 118, 138))); + list.Add(new ColorItem(Color.FromArgb(255, 105, 121, 126))); + list.Add(new ColorItem(Color.FromArgb(255, 202, 80, 16))); + list.Add(new ColorItem(Color.FromArgb(255, 195, 0, 82))); + list.Add(new ColorItem(Color.FromArgb(255, 107, 105, 214))); + list.Add(new ColorItem(Color.FromArgb(255, 3, 131, 135))); + list.Add(new ColorItem(Color.FromArgb(255, 81, 92, 107))); + list.Add(new ColorItem(Color.FromArgb(255, 74, 84, 89))); + list.Add(new ColorItem(Color.FromArgb(255, 218, 59, 1))); + list.Add(new ColorItem(Color.FromArgb(255, 227, 0, 140))); + list.Add(new ColorItem(Color.FromArgb(255, 135, 100, 184))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 178, 148))); + list.Add(new ColorItem(Color.FromArgb(255, 86, 124, 115))); + list.Add(new ColorItem(Color.FromArgb(255, 100, 124, 100))); + list.Add(new ColorItem(Color.FromArgb(255, 239, 105, 80))); + list.Add(new ColorItem(Color.FromArgb(255, 191, 0, 119))); + list.Add(new ColorItem(Color.FromArgb(255, 116, 77, 169))); + list.Add(new ColorItem(Color.FromArgb(255, 1, 133, 116))); + list.Add(new ColorItem(Color.FromArgb(255, 72, 104, 96))); + list.Add(new ColorItem(Color.FromArgb(255, 82, 94, 84))); + list.Add(new ColorItem(Color.FromArgb(255, 209, 52, 56))); + list.Add(new ColorItem(Color.FromArgb(255, 194, 57, 179))); + list.Add(new ColorItem(Color.FromArgb(255, 177, 70, 194))); + list.Add(new ColorItem(Color.FromArgb(255, 0, 204, 106))); + list.Add(new ColorItem(Color.FromArgb(255, 73, 130, 5))); + list.Add(new ColorItem(Color.FromArgb(255, 132, 117, 69))); + list.Add(new ColorItem(Color.FromArgb(255, 255, 67, 67))); + list.Add(new ColorItem(Color.FromArgb(255, 154, 0, 137))); + list.Add(new ColorItem(Color.FromArgb(255, 136, 23, 152))); + list.Add(new ColorItem(Color.FromArgb(255, 16, 137, 62))); + list.Add(new ColorItem(Color.FromArgb(255, 16, 124, 16))); + list.Add(new ColorItem(Color.FromArgb(255, 126, 115, 95))); + + return list; + } + + public class ColorItem + { + public Color Color { get; private set; } + + public SolidColorBrush ColorBrush + { + get { return new SolidColorBrush(Color); } + } + + public String ColorHexValue + { + get { return Color.ToString().Substring(3).ToUpperInvariant(); } + } + + public ColorItem(Color color) + { + Color = color; + } + } + + private void EnsureImplicitAnimations() + { + if (_implicitAnimations == null) + { + var compositor = ElementCompositionPreview.GetElementVisual(this)!.Compositor; + + var offsetAnimation = compositor.CreateVector3KeyFrameAnimation(); + offsetAnimation.Target = "Offset"; + offsetAnimation.InsertExpressionKeyFrame(1.0f, "this.FinalValue"); + offsetAnimation.Duration = TimeSpan.FromMilliseconds(400); + + var rotationAnimation = compositor.CreateScalarKeyFrameAnimation(); + rotationAnimation.Target = "RotationAngle"; + rotationAnimation.InsertKeyFrame(.5f, 0.160f); + rotationAnimation.InsertKeyFrame(1f, 0f); + rotationAnimation.Duration = TimeSpan.FromMilliseconds(400); + + var animationGroup = compositor.CreateAnimationGroup(); + animationGroup.Add(offsetAnimation); + animationGroup.Add(rotationAnimation); + + _implicitAnimations = compositor.CreateImplicitAnimationCollection(); + _implicitAnimations["Offset"] = animationGroup; + } + } + + public static void SetEnableAnimations(Border border, bool value) + { + + var page = border.FindAncestorOfType(); + if (page == null) + { + border.AttachedToVisualTree += delegate { SetEnableAnimations(border, true); }; + return; + } + + if (ElementCompositionPreview.GetElementVisual(page) == null) + return; + + page.EnsureImplicitAnimations(); + ElementCompositionPreview.GetElementVisual((Visual)border.GetVisualParent()).ImplicitAnimations = + page._implicitAnimations; + } + + + + +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs index 180c45022f..e877b50b20 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs @@ -1,19 +1,62 @@ +using System.Runtime.InteropServices; using Avalonia.Rendering.Composition.Expressions; using Avalonia.Rendering.Composition.Server; using Avalonia.Rendering.Composition.Transport; +using Avalonia.Utilities; namespace Avalonia.Rendering.Composition.Animations { - internal struct AnimatedValueStore where T : struct + internal struct ServerObjectSubscriptionStore { + public bool IsValid; + public RefTrackingDictionary Subscribers; + + public void Invalidate() + { + if (IsValid) + return; + IsValid = false; + if (Subscribers != null) + foreach (var sub in Subscribers) + sub.Key.Invalidate(); + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct ServerValueStore + { + // HAS TO BE THE FIRST FIELD, accessed by field offset from ServerObject + private ServerObjectSubscriptionStore Subscriptions; + private T _value; + public T Value + { + set + { + _value = value; + Subscriptions.Invalidate(); + } + get + { + Subscriptions.IsValid = true; + return _value; + } + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct ServerAnimatedValueStore where T : struct + { + // HAS TO BE THE FIRST FIELD, accessed by field offset from ServerObject + private ServerObjectSubscriptionStore Subscriptions; + private IAnimationInstance? _animation; private T _direct; - private IAnimationInstance _animation; private T? _lastAnimated; public T Direct => _direct; public T GetAnimated(ServerCompositor compositor) { + Subscriptions.IsValid = true; if (_animation == null) return _direct; var v = _animation.Evaluate(compositor.ServerNow, ExpressionVariant.Create(_direct)) @@ -22,19 +65,50 @@ namespace Avalonia.Rendering.Composition.Animations return v; } + public void Activate(ServerObject parent) + { + if (_animation != null) + _animation.Activate(); + } + + public void Deactivate(ServerObject parent) + { + if (_animation != null) + _animation.Deactivate(); + } + private T LastAnimated => _animation != null ? _lastAnimated ?? _direct : _direct; public bool IsAnimation => _animation != null; - public void SetAnimation(ChangeSet cs, IAnimationInstance animation) + public void SetAnimation(ServerObject target, ChangeSet cs, IAnimationInstance animation, int storeOffset) { + _direct = default; + if (_animation != null) + { + if (target.IsActive) + _animation.Deactivate(); + } + _animation = animation; - _animation.Start(cs.Batch.CommitedAt, ExpressionVariant.Create(LastAnimated)); + _animation.Initialize(cs.Batch.CommitedAt, ExpressionVariant.Create(LastAnimated), storeOffset); + if (target.IsActive) + _animation.Activate(); + + Subscriptions.Invalidate(); } - public static implicit operator AnimatedValueStore(T value) => new AnimatedValueStore() + public void SetValue(ServerObject target, T value) { - _direct = value - }; + if (_animation != null) + { + if (target.IsActive) + _animation.Deactivate(); + } + + _animation = null; + _direct = value; + Subscriptions.Invalidate(); + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/AnimationInstanceBase.cs b/src/Avalonia.Base/Rendering/Composition/Animations/AnimationInstanceBase.cs new file mode 100644 index 0000000000..212237049f --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Animations/AnimationInstanceBase.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Animations; + +internal abstract class AnimationInstanceBase : IAnimationInstance +{ + private List<(ServerObject obj, int member)>? _trackedObjects; + protected PropertySetSnapshot Parameters { get; } + public ServerObject TargetObject { get; } + protected int StoreOffset { get; private set; } + private bool _invalidated; + + public AnimationInstanceBase(ServerObject target, PropertySetSnapshot parameters) + { + Parameters = parameters; + TargetObject = target; + } + + protected void Initialize(int storeOffset, HashSet<(string name, string member)> trackedObjects) + { + if (trackedObjects.Count > 0) + { + _trackedObjects = new (); + foreach (var t in trackedObjects) + { + var obj = Parameters.GetObjectParameter(t.name); + if (obj is ServerObject tracked) + { + var off = tracked.GetFieldOffset(t.member); + if (off == null) +#if DEBUG + throw new InvalidCastException("Attempting to subscribe to unknown field"); +#else + continue; +#endif + _trackedObjects.Add((tracked, off.Value)); + } + } + } + + StoreOffset = storeOffset; + } + + public abstract void Initialize(TimeSpan startedAt, ExpressionVariant startingValue, int storeOffset); + protected abstract ExpressionVariant EvaluateCore(TimeSpan now, ExpressionVariant currentValue); + + public ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue) + { + _invalidated = false; + return EvaluateCore(now, currentValue); + } + + public virtual void Activate() + { + if (_trackedObjects != null) + foreach (var tracked in _trackedObjects) + tracked.obj.SubscribeToInvalidation(tracked.member, this); + } + + public virtual void Deactivate() + { + if (_trackedObjects != null) + foreach (var tracked in _trackedObjects) + tracked.obj.UnsubscribeFromInvalidation(tracked.member, this); + } + + public void Invalidate() + { + if (_invalidated) + return; + _invalidated = true; + TargetObject.NotifyAnimatedValueChanged(StoreOffset); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs index 9375faaaae..fe20115b38 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs @@ -53,7 +53,7 @@ namespace Avalonia.Rendering.Composition.Animations ExpressionVariant? finalValue); internal PropertySetSnapshot CreateSnapshot(bool server) - => _propertySet.Snapshot(server, 1); + => _propertySet.Snapshot(server); void ICompositionAnimationBase.InternalOnly() { diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs index 47b947b2e9..7944fe7990 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimationInstance.cs @@ -1,22 +1,22 @@ using System; +using System.Collections.Generic; using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Animations { - internal class ExpressionAnimationInstance : IAnimationInstance + internal class ExpressionAnimationInstance : AnimationInstanceBase, IAnimationInstance { private readonly Expression _expression; - private readonly IExpressionObject _target; private ExpressionVariant _startingValue; private readonly ExpressionVariant? _finalValue; - private readonly PropertySetSnapshot _parameters; - public ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue) + protected override ExpressionVariant EvaluateCore(TimeSpan now, ExpressionVariant currentValue) { var ctx = new ExpressionEvaluationContext { - Parameters = _parameters, - Target = _target, + Parameters = Parameters, + Target = TargetObject, ForeignFunctionInterface = BuiltInExpressionFfi.Instance, StartingValue = _startingValue, FinalValue = _finalValue ?? _startingValue, @@ -25,20 +25,21 @@ namespace Avalonia.Rendering.Composition.Animations return _expression.Evaluate(ref ctx); } - public void Start(TimeSpan startedAt, ExpressionVariant startingValue) + public override void Initialize(TimeSpan startedAt, ExpressionVariant startingValue, int storeOffset) { _startingValue = startingValue; + var hs = new HashSet<(string, string)>(); + _expression.CollectReferences(hs); + base.Initialize(storeOffset, hs); } - + public ExpressionAnimationInstance(Expression expression, - IExpressionObject target, + ServerObject target, ExpressionVariant? finalValue, - PropertySetSnapshot parameters) + PropertySetSnapshot parameters) : base(target, parameters) { _expression = expression; - _target = target; _finalValue = finalValue; - _parameters = parameters; } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs index a0b066ae0c..05d1b50953 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/IAnimationInstance.cs @@ -1,11 +1,16 @@ using System; using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Animations { internal interface IAnimationInstance { + ServerObject TargetObject { get; } ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue); - void Start(TimeSpan startedAt, ExpressionVariant startingValue); + void Initialize(TimeSpan startedAt, ExpressionVariant startingValue, int storeOffset); + void Activate(); + void Deactivate(); + void Invalidate(); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs index b90a02148d..9571cef0b4 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrameAnimationInstance.cs @@ -1,15 +1,15 @@ using System; +using System.Collections.Generic; using Avalonia.Rendering.Composition.Expressions; +using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Animations { - class KeyFrameAnimationInstance : IAnimationInstance where T : struct + class KeyFrameAnimationInstance : AnimationInstanceBase, IAnimationInstance where T : struct { private readonly IInterpolator _interpolator; private readonly ServerKeyFrame[] _keyFrames; - private readonly PropertySetSnapshot _snapshot; private readonly ExpressionVariant? _finalValue; - private readonly IExpressionObject _target; private readonly AnimationDelayBehavior _delayBehavior; private readonly TimeSpan _delayTime; private readonly AnimationDirection _direction; @@ -19,21 +19,21 @@ namespace Avalonia.Rendering.Composition.Animations private readonly AnimationStopBehavior _stopBehavior; private TimeSpan _startedAt; private T _startingValue; + private readonly TimeSpan _totalDuration; + private bool _finished; public KeyFrameAnimationInstance( IInterpolator interpolator, ServerKeyFrame[] keyFrames, PropertySetSnapshot snapshot, ExpressionVariant? finalValue, - IExpressionObject target, + ServerObject target, AnimationDelayBehavior delayBehavior, TimeSpan delayTime, AnimationDirection direction, TimeSpan duration, AnimationIterationBehavior iterationBehavior, - int iterationCount, AnimationStopBehavior stopBehavior) + int iterationCount, AnimationStopBehavior stopBehavior) : base(target, snapshot) { _interpolator = interpolator; _keyFrames = keyFrames; - _snapshot = snapshot; _finalValue = finalValue; - _target = target; _delayBehavior = delayBehavior; _delayTime = delayTime; _direction = direction; @@ -41,26 +41,43 @@ namespace Avalonia.Rendering.Composition.Animations _iterationBehavior = iterationBehavior; _iterationCount = iterationCount; _stopBehavior = stopBehavior; + if (_iterationBehavior == AnimationIterationBehavior.Count) + _totalDuration = delayTime.Add(TimeSpan.FromTicks(iterationCount * _duration.Ticks)); if (_keyFrames.Length == 0) throw new InvalidOperationException("Animation has no key frames"); if(_duration.Ticks <= 0) throw new InvalidOperationException("Invalid animation duration"); } - public ExpressionVariant Evaluate(TimeSpan now, ExpressionVariant currentValue) + + protected override ExpressionVariant EvaluateCore(TimeSpan now, ExpressionVariant currentValue) { - var elapsed = now - _startedAt; var starting = ExpressionVariant.Create(_startingValue); var ctx = new ExpressionEvaluationContext { - Parameters = _snapshot, - Target = _target, + Parameters = Parameters, + Target = TargetObject, CurrentValue = currentValue, FinalValue = _finalValue ?? starting, StartingValue = starting, ForeignFunctionInterface = BuiltInExpressionFfi.Instance }; + var elapsed = now - _startedAt; + var res = EvaluateImpl(elapsed, currentValue, ref ctx); + if (_iterationBehavior == AnimationIterationBehavior.Count + && !_finished + && elapsed > _totalDuration) + { + // Active check? + TargetObject.Compositor.RemoveFromClock(this); + _finished = true; + } + return res; + } + + private ExpressionVariant EvaluateImpl(TimeSpan elapsed, ExpressionVariant currentValue, ref ExpressionEvaluationContext ctx) + { if (elapsed < _delayTime) { if (_delayBehavior == AnimationDelayBehavior.SetInitialValueBeforeDelay) @@ -130,10 +147,28 @@ namespace Avalonia.Rendering.Composition.Animations return f.Value; } - public void Start(TimeSpan startedAt, ExpressionVariant startingValue) + public override void Initialize(TimeSpan startedAt, ExpressionVariant startingValue, int storeOffset) { _startedAt = startedAt; _startingValue = startingValue.CastOrDefault(); + var hs = new HashSet<(string, string)>(); + + // TODO: Update subscriptions based on the current keyframe rather than keeping subscriptions to all of them + foreach (var frame in _keyFrames) + frame.Expression?.CollectReferences(hs); + Initialize(storeOffset, hs); + } + + public override void Activate() + { + TargetObject.Compositor.AddToClock(this); + base.Activate(); + } + + public override void Deactivate() + { + TargetObject.Compositor.RemoveFromClock(this); + base.Deactivate(); } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs index d7f2504061..26ba35409d 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/KeyFrames.cs @@ -66,7 +66,7 @@ namespace Avalonia.Rendering.Composition.Animations struct ServerKeyFrame { public T Value; - public Expression Expression; + public Expression? Expression; public IEasingFunction EasingFunction; public float Key; } diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs index 004c2676ff..bc0ce804dc 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs @@ -24,11 +24,16 @@ namespace Avalonia.Rendering.Composition _variants[key] = value; } + /* + For INTERNAL USE by CompositionAnimation ONLY, we DON'T support expression + paths like SomeParam.SomePropertyObject.SomeValue + */ internal void Set(string key, CompositionObject obj) { _objects[key] = obj ?? throw new ArgumentNullException(nameof(obj)); _variants.Remove(key); } + public void InsertColor(string propertyName, Avalonia.Media.Color value) => Set(propertyName, value); public void InsertMatrix3x2(string propertyName, Matrix3x2 value) => Set(propertyName, value); @@ -99,7 +104,10 @@ namespace Avalonia.Rendering.Composition _variants.Remove(key); } - internal PropertySetSnapshot Snapshot(bool server, int allowedNestingLevel) + internal PropertySetSnapshot Snapshot(bool server) => + SnapshotCore(server, 1); + + private PropertySetSnapshot SnapshotCore(bool server, int allowedNestingLevel) { var dic = new Dictionary(_objects.Count + _variants.Count); foreach (var o in _objects) @@ -108,7 +116,7 @@ namespace Avalonia.Rendering.Composition { if (allowedNestingLevel <= 0) throw new InvalidOperationException("PropertySet depth limit reached"); - dic[o.Key] = new PropertySetSnapshot.Value(ps.Snapshot(server, allowedNestingLevel - 1)); + dic[o.Key] = new PropertySetSnapshot.Value(ps.SnapshotCore(server, allowedNestingLevel - 1)); } else if (o.Value.Server == null) throw new InvalidOperationException($"Object of type {o.Value.GetType()} is not allowed"); diff --git a/src/Avalonia.Base/Rendering/Composition/ElementCompositionPreview.cs b/src/Avalonia.Base/Rendering/Composition/ElementCompositionPreview.cs new file mode 100644 index 0000000000..afda314276 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/ElementCompositionPreview.cs @@ -0,0 +1,6 @@ +namespace Avalonia.Rendering.Composition; + +public static class ElementCompositionPreview +{ + public static CompositionVisual? GetElementVisual(Visual visual) => visual.CompositionVisual; +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs index 5577d2b52a..088771e1ba 100644 --- a/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/Expression.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Reflection; +using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Expressions { @@ -15,6 +16,11 @@ namespace Avalonia.Rendering.Composition.Expressions public abstract ExpressionVariant Evaluate(ref ExpressionEvaluationContext context); + public virtual void CollectReferences(HashSet<(string parameter, string property)> references) + { + + } + protected abstract string Print(); public override string ToString() => Print(); @@ -114,6 +120,13 @@ namespace Avalonia.Rendering.Composition.Expressions return FalsePart.Evaluate(ref context); } + public override void CollectReferences(HashSet<(string parameter, string property)> references) + { + Condition.CollectReferences(references); + TruePart.CollectReferences(references); + FalsePart.CollectReferences(references); + } + protected override string Print() => $"({Condition}) ? ({TruePart}) : ({FalsePart})"; } @@ -128,6 +141,7 @@ namespace Avalonia.Rendering.Composition.Expressions } public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) => Constant; + protected override string Print() => Constant.ToString(CultureInfo.InvariantCulture); } @@ -155,6 +169,12 @@ namespace Avalonia.Rendering.Composition.Expressions return res; } + public override void CollectReferences(HashSet<(string parameter, string property)> references) + { + foreach(var arg in Parameters) + arg.CollectReferences(references); + } + protected override string Print() { return Name + "( (" + string.Join("), (", Parameters) + ") )"; @@ -173,18 +193,30 @@ namespace Avalonia.Rendering.Composition.Expressions Member = string.Intern(member); } + public override void CollectReferences(HashSet<(string parameter, string property)> references) + { + Target.CollectReferences(references); + if (Target is ParameterExpression pe) + references.Add((pe.Name, Member)); + } + public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context) { if (Target is KeywordExpression ke && ke.Keyword == ExpressionKeyword.Target) + { return context.Target.GetProperty(Member); + } + if (Target is ParameterExpression pe) { var obj = context.Parameters?.GetObjectParameter(pe.Name); if (obj != null) + { return obj.GetProperty(Member); + } } - + // Those are considered immutable return Target.Evaluate(ref context).GetProperty(Member); } @@ -263,6 +295,11 @@ namespace Avalonia.Rendering.Composition.Expressions return default; } + public override void CollectReferences(HashSet<(string parameter, string property)> references) + { + Parameter.CollectReferences(references); + } + protected override string Print() { return OperatorName(Type) + Parameter; @@ -313,6 +350,12 @@ namespace Avalonia.Rendering.Composition.Expressions return default; } + public override void CollectReferences(HashSet<(string parameter, string property)> references) + { + Left.CollectReferences(references); + Right.CollectReferences(references); + } + protected override string Print() { return "(" + Left + OperatorName(Type) + Right + ")"; diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs index a7ddabd70d..9d23551e43 100644 --- a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionEvaluationContext.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Expressions { diff --git a/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionTrackedValues.cs b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionTrackedValues.cs new file mode 100644 index 0000000000..334f975aa0 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionTrackedValues.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System.Collections.Generic; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Expressions; + +internal class ExpressionTrackedObjects : IEnumerable +{ + private List _list = new(); + private HashSet _hashSet = new(); + + public void Add(IExpressionObject obj, string member) + { + if (_hashSet.Add(obj)) + _list.Add(obj); + } + + public void Clear() + { + _list.Clear(); + _hashSet.Clear(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _list.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)_list).GetEnumerator(); + } + + public List.Enumerator GetEnumerator() => _list.GetEnumerator(); + + public struct Pool + { + private Stack _stack = new(); + + public Pool() + { + } + + public ExpressionTrackedObjects Get() + { + if (_stack.Count > 0) + return _stack.Pop(); + return new ExpressionTrackedObjects(); + } + + public void Return(ExpressionTrackedObjects obj) + { + _stack.Clear(); + _stack.Push(obj); + } + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs b/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs index 8c2e6e774a..a60084d8f3 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/FpsCounter.cs @@ -10,24 +10,23 @@ namespace Avalonia.Rendering.Composition.Server; internal class FpsCounter { - private readonly GlyphTypeface _typeface; - private readonly bool _useManualFpsCounting; private readonly Stopwatch _stopwatch = Stopwatch.StartNew(); private int _framesThisSecond; + private int _totalFrames; private int _fps; private TimeSpan _lastFpsUpdate; - private GlyphRun[] _runs = new GlyphRun[10]; + const int FirstChar = 32; + const int LastChar = 126; + private GlyphRun[] _runs = new GlyphRun[LastChar - FirstChar + 1]; - public FpsCounter(GlyphTypeface typeface, bool useManualFpsCounting = false) + public FpsCounter(GlyphTypeface typeface) { - for (var c = 0; c <= 9; c++) + for (var c = FirstChar; c <= LastChar; c++) { - var s = c.ToString(); + var s = new string((char)c, 1); var glyph = typeface.GetGlyph((uint)(s[0])); - _runs[c] = new GlyphRun(typeface, 18, new ReadOnlySlice(s.AsMemory()), new ushort[] { glyph }); + _runs[c - FirstChar] = new GlyphRun(typeface, 18, new ReadOnlySlice(s.AsMemory()), new ushort[] { glyph }); } - _typeface = typeface; - _useManualFpsCounting = useManualFpsCounting; } public void FpsTick() => _framesThisSecond++; @@ -37,8 +36,8 @@ internal class FpsCounter var now = _stopwatch.Elapsed; var elapsed = now - _lastFpsUpdate; - if (!_useManualFpsCounting) - ++_framesThisSecond; + ++_framesThisSecond; + ++_totalFrames; if (elapsed.TotalSeconds > 1) { @@ -47,12 +46,12 @@ internal class FpsCounter _lastFpsUpdate = now; } - var fpsLine = _fps.ToString("000"); + var fpsLine = $"Frame #{_totalFrames:00000000} FPS: {_fps:000}"; double width = 0; double height = 0; foreach (var ch in fpsLine) { - var run = _runs[ch - '0']; + var run = _runs[ch - FirstChar]; width += run.Size.Width; height = Math.Max(height, run.Size.Height); } @@ -64,7 +63,7 @@ internal class FpsCounter double offset = 0; foreach (var ch in fpsLine) { - var run = _runs[ch - '0']; + var run = _runs[ch - FirstChar]; context.Transform = Matrix.CreateTranslation(offset, 0); context.DrawGlyphRun(Brushes.White, run); offset += run.Size.Width; diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index 04ec711455..dab65fc8ed 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -56,10 +56,11 @@ namespace Avalonia.Rendering.Composition.Server Compositor.UpdateServerTime(); - Root.Update(this, Matrix4x4.Identity); - if(_dirtyRect.IsEmpty && !_redrawRequested) return; + + Root.Update(this, Matrix4x4.Identity); + _redrawRequested = false; using (var targetContext = _renderTarget.CreateDrawingContext(null)) { diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs index e56f85acdf..5dbe9cfb17 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using Avalonia.Rendering.Composition.Animations; +using Avalonia.Rendering.Composition.Expressions; using Avalonia.Rendering.Composition.Transport; namespace Avalonia.Rendering.Composition.Server @@ -13,6 +15,8 @@ namespace Avalonia.Rendering.Composition.Server public Stopwatch Clock { get; } = Stopwatch.StartNew(); public TimeSpan ServerNow { get; private set; } private List _activeTargets = new(); + private HashSet _activeAnimations = new(); + private List _animationsToUpdate = new(); public ServerCompositor(IRenderLoop renderLoop) { @@ -64,6 +68,7 @@ namespace Avalonia.Rendering.Composition.Server } bool IRenderLoopTask.NeedsUpdate => false; + void IRenderLoopTask.Update(TimeSpan time) { } @@ -71,6 +76,15 @@ namespace Avalonia.Rendering.Composition.Server void IRenderLoopTask.Render() { ApplyPendingBatches(); + + foreach(var animation in _activeAnimations) + _animationsToUpdate.Add(animation); + + foreach(var animation in _animationsToUpdate) + animation.Invalidate(); + + _animationsToUpdate.Clear(); + foreach (var t in _activeTargets) t.Render(); @@ -86,5 +100,11 @@ namespace Avalonia.Rendering.Composition.Server { _activeTargets.Remove(target); } + + public void AddToClock(IAnimationInstance animationInstance) => + _activeAnimations.Add(animationInstance); + + public void RemoveFromClock(IAnimationInstance animationInstance) => + _activeAnimations.Remove(animationInstance); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs index 072377cd7e..5b2f58b186 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs @@ -1,5 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Avalonia.Rendering.Composition.Animations; using Avalonia.Rendering.Composition.Expressions; using Avalonia.Rendering.Composition.Transport; +using Avalonia.Utilities; namespace Avalonia.Rendering.Composition.Server { @@ -9,7 +15,9 @@ namespace Avalonia.Rendering.Composition.Server public virtual long LastChangedBy => ItselfLastChangedBy; public long ItselfLastChangedBy { get; private set; } - + private uint _activationCount; + public bool IsActive => _activationCount != 0; + public ServerObject(ServerCompositor compositor) { Compositor = compositor; @@ -23,6 +31,7 @@ namespace Avalonia.Rendering.Composition.Server public void Apply(ChangeSet changes) { ApplyCore(changes); + ValuesInvalidated(); ItselfLastChangedBy = changes.Batch!.SequenceId; } @@ -32,5 +41,76 @@ namespace Avalonia.Rendering.Composition.Server } ExpressionVariant IExpressionObject.GetProperty(string name) => GetPropertyForAnimation(name); + + public void Activate() + { + _activationCount++; + if (_activationCount == 1) + Activated(); + } + + public void Deactivate() + { +#if DEBUG + if (_activationCount == 0) + throw new InvalidOperationException(); +#endif + _activationCount--; + if (_activationCount == 0) + Deactivated(); + } + + protected virtual void Activated() + { + + } + + protected virtual void Deactivated() + { + + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected int GetOffset(ref T field) where T : struct + { + return Unsafe.ByteOffset(ref Unsafe.As(ref _activationCount), + ref Unsafe.As(ref field)) + .ToInt32(); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private ref ServerObjectSubscriptionStore GetStoreFromOffset(int offset) + { + return ref Unsafe.As(ref Unsafe.AddByteOffset(ref _activationCount, + new IntPtr(offset))); + } + + public void NotifyAnimatedValueChanged(int offset) + { + ref var store = ref GetStoreFromOffset(offset); + store.Invalidate(); + ValuesInvalidated(); + } + + protected virtual void ValuesInvalidated() + { + + } + + public void SubscribeToInvalidation(int member, IAnimationInstance animation) + { + ref var store = ref GetStoreFromOffset(member); + if (store.Subscribers.AddRef(animation)) + Activate(); + } + + public void UnsubscribeFromInvalidation(int member, IAnimationInstance animation) + { + ref var store = ref GetStoreFromOffset(member); + if (store.Subscribers.ReleaseRef(animation)) + Deactivate(); + } + + public virtual int? GetFieldOffset(string fieldName) => null; } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index bf5b8bf292..05b63a7a73 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -7,6 +7,7 @@ namespace Avalonia.Rendering.Composition.Server unsafe partial class ServerCompositionVisual : ServerObject { private bool _isDirty; + private ServerCompositionTarget? _root; protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { @@ -95,16 +96,31 @@ namespace Avalonia.Rendering.Composition.Server Parent = c.Parent.Value; if (c.Root.IsSet) Root = c.Root.Value; - _isDirty = true; + ValuesInvalidated(); + } + + public ServerCompositionTarget? Root + { + get => _root; + private set + { + if(_root != null) + Deactivate(); + _root = value; + if (_root != null) + Activate(); + } + } + protected override void ValuesInvalidated() + { + _isDirty = true; if (IsVisibleInFrame) Root?.AddDirtyRect(TransformedBounds); else Root?.Invalidate(); } - public ServerCompositionTarget? Root { get; private set; } - public ServerCompositionVisual? Parent { get; private set; } public bool IsVisibleInFrame { get; set; } public Rect TransformedBounds { get; set; } diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index 25fce01de3..f7c8078073 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -38,7 +38,6 @@ namespace Avalonia.Rendering.Composition { } - internal Matrix4x4? TryGetServerTransform() { if (Root == null) diff --git a/src/Avalonia.Base/Utilities/RefTrackingDictionary.cs b/src/Avalonia.Base/Utilities/RefTrackingDictionary.cs new file mode 100644 index 0000000000..71305a8305 --- /dev/null +++ b/src/Avalonia.Base/Utilities/RefTrackingDictionary.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Avalonia.Utilities; + +internal class RefTrackingDictionary : Dictionary where TKey : class +{ + /// + /// Increase reference count for a key by 1. + /// + /// true if key was added to the dictionary, false otherwise + public bool AddRef(TKey key) + { +#if NET5_0_OR_GREATER + ref var count = ref CollectionsMarshal.GetValueRefOrAddDefault(this, key, out var _); + count++; +#else + TryGetValue(key, out var count); + count++; + this[key] = count; +#endif + return count == 1; + } + + /// + /// Decrease reference count for a key by 1. + /// + /// true if key was removed to the dictionary, false otherwise + public bool ReleaseRef(TKey key) + { +#if NET5_0_OR_GREATER + ref var count = ref CollectionsMarshal.GetValueRefOrNullRef(this, key); + if (Unsafe.IsNullRef(ref count)) +#if DEBUG + throw new InvalidOperationException("Attempting to release a non-referenced object"); +#else + return false; +#endif // DEBUG + count--; + if (count == 0) + { + Remove(key); + return true; + } + + return false; +#else + if (!TryGetValue(key, out var count)) +#if DEBUG + throw new InvalidOperationException("Attempting to release a non-referenced object"); +#else + return false; +#endif // DEBUG + count--; + if (count == 0) + { + Remove(key); + return true; + } + + this[key] = count; + return false; +#endif + } +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj b/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj index 97e58f8a64..3312f7a619 100644 --- a/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj +++ b/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj @@ -3,6 +3,7 @@ netstandard2.0 enable + false diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs index f079a339df..72311b4d18 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/CompositionRoslynGenerator.cs @@ -2,20 +2,22 @@ using System.IO; using System.Xml.Serialization; using Microsoft.CodeAnalysis; -namespace Avalonia.SourceGenerator.CompositionGenerator; - -[Generator(LanguageNames.CSharp)] -public class CompositionRoslynGenerator : IIncrementalGenerator +namespace Avalonia.SourceGenerator.CompositionGenerator { - public void Initialize(IncrementalGeneratorInitializationContext context) + [Generator(LanguageNames.CSharp)] + public class CompositionRoslynGenerator : IIncrementalGenerator { - var schema = context.AdditionalTextsProvider.Where(static file => file.Path.EndsWith("composition-schema.xml")); - var configs = schema.Select((t, _) => - (GConfig)new XmlSerializer(typeof(GConfig)).Deserialize(new StringReader(t.GetText().ToString()))); - context.RegisterSourceOutput(configs, (spc, config) => + public void Initialize(IncrementalGeneratorInitializationContext context) { - var generator = new Generator(spc, config); - generator.Generate(); - }); + var schema = + context.AdditionalTextsProvider.Where(static file => file.Path.EndsWith("composition-schema.xml")); + var configs = schema.Select((t, _) => + (GConfig)new XmlSerializer(typeof(GConfig)).Deserialize(new StringReader(t.GetText().ToString()))); + context.RegisterSourceOutput(configs, (spc, config) => + { + var generator = new Generator(new RoslynCompositionGeneratorSink(spc), config); + generator.Generate(); + }); + } } } \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs index 43ef4a96e8..5a514a4eff 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs @@ -7,14 +7,14 @@ using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; using static Avalonia.SourceGenerator.CompositionGenerator.Extensions; namespace Avalonia.SourceGenerator.CompositionGenerator { - partial class Generator + public partial class Generator { - private readonly SourceProductionContext _output; + private readonly ICompositionGeneratorSink _output; private readonly GConfig _config; private readonly HashSet _objects; private readonly HashSet _brushes; private readonly Dictionary _manuals; - public Generator(SourceProductionContext output, GConfig config) + public Generator(ICompositionGeneratorSink output, GConfig config) { _output = output; _config = config; @@ -168,17 +168,35 @@ namespace Avalonia.SourceGenerator.CompositionGenerator ExpressionStatement(InvocationExpression(IdentifierName("ApplyChangesExtra")) .AddArgumentListArguments(Argument(IdentifierName("c")))) ); + + var uninitializedObjectName = "dummy"; + var serverStaticCtorBody = cl.Abstract + ? Block() + : Block( + ParseStatement( + $"var dummy = ({serverName})System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof({serverName}));"), + ParseStatement($"System.GC.SuppressFinalize(dummy);"), + ParseStatement("InitializeFieldOffsets(dummy);") + ); + + var initializeFieldOffsetsBody = cl.ServerBase == null + ? Block() + : Block(ParseStatement($"{cl.ServerBase}.InitializeFieldOffsets(dummy);")); var resetBody = Block(); var startAnimationBody = Block(); var getPropertyBody = Block(); var serverGetPropertyBody = Block(); + var serverGetFieldOffsetBody = Block(); + var activatedBody = Block(ParseStatement("base.Activated();")); + var deactivatedBody = Block(ParseStatement("base.Deactivated();")); var defaultsMethodBody = Block(); foreach (var prop in cl.Properties) { var fieldName = "_" + prop.Name.WithLowerFirst(); + var fieldOffsetName = "s_OffsetOf" + fieldName; var propType = ParseTypeName(prop.Type); var filteredPropertyType = prop.Type.TrimEnd('?'); var isObject = _objects.Contains(filteredPropertyType); @@ -229,7 +247,7 @@ namespace Avalonia.SourceGenerator.CompositionGenerator if (animatedServer) server = server.AddMembers( - DeclareField("AnimatedValueStore<" + serverPropertyType + ">", fieldName), + DeclareField("ServerAnimatedValueStore<" + serverPropertyType + ">", fieldName), PropertyDeclaration(ParseTypeName(serverPropertyType), prop.Name) .AddModifiers(SyntaxKind.PublicKeyword) .WithExpressionBody(ArrowExpressionClause( @@ -240,24 +258,24 @@ namespace Avalonia.SourceGenerator.CompositionGenerator else { server = server - .AddMembers(DeclareField(serverPropertyType, fieldName)) + .AddMembers(DeclareField("ServerValueStore<" + serverPropertyType + ">", fieldName)) .AddMembers(PropertyDeclaration(ParseTypeName(serverPropertyType), prop.Name) .AddModifiers(SyntaxKind.PublicKeyword) .AddAccessorListAccessors( AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, - Block(ReturnStatement(IdentifierName(fieldName)))), + Block(ReturnStatement(MemberAccess(IdentifierName(fieldName), "Value")))), AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, Block( ParseStatement("var changed = false;"), IfStatement(BinaryExpression(SyntaxKind.NotEqualsExpression, - IdentifierName(fieldName), + MemberAccess(IdentifierName(fieldName), "Value"), IdentifierName("value")), Block( ParseStatement("On" + prop.Name + "Changing();"), ParseStatement($"changed = true;")) ), ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(fieldName), IdentifierName("value"))), + MemberAccess(IdentifierName(fieldName), "Value"), IdentifierName("value"))), ParseStatement($"if(changed) On" + prop.Name + "Changed();") )) )) @@ -270,15 +288,22 @@ namespace Avalonia.SourceGenerator.CompositionGenerator if (animatedServer) applyMethodBody = applyMethodBody.AddStatements( IfStatement(MemberAccess(changesVar, prop.Name, "IsValue"), - ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(fieldName), MemberAccess(changesVar, prop.Name, "Value")))), + ExpressionStatement( + InvocationExpression(MemberAccess(fieldName, "SetValue"), + ArgumentList(SeparatedList(new[] + { + Argument(IdentifierName("this")), + Argument(MemberAccess(changesVar, prop.Name, "Value")), + }))))), IfStatement(MemberAccess(changesVar, prop.Name, "IsAnimation"), ExpressionStatement( InvocationExpression(MemberAccess(fieldName, "SetAnimation"), ArgumentList(SeparatedList(new[] { + Argument(IdentifierName("this")), Argument(changesVar), - Argument(MemberAccess(changesVar, prop.Name, "Animation")) + Argument(MemberAccess(changesVar, prop.Name, "Animation")), + Argument(IdentifierName(fieldOffsetName)) }))))) ); else @@ -288,16 +313,28 @@ namespace Avalonia.SourceGenerator.CompositionGenerator IdentifierName(prop.Name), MemberAccess(changesVar, prop.Name, "Value")))) ); - resetBody = resetBody.AddStatements( ExpressionStatement(InvocationExpression(MemberAccess(prop.Name, "Reset")))); if (animatedServer) + { startAnimationBody = ApplyStartAnimation(startAnimationBody, prop, fieldName); + activatedBody = activatedBody.AddStatements(ParseStatement($"{fieldName}.Activate(this);")); + deactivatedBody = deactivatedBody.AddStatements(ParseStatement($"{fieldName}.Deactivate(this);")); + } + getPropertyBody = ApplyGetProperty(getPropertyBody, prop); - serverGetPropertyBody = ApplyGetProperty(getPropertyBody, prop); + serverGetPropertyBody = ApplyGetProperty(serverGetPropertyBody, prop); + serverGetFieldOffsetBody = ApplyGetProperty(serverGetFieldOffsetBody, prop, fieldOffsetName); + + server = server.AddMembers(DeclareField("int", fieldOffsetName, SyntaxKind.StaticKeyword)); + initializeFieldOffsetsBody = initializeFieldOffsetsBody.AddStatements(ExpressionStatement( + AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, IdentifierName(fieldOffsetName), + InvocationExpression(MemberAccess(IdentifierName(uninitializedObjectName), "GetOffset"), + ArgumentList(SingletonSeparatedList(Argument( + RefExpression(MemberAccess(IdentifierName(uninitializedObjectName), fieldName))))))))); if (prop.DefaultValue != null) { @@ -357,6 +394,21 @@ namespace Avalonia.SourceGenerator.CompositionGenerator Parameter(Identifier("changes")).WithType(ParseTypeName("ChangeSet"))) .WithBody(applyMethodBody)); + server = server.AddMembers(ConstructorDeclaration(serverName) + .WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) + .WithBody(serverStaticCtorBody)); + + server = server.AddMembers( + ((MethodDeclarationSyntax)ParseMemberDeclaration( + $"protected static void InitializeFieldOffsets({serverName} dummy){{}}")!) + .WithBody(initializeFieldOffsetsBody)); + + server = server + .AddMembers(((MethodDeclarationSyntax)ParseMemberDeclaration( + $"protected override void Activated(){{}}")!).WithBody(activatedBody)) + .AddMembers(((MethodDeclarationSyntax)ParseMemberDeclaration( + $"protected override void Deactivated(){{}}")!).WithBody(deactivatedBody)); + client = client.AddMembers( MethodDeclaration(ParseTypeName("void"), "InitializeDefaults").WithBody(defaultsMethodBody)); @@ -374,7 +426,8 @@ namespace Avalonia.SourceGenerator.CompositionGenerator client = WithGetProperty(client, getPropertyBody, false); server = WithGetProperty(server, serverGetPropertyBody, true); - + server = WithGetFieldOffset(server, serverGetFieldOffsetBody); + if(cl.Implements.Count > 0) foreach (var impl in cl.Implements) { @@ -452,17 +505,19 @@ return; "Vector2", "Vector3", "Vector4", + "Matrix", "Matrix3x2", "Matrix4x4", "Quaternion", - "CompositionColor" + "Color", + "Avalonia.Media.Color" }; - BlockSyntax ApplyGetProperty(BlockSyntax body, GProperty prop) + BlockSyntax ApplyGetProperty(BlockSyntax body, GProperty prop, string? expr = null) { if (VariantPropertyTypes.Contains(prop.Type)) return body.AddStatements( - ParseStatement($"if(name == \"{prop.Name}\")\n return {prop.Name};\n") + ParseStatement($"if(name == \"{prop.Name}\")\n return {expr ?? prop.Name};\n") ); return body; @@ -480,6 +535,19 @@ return; return cl.AddMembers(method); } + + ClassDeclarationSyntax WithGetFieldOffset(ClassDeclarationSyntax cl, BlockSyntax body) + { + if (body.Statements.Count == 0) + return cl; + body = body.AddStatements( + ParseStatement("return base.GetFieldOffset(name);")); + var method = ((MethodDeclarationSyntax)ParseMemberDeclaration( + $"public override int? GetFieldOffset(string name){{}}")) + .WithBody(body); + + return cl.AddMembers(method); + } ClassDeclarationSyntax WithStartAnimation(ClassDeclarationSyntax cl, BlockSyntax body) { diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/ICompositionGeneratorSink.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/ICompositionGeneratorSink.cs new file mode 100644 index 0000000000..085a4041be --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/ICompositionGeneratorSink.cs @@ -0,0 +1,6 @@ +namespace Avalonia.SourceGenerator.CompositionGenerator; + +public interface ICompositionGeneratorSink +{ + void AddSource(string name, string code); +} \ No newline at end of file diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/RoslynCompositionGeneratorSink.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/RoslynCompositionGeneratorSink.cs new file mode 100644 index 0000000000..6fec3faf93 --- /dev/null +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/RoslynCompositionGeneratorSink.cs @@ -0,0 +1,15 @@ +using Microsoft.CodeAnalysis; + +namespace Avalonia.SourceGenerator.CompositionGenerator; + +class RoslynCompositionGeneratorSink : ICompositionGeneratorSink +{ + private readonly SourceProductionContext _ctx; + + public RoslynCompositionGeneratorSink(SourceProductionContext ctx) + { + _ctx = ctx; + } + + public void AddSource(string name, string code) => _ctx.AddSource(name, code); +} \ No newline at end of file From 8e4d904a5af3d71bfdaee77daf2f319961f4b619 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 24 May 2022 22:49:09 -0400 Subject: [PATCH 038/393] Simplify some runtime platform interfaces and prefer net6 alternatives --- .../Platform/Interop/IDynamicLibraryLoader.cs | 5 + src/Avalonia.PlatformSupport/DynLoader.cs | 56 ++++--- .../Internal/AssemblyDescriptorResolver.cs | 4 +- .../StandardRuntimePlatform.cs | 146 +++--------------- .../StandardRuntimePlatformServices.cs | 11 +- 5 files changed, 65 insertions(+), 157 deletions(-) diff --git a/src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs b/src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs index 9389ebc703..d9db4b71d5 100644 --- a/src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs +++ b/src/Avalonia.Base/Platform/Interop/IDynamicLibraryLoader.cs @@ -16,5 +16,10 @@ namespace Avalonia.Platform.Interop { } + + public DynamicLibraryLoaderException(string message, Exception innerException) : base(message, innerException) + { + + } } } diff --git a/src/Avalonia.PlatformSupport/DynLoader.cs b/src/Avalonia.PlatformSupport/DynLoader.cs index ad76ac4724..ef2166d943 100644 --- a/src/Avalonia.PlatformSupport/DynLoader.cs +++ b/src/Avalonia.PlatformSupport/DynLoader.cs @@ -26,25 +26,6 @@ namespace Avalonia.PlatformSupport } } - static class AndroidImports - { - [DllImport("libdl.so")] - private static extern IntPtr dlopen(string path, int flags); - - [DllImport("libdl.so")] - private static extern IntPtr dlsym(IntPtr handle, string symbol); - - [DllImport("libdl.so")] - private static extern IntPtr dlerror(); - - public static void Init() - { - DlOpen = dlopen; - DlSym = dlsym; - DlError = dlerror; - } - } - static class OsXImports { [DllImport("/usr/lib/libSystem.dylib")] @@ -77,10 +58,6 @@ namespace Avalonia.PlatformSupport Marshal.FreeHGlobal(buffer); if (unixName == "Darwin") OsXImports.Init(); -#if NET6_0_OR_GREATER - else if (OperatingSystem.IsAndroid()) - AndroidImports.Init(); -#endif else LinuxImports.Init(); } @@ -135,6 +112,39 @@ namespace Avalonia.PlatformSupport return ptr; } } + +#if NET6_0_OR_GREATER + internal class Net6Loader : IDynamicLibraryLoader + { + public IntPtr LoadLibrary(string dll) + { + try + { + return NativeLibrary.Load(dll); + } + catch (Exception ex) + { + throw new DynamicLibraryLoaderException("Error loading " + dll, ex); + } + } + + public IntPtr GetProcAddress(IntPtr dll, string proc, bool optional) + { + try + { + if (optional) + { + return NativeLibrary.TryGetExport(dll, proc, out var address) ? address : default; + } + return NativeLibrary.GetExport(dll, proc); + } + catch (Exception ex) + { + throw new DynamicLibraryLoaderException("Error " + dll, ex); + } + } + } +#endif internal class NotSupportedLoader : IDynamicLibraryLoader { diff --git a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs b/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs index 28ae35d57d..6b85200c76 100644 --- a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs +++ b/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; namespace Avalonia.PlatformSupport.Internal; @@ -29,9 +30,8 @@ internal class AssemblyDescriptorResolver: IAssemblyDescriptorResolver } else { - // iOS does not support loading assemblies dynamically! #if NET6_0_OR_GREATER - if (OperatingSystem.IsIOS()) + if (!RuntimeFeature.IsDynamicCodeSupported) { throw new InvalidOperationException( $"Assembly {name} needs to be referenced and explicitly loaded before loading resources"); diff --git a/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs b/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs index 4eeb9232cf..048f09570f 100644 --- a/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using Avalonia.Platform; @@ -14,45 +12,20 @@ namespace Avalonia.PlatformSupport return new Timer(_ => tick(), null, interval, interval); } - public IUnmanagedBlob AllocBlob(int size) => new UnmanagedBlob(this, size); + public IUnmanagedBlob AllocBlob(int size) => new UnmanagedBlob(size); private class UnmanagedBlob : IUnmanagedBlob { - private readonly StandardRuntimePlatform _plat; private IntPtr _address; private readonly object _lock = new object(); -#if DEBUG - private static readonly List Backtraces = new List(); - private static Thread? GCThread; - private readonly string _backtrace; - private static readonly object _btlock = new object(); - class GCThreadDetector - { - ~GCThreadDetector() - { - GCThread = Thread.CurrentThread; - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] - static void Spawn() => new GCThreadDetector(); - - static UnmanagedBlob() - { - Spawn(); - GC.WaitForPendingFinalizers(); - } -#endif - - public UnmanagedBlob(StandardRuntimePlatform plat, int size) + public UnmanagedBlob(int size) { try { if (size <= 0) throw new ArgumentException("Positive number required", nameof(size)); - _plat = plat; - _address = plat.Alloc(size); + _address = Marshal.AllocHGlobal(size); GC.AddMemoryPressure(size); Size = size; } @@ -61,24 +34,15 @@ namespace Avalonia.PlatformSupport GC.SuppressFinalize(this); throw; } -#if DEBUG - _backtrace = Environment.StackTrace; - lock (_btlock) - Backtraces.Add(_backtrace); -#endif } - void DoDispose() + private void DoDispose() { lock (_lock) { if (!IsDisposed) { -#if DEBUG - lock (_btlock) - Backtraces.Remove(_backtrace); -#endif - _plat?.Free(_address, Size); + Marshal.FreeHGlobal(_address); GC.RemoveMemoryPressure(Size); IsDisposed = true; _address = IntPtr.Zero; @@ -89,29 +53,12 @@ namespace Avalonia.PlatformSupport public void Dispose() { -#if DEBUG - if (Thread.CurrentThread.ManagedThreadId == GCThread?.ManagedThreadId) - { - lock (_lock) - { - if (!IsDisposed) - { - Console.Error.WriteLine("Native blob disposal from finalizer thread\nBacktrace: " - + Environment.StackTrace - + "\n\nBlob created by " + _backtrace); - } - } - } -#endif DoDispose(); GC.SuppressFinalize(this); } ~UnmanagedBlob() { -#if DEBUG - Console.Error.WriteLine("Undisposed native blob created by " + _backtrace); -#endif DoDispose(); } @@ -119,82 +66,25 @@ namespace Avalonia.PlatformSupport public int Size { get; private set; } public bool IsDisposed { get; private set; } } - -#if NET461 || NETCOREAPP2_0_OR_GREATER - [DllImport("libc", SetLastError = true)] - private static extern IntPtr mmap(IntPtr addr, IntPtr length, int prot, int flags, int fd, IntPtr offset); - [DllImport("libc", SetLastError = true)] - private static extern int munmap(IntPtr addr, IntPtr length); - [DllImport("libc", SetLastError = true)] - private static extern long sysconf(int name); - - private bool? _useMmap; - private bool UseMmap - => _useMmap ?? ((_useMmap = GetRuntimeInfo().OperatingSystem == OperatingSystemType.Linux)).Value; - - IntPtr Alloc(int size) - { - if (UseMmap) - { - var rv = mmap(IntPtr.Zero, new IntPtr(size), 3, 0x22, -1, IntPtr.Zero); - if (rv.ToInt64() == -1 || (ulong)rv.ToInt64() == 0xffffffff) - { - var errno = Marshal.GetLastWin32Error(); - throw new Exception("Unable to allocate memory: " + errno); - } - return rv; - } - else - return Marshal.AllocHGlobal(size); - } - - void Free(IntPtr ptr, int len) - { - if (UseMmap) - { - if (munmap(ptr, new IntPtr(len)) == -1) - { - var errno = Marshal.GetLastWin32Error(); - throw new Exception("Unable to free memory: " + errno); - } - } - else - Marshal.FreeHGlobal(ptr); - } -#else - IntPtr Alloc(int size) => Marshal.AllocHGlobal(size); - void Free(IntPtr ptr, int len) => Marshal.FreeHGlobal(ptr); -#endif - - private static readonly Lazy Info = new Lazy(() => + + private static readonly Lazy Info = new(() => { OperatingSystemType os; -#if NET5_0_OR_GREATER - if (OperatingSystem.IsWindows()) - os = OperatingSystemType.WinNT; - else if (OperatingSystem.IsMacOS()) - os = OperatingSystemType.OSX; - else if (OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD()) - os = OperatingSystemType.Linux; - else if (OperatingSystem.IsAndroid()) - os = OperatingSystemType.Android; - else if (OperatingSystem.IsIOS()) - os = OperatingSystemType.iOS; - else if (OperatingSystem.IsBrowser()) - os = OperatingSystemType.Browser; - else - throw new Exception("Unknown OS platform " + RuntimeInformation.OSDescription); -#else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) os = OperatingSystemType.OSX; - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) os = OperatingSystemType.Linux; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) os = OperatingSystemType.WinNT; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("Android"))) + os = OperatingSystemType.Android; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("iOS"))) + os = OperatingSystemType.iOS; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("Browser"))) + os = OperatingSystemType.Browser; else throw new Exception("Unknown OS platform " + RuntimeInformation.OSDescription); -#endif return new RuntimePlatformInfo { @@ -203,10 +93,10 @@ namespace Avalonia.PlatformSupport #elif NETFRAMEWORK IsDotNetFramework = true, #endif - IsDesktop = os == OperatingSystemType.Linux || os == OperatingSystemType.OSX || os == OperatingSystemType.WinNT, - IsMono = os == OperatingSystemType.Android || os == OperatingSystemType.iOS || os == OperatingSystemType.Browser, - IsMobile = os == OperatingSystemType.Android || os == OperatingSystemType.iOS, - IsUnix = os == OperatingSystemType.Linux || os == OperatingSystemType.OSX || os == OperatingSystemType.Android, + IsDesktop = os is OperatingSystemType.Linux or OperatingSystemType.OSX or OperatingSystemType.WinNT, + IsMono = os is OperatingSystemType.Android or OperatingSystemType.iOS or OperatingSystemType.Browser, + IsMobile = os is OperatingSystemType.Android or OperatingSystemType.iOS, + IsUnix = os is OperatingSystemType.Linux or OperatingSystemType.OSX or OperatingSystemType.Android, IsBrowser = os == OperatingSystemType.Browser, OperatingSystem = os, }; diff --git a/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs b/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs index ae7478feb9..11ca906782 100644 --- a/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs +++ b/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs @@ -9,22 +9,25 @@ namespace Avalonia.PlatformSupport public static void Register(Assembly? assembly = null) { var standardPlatform = new StandardRuntimePlatform(); - var os = standardPlatform.GetRuntimeInfo().OperatingSystem; AssetLoader.RegisterResUriParsers(); AvaloniaLocator.CurrentMutable .Bind().ToConstant(standardPlatform) .Bind().ToConstant(new AssetLoader(assembly)) .Bind().ToConstant( - os switch +#if NET6_0_OR_GREATER + new Net6Loader() +#else + standardPlatform.GetRuntimeInfo().OperatingSystem switch { - OperatingSystemType.WinNT => new Win32Loader(), + OperatingSystemType.WinNT => (IDynamicLibraryLoader)new Win32Loader(), OperatingSystemType.OSX => new UnixLoader(), OperatingSystemType.Linux => new UnixLoader(), OperatingSystemType.Android => new UnixLoader(), // iOS, WASM, ... - _ => (IDynamicLibraryLoader)new NotSupportedLoader() + _ => new NotSupportedLoader() } +#endif ); } } From ad0a06bf24732d0d7505951184bfc89e936d53b7 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 24 May 2022 23:35:32 -0400 Subject: [PATCH 039/393] Merge PlatformSupport project into Avalonia.Base --- Avalonia.sln | 53 ------------------- build/CoreLibraries.props | 1 - src/Avalonia.Base/Media/PathGeometry.cs | 1 - .../Media/PathGeometryCollections.cs | 2 +- .../Platform}/AssetLoader.cs | 5 +- .../Platform}/Internal/AssemblyDescriptor.cs | 2 +- .../Internal/AssemblyDescriptorResolver.cs | 2 +- .../Platform}/Internal/AssetDescriptor.cs | 2 +- .../Platform}/Internal/Constants.cs | 2 +- .../Platform/Internal}/DynLoader.cs | 2 +- .../Platform}/Internal/SlicedStream.cs | 2 +- .../Platform/PathGeometryContext.cs | 3 +- .../Platform}/StandardRuntimePlatform.cs | 3 +- .../StandardRuntimePlatformServices.cs | 4 +- src/Avalonia.Base/Properties/AssemblyInfo.cs | 1 - .../AppBuilder.cs | 2 +- src/Avalonia.Controls/AppBuilderBase.cs | 36 ++----------- .../Avalonia.Web.Blazor.csproj | 1 - .../AvaloniaBlazorAppBuilder.cs | 1 - .../AssetLoaderTests.cs | 5 +- .../Media/PathMarkupParserTests.cs | 1 - .../Styling/ResourceBenchmarks.cs | 1 - .../Themes/FluentBenchmark.cs | 1 - .../Themes/ThemeBenchmark.cs | 2 +- tests/Avalonia.RenderTests/TestBase.cs | 2 - .../Avalonia.UnitTests.csproj | 1 - tests/Avalonia.UnitTests/TestServices.cs | 1 - .../Avalonia.UnitTests/UnitTestApplication.cs | 1 - 28 files changed, 22 insertions(+), 118 deletions(-) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/AssetLoader.cs (98%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/Internal/AssemblyDescriptor.cs (97%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/Internal/AssemblyDescriptorResolver.cs (96%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/Internal/AssetDescriptor.cs (96%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/Internal/Constants.cs (69%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform/Internal}/DynLoader.cs (99%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/Internal/SlicedStream.cs (97%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/StandardRuntimePlatform.cs (98%) rename src/{Avalonia.PlatformSupport => Avalonia.Base/Platform}/StandardRuntimePlatformServices.cs (95%) rename src/{Avalonia.PlatformSupport => Avalonia.Controls}/AppBuilder.cs (94%) rename tests/{Avalonia.PlatformSupport.UnitTests => Avalonia.Base.UnitTests}/AssetLoaderTests.cs (95%) diff --git a/Avalonia.sln b/Avalonia.sln index c8e513f94c..1df0209b8d 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -209,12 +209,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInteropTest", "sampl EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlSamples", "samples\SampleControls\ControlSamples.csproj", "{A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.PlatformSupport", "src\Avalonia.PlatformSupport\Avalonia.PlatformSupport.csproj", "{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.PlatformSupport.UnitTests", "tests\Avalonia.PlatformSupport.UnitTests\Avalonia.PlatformSupport.UnitTests.csproj", "{CE910927-CE5A-456F-BC92-E4C757354A5C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.SourceGenerator", "src\Avalonia.SourceGenerator\Avalonia.SourceGenerator.csproj", "{CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevAnalyzers", "src\tools\DevAnalyzers\DevAnalyzers.csproj", "{2B390431-288C-435C-BB6B-A374033BD8D1}" @@ -1845,30 +1841,6 @@ Global {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhone.Build.0 = Release|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|iPhone.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|iPhone.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|Any CPU.Build.0 = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhone.ActiveCfg = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhone.Build.0 = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU @@ -1893,30 +1865,6 @@ Global {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhone.Build.0 = Release|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|iPhone.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|iPhone.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|Any CPU.Build.0 = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|iPhone.ActiveCfg = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|iPhone.Build.0 = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CE910927-CE5A-456F-BC92-E4C757354A5C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU @@ -2046,7 +1994,6 @@ Global {26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9} {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270} = {9B9E3891-2366-4253-A952-D08BCEB71098} {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B} = {9B9E3891-2366-4253-A952-D08BCEB71098} - {CE910927-CE5A-456F-BC92-E4C757354A5C} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {2B390431-288C-435C-BB6B-A374033BD8D1} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/build/CoreLibraries.props b/build/CoreLibraries.props index 9448a31d73..00a1e3094b 100644 --- a/build/CoreLibraries.props +++ b/build/CoreLibraries.props @@ -8,6 +8,5 @@ - diff --git a/src/Avalonia.Base/Media/PathGeometry.cs b/src/Avalonia.Base/Media/PathGeometry.cs index 2c8a51c541..8662c3351d 100644 --- a/src/Avalonia.Base/Media/PathGeometry.cs +++ b/src/Avalonia.Base/Media/PathGeometry.cs @@ -2,7 +2,6 @@ using System; using Avalonia.Collections; using Avalonia.Metadata; using Avalonia.Platform; -using Avalonia.Visuals.Platform; namespace Avalonia.Media { diff --git a/src/Avalonia.Base/Media/PathGeometryCollections.cs b/src/Avalonia.Base/Media/PathGeometryCollections.cs index 1165b192a7..c663b1ebe5 100644 --- a/src/Avalonia.Base/Media/PathGeometryCollections.cs +++ b/src/Avalonia.Base/Media/PathGeometryCollections.cs @@ -1,5 +1,5 @@ using Avalonia.Collections; -using Avalonia.Visuals.Platform; +using Avalonia.Platform; namespace Avalonia.Media { diff --git a/src/Avalonia.PlatformSupport/AssetLoader.cs b/src/Avalonia.Base/Platform/AssetLoader.cs similarity index 98% rename from src/Avalonia.PlatformSupport/AssetLoader.cs rename to src/Avalonia.Base/Platform/AssetLoader.cs index 0e33c3d4c7..a74da2a178 100644 --- a/src/Avalonia.PlatformSupport/AssetLoader.cs +++ b/src/Avalonia.Base/Platform/AssetLoader.cs @@ -3,11 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using Avalonia.Platform; -using Avalonia.PlatformSupport.Internal; +using Avalonia.Platform.Internal; using Avalonia.Utilities; -namespace Avalonia.PlatformSupport +namespace Avalonia.Platform { /// /// Loads assets compiled into the application binary. diff --git a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptor.cs b/src/Avalonia.Base/Platform/Internal/AssemblyDescriptor.cs similarity index 97% rename from src/Avalonia.PlatformSupport/Internal/AssemblyDescriptor.cs rename to src/Avalonia.Base/Platform/Internal/AssemblyDescriptor.cs index 64ffec8482..df2a26ddd3 100644 --- a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptor.cs +++ b/src/Avalonia.Base/Platform/Internal/AssemblyDescriptor.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Reflection; using Avalonia.Utilities; -namespace Avalonia.PlatformSupport.Internal; +namespace Avalonia.Platform.Internal; internal interface IAssemblyDescriptor { diff --git a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs b/src/Avalonia.Base/Platform/Internal/AssemblyDescriptorResolver.cs similarity index 96% rename from src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs rename to src/Avalonia.Base/Platform/Internal/AssemblyDescriptorResolver.cs index 6b85200c76..b12130b1f7 100644 --- a/src/Avalonia.PlatformSupport/Internal/AssemblyDescriptorResolver.cs +++ b/src/Avalonia.Base/Platform/Internal/AssemblyDescriptorResolver.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; -namespace Avalonia.PlatformSupport.Internal; +namespace Avalonia.Platform.Internal; internal interface IAssemblyDescriptorResolver { diff --git a/src/Avalonia.PlatformSupport/Internal/AssetDescriptor.cs b/src/Avalonia.Base/Platform/Internal/AssetDescriptor.cs similarity index 96% rename from src/Avalonia.PlatformSupport/Internal/AssetDescriptor.cs rename to src/Avalonia.Base/Platform/Internal/AssetDescriptor.cs index baae1f99e7..52f8f5e68d 100644 --- a/src/Avalonia.PlatformSupport/Internal/AssetDescriptor.cs +++ b/src/Avalonia.Base/Platform/Internal/AssetDescriptor.cs @@ -2,7 +2,7 @@ using System.IO; using System.Reflection; -namespace Avalonia.PlatformSupport.Internal; +namespace Avalonia.Platform.Internal; internal interface IAssetDescriptor { diff --git a/src/Avalonia.PlatformSupport/Internal/Constants.cs b/src/Avalonia.Base/Platform/Internal/Constants.cs similarity index 69% rename from src/Avalonia.PlatformSupport/Internal/Constants.cs rename to src/Avalonia.Base/Platform/Internal/Constants.cs index c8a0f7b1ce..cad864e7e3 100644 --- a/src/Avalonia.PlatformSupport/Internal/Constants.cs +++ b/src/Avalonia.Base/Platform/Internal/Constants.cs @@ -1,4 +1,4 @@ -namespace Avalonia.PlatformSupport.Internal; +namespace Avalonia.Platform.Internal; internal static class Constants { diff --git a/src/Avalonia.PlatformSupport/DynLoader.cs b/src/Avalonia.Base/Platform/Internal/DynLoader.cs similarity index 99% rename from src/Avalonia.PlatformSupport/DynLoader.cs rename to src/Avalonia.Base/Platform/Internal/DynLoader.cs index ef2166d943..07903669b1 100644 --- a/src/Avalonia.PlatformSupport/DynLoader.cs +++ b/src/Avalonia.Base/Platform/Internal/DynLoader.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; using Avalonia.Platform.Interop; // ReSharper disable InconsistentNaming -namespace Avalonia.PlatformSupport +namespace Avalonia.Platform.Internal { class UnixLoader : IDynamicLibraryLoader { diff --git a/src/Avalonia.PlatformSupport/Internal/SlicedStream.cs b/src/Avalonia.Base/Platform/Internal/SlicedStream.cs similarity index 97% rename from src/Avalonia.PlatformSupport/Internal/SlicedStream.cs rename to src/Avalonia.Base/Platform/Internal/SlicedStream.cs index e310db964a..124c248aa8 100644 --- a/src/Avalonia.PlatformSupport/Internal/SlicedStream.cs +++ b/src/Avalonia.Base/Platform/Internal/SlicedStream.cs @@ -1,7 +1,7 @@ using System; using System.IO; -namespace Avalonia.PlatformSupport.Internal; +namespace Avalonia.Platform.Internal; internal class SlicedStream : Stream { diff --git a/src/Avalonia.Base/Platform/PathGeometryContext.cs b/src/Avalonia.Base/Platform/PathGeometryContext.cs index 694e9f8d80..6c0bbe0f3f 100644 --- a/src/Avalonia.Base/Platform/PathGeometryContext.cs +++ b/src/Avalonia.Base/Platform/PathGeometryContext.cs @@ -1,9 +1,8 @@ using System; using System.Diagnostics.CodeAnalysis; using Avalonia.Media; -using Avalonia.Platform; -namespace Avalonia.Visuals.Platform +namespace Avalonia.Platform { public class PathGeometryContext : IGeometryContext { diff --git a/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs similarity index 98% rename from src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs rename to src/Avalonia.Base/Platform/StandardRuntimePlatform.cs index 048f09570f..fdbd48a9f8 100644 --- a/src/Avalonia.PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs @@ -1,9 +1,8 @@ using System; using System.Runtime.InteropServices; using System.Threading; -using Avalonia.Platform; -namespace Avalonia.PlatformSupport +namespace Avalonia.Platform { public class StandardRuntimePlatform : IRuntimePlatform { diff --git a/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs b/src/Avalonia.Base/Platform/StandardRuntimePlatformServices.cs similarity index 95% rename from src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs rename to src/Avalonia.Base/Platform/StandardRuntimePlatformServices.cs index 11ca906782..65d6733399 100644 --- a/src/Avalonia.PlatformSupport/StandardRuntimePlatformServices.cs +++ b/src/Avalonia.Base/Platform/StandardRuntimePlatformServices.cs @@ -1,8 +1,8 @@ using System.Reflection; -using Avalonia.Platform; +using Avalonia.Platform.Internal; using Avalonia.Platform.Interop; -namespace Avalonia.PlatformSupport +namespace Avalonia.Platform { public static class StandardRuntimePlatformServices { diff --git a/src/Avalonia.Base/Properties/AssemblyInfo.cs b/src/Avalonia.Base/Properties/AssemblyInfo.cs index 2c40c768f5..c8368e6d7a 100644 --- a/src/Avalonia.Base/Properties/AssemblyInfo.cs +++ b/src/Avalonia.Base/Properties/AssemblyInfo.cs @@ -26,7 +26,6 @@ using Avalonia.Metadata; [assembly: InternalsVisibleTo("Avalonia.Direct2D1.RenderTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] [assembly: InternalsVisibleTo("Avalonia.LeakTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] [assembly: InternalsVisibleTo("Avalonia.Markup.Xaml.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] -[assembly: InternalsVisibleTo("Avalonia.PlatformSupport, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] [assembly: InternalsVisibleTo("Avalonia.Skia.RenderTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] [assembly: InternalsVisibleTo("Avalonia.Skia.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] [assembly: InternalsVisibleTo("Avalonia.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")] diff --git a/src/Avalonia.PlatformSupport/AppBuilder.cs b/src/Avalonia.Controls/AppBuilder.cs similarity index 94% rename from src/Avalonia.PlatformSupport/AppBuilder.cs rename to src/Avalonia.Controls/AppBuilder.cs index 136f1f39b3..5bcd87162e 100644 --- a/src/Avalonia.PlatformSupport/AppBuilder.cs +++ b/src/Avalonia.Controls/AppBuilder.cs @@ -1,5 +1,5 @@ using Avalonia.Controls; -using Avalonia.PlatformSupport; +using Avalonia.Platform; namespace Avalonia { diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index 8779ae9122..6b7101cd49 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Reflection; using System.Linq; using Avalonia.Controls.ApplicationLifetimes; @@ -120,38 +119,8 @@ namespace Avalonia.Controls return Self; } - /// - /// Starts the application with an instance of . - /// - /// The window type. - /// A delegate that will be called to create a data context for the window (optional). - [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details")] - public void Start(Func? dataContextProvider = null) - where TMainWindow : Window, new() - { - AfterSetup(builder => - { - var window = new TMainWindow(); - if (dataContextProvider != null) - window.DataContext = dataContextProvider(); - ((IClassicDesktopStyleApplicationLifetime)builder.Instance!.ApplicationLifetime!) - .MainWindow = window; - }); - - // Copy-pasted because we can't call extension methods due to generic constraints - var lifetime = new ClassicDesktopStyleApplicationLifetime() {ShutdownMode = ShutdownMode.OnMainWindowClose}; - SetupWithLifetime(lifetime); - lifetime.Start(Array.Empty()); - } - public delegate void AppMainDelegate(Application app, string[] args); - - [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details", true)] - public void Start() - { - throw new NotSupportedException(); - } - + public void Start(AppMainDelegate main, string[] args) { Setup(); @@ -234,6 +203,9 @@ namespace Avalonia.Controls protected virtual bool CheckSetup => true; + /// + /// Searches and initiates modules included with attribute. + /// private void SetupAvaloniaModules() { var moduleInitializers = from assembly in AppDomain.CurrentDomain.GetAssemblies() diff --git a/src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj b/src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj index 98fdccfe83..1531c95830 100644 --- a/src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj +++ b/src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj @@ -51,7 +51,6 @@ - diff --git a/src/Web/Avalonia.Web.Blazor/AvaloniaBlazorAppBuilder.cs b/src/Web/Avalonia.Web.Blazor/AvaloniaBlazorAppBuilder.cs index 2eb340406b..11d9bcc98f 100644 --- a/src/Web/Avalonia.Web.Blazor/AvaloniaBlazorAppBuilder.cs +++ b/src/Web/Avalonia.Web.Blazor/AvaloniaBlazorAppBuilder.cs @@ -1,6 +1,5 @@ using Avalonia.Controls; using Avalonia.Platform; -using Avalonia.PlatformSupport; namespace Avalonia.Web.Blazor { diff --git a/tests/Avalonia.PlatformSupport.UnitTests/AssetLoaderTests.cs b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs similarity index 95% rename from tests/Avalonia.PlatformSupport.UnitTests/AssetLoaderTests.cs rename to tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs index dfd195073b..06b7a4ce94 100644 --- a/tests/Avalonia.PlatformSupport.UnitTests/AssetLoaderTests.cs +++ b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs @@ -1,10 +1,11 @@ using System; using System.Reflection; -using Avalonia.PlatformSupport.Internal; +using Avalonia.Platform; +using Avalonia.Platform.Internal; using Moq; using Xunit; -namespace Avalonia.PlatformSupport.UnitTests; +namespace Avalonia.Base.UnitTests; public class AssetLoaderTests { diff --git a/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs b/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs index c829690eb4..73e97bf13c 100644 --- a/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs @@ -2,7 +2,6 @@ using System.Globalization; using System.IO; using Avalonia.Media; using Avalonia.Platform; -using Avalonia.Visuals.Platform; using Moq; using Xunit; diff --git a/tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs b/tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs index 2a048beefa..b16e891924 100644 --- a/tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs +++ b/tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs @@ -1,7 +1,6 @@ using System; using Avalonia.Controls; using Avalonia.Platform; -using Avalonia.PlatformSupport; using Avalonia.Styling; using Avalonia.UnitTests; using BenchmarkDotNet.Attributes; diff --git a/tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs b/tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs index 6f04bb5206..ceb015ee63 100644 --- a/tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs +++ b/tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs @@ -1,7 +1,6 @@ using System; using Avalonia.Controls; using Avalonia.Platform; -using Avalonia.PlatformSupport; using Avalonia.Styling; using Avalonia.UnitTests; using BenchmarkDotNet.Attributes; diff --git a/tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs b/tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs index 81264f109c..9a5b49790d 100644 --- a/tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs +++ b/tests/Avalonia.Benchmarks/Themes/ThemeBenchmark.cs @@ -2,7 +2,7 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml.Styling; -using Avalonia.PlatformSupport; +using Avalonia.Platform; using Avalonia.Styling; using Avalonia.UnitTests; diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index 523876500f..39250f2aa7 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -25,8 +25,6 @@ namespace Avalonia.Skia.RenderTests namespace Avalonia.Direct2D1.RenderTests #endif { - using Avalonia.PlatformSupport; - public class TestBase { #if AVALONIA_SKIA diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index f54ccaa857..52ef23c966 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -14,7 +14,6 @@ - diff --git a/tests/Avalonia.UnitTests/TestServices.cs b/tests/Avalonia.UnitTests/TestServices.cs index 1d55b77aab..c1be745aca 100644 --- a/tests/Avalonia.UnitTests/TestServices.cs +++ b/tests/Avalonia.UnitTests/TestServices.cs @@ -5,7 +5,6 @@ using Avalonia.Layout; using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Platform; -using Avalonia.PlatformSupport; using Avalonia.Styling; using Avalonia.Themes.Default; using Avalonia.Rendering; diff --git a/tests/Avalonia.UnitTests/UnitTestApplication.cs b/tests/Avalonia.UnitTests/UnitTestApplication.cs index bb6e53d74f..63c2832b92 100644 --- a/tests/Avalonia.UnitTests/UnitTestApplication.cs +++ b/tests/Avalonia.UnitTests/UnitTestApplication.cs @@ -10,7 +10,6 @@ using System.Reactive.Disposables; using System.Reactive.Concurrency; using Avalonia.Input.Platform; using Avalonia.Animation; -using Avalonia.PlatformSupport; namespace Avalonia.UnitTests { From 2538d2cde662d601bd3d2af436443c25ae752043 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 24 May 2022 23:36:05 -0400 Subject: [PATCH 040/393] Copy runtime detection from dotnet/runtime repository --- .../Platform/StandardRuntimePlatform.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs index fdbd48a9f8..3acb5f6330 100644 --- a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs +++ b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs @@ -85,15 +85,18 @@ namespace Avalonia.Platform else throw new Exception("Unknown OS platform " + RuntimeInformation.OSDescription); + // Source: https://github.com/dotnet/runtime/blob/main/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs + var isCoreClr = Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); + var isMonoRuntime = Type.GetType("Mono.RuntimeStructs") != null; + var isFramework = !isCoreClr && RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); + return new RuntimePlatformInfo { -#if NETCOREAPP - IsCoreClr = true, -#elif NETFRAMEWORK - IsDotNetFramework = true, -#endif + IsCoreClr = isCoreClr, + IsDotNetFramework = isFramework, + IsMono = isMonoRuntime, + IsDesktop = os is OperatingSystemType.Linux or OperatingSystemType.OSX or OperatingSystemType.WinNT, - IsMono = os is OperatingSystemType.Android or OperatingSystemType.iOS or OperatingSystemType.Browser, IsMobile = os is OperatingSystemType.Android or OperatingSystemType.iOS, IsUnix = os is OperatingSystemType.Linux or OperatingSystemType.OSX or OperatingSystemType.Android, IsBrowser = os == OperatingSystemType.Browser, From 7fee2359dce9e8cb12f97400ec6e7f4319fb8ccf Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 24 May 2022 23:42:36 -0400 Subject: [PATCH 041/393] Remove Ad-Hoc/AppStore/iPhone/iPhoneSimulator configurations --- Avalonia.sln | 1431 -------------------------------------------------- 1 file changed, 1431 deletions(-) diff --git a/Avalonia.sln b/Avalonia.sln index 1df0209b8d..04aad99211 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -217,1726 +217,296 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevAnalyzers", "src\tools\D EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Ad-Hoc|Any CPU = Ad-Hoc|Any CPU - Ad-Hoc|iPhone = Ad-Hoc|iPhone - Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator - AppStore|Any CPU = AppStore|Any CPU - AppStore|iPhone = AppStore|iPhone - AppStore|iPhoneSimulator = AppStore|iPhoneSimulator Debug|Any CPU = Debug|Any CPU - Debug|iPhone = Debug|iPhone - Debug|iPhoneSimulator = Debug|iPhoneSimulator Release|Any CPU = Release|Any CPU - Release|iPhone = Release|iPhone - Release|iPhoneSimulator = Release|iPhoneSimulator EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|Any CPU.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|iPhone.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|iPhone.Build.0 = Debug|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|Any CPU.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|iPhone.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|iPhone.Build.0 = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B09B78D8-9B26-48B0-9149-D64A2F120F3F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|Any CPU.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|iPhone.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|Any CPU.Build.0 = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|iPhone.Build.0 = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.ActiveCfg = Release|Any CPU {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|Any CPU.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|iPhone.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|iPhone.Build.0 = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {811A76CF-1CF6-440F-963B-BBE31BD72A82}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|Any CPU.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|iPhone.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhone.Build.0 = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhone.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhone.Build.0 = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|Any CPU.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|iPhone.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|iPhone.Build.0 = Debug|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|Any CPU.ActiveCfg = Release|Any CPU {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|Any CPU.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|iPhone.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|iPhone.Build.0 = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D2221C82-4A25-4583-9B43-D791E3F6820C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|Any CPU.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|iPhone.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|iPhone.Build.0 = Debug|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|iPhone.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|iPhone.Build.0 = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|Any CPU.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|iPhone.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|iPhone.Build.0 = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.ActiveCfg = Release|Any CPU {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|iPhone.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|iPhone.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|Any CPU.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|iPhone.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|iPhone.Build.0 = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|iPhone.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|iPhone.Build.0 = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|Any CPU.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|iPhone.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|iPhone.Build.0 = Debug|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|Any CPU.ActiveCfg = Release|Any CPU {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|Any CPU.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|iPhone.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|iPhone.Build.0 = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2905FF23-53FB-45E6-AA49-6AF47A172056}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|Any CPU.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|iPhone.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|iPhone.Build.0 = Debug|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|Any CPU.ActiveCfg = Release|Any CPU {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|Any CPU.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|iPhone.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|iPhone.Build.0 = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|Any CPU.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|iPhone.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|iPhone.Build.0 = Debug|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|Any CPU.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|iPhone.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|iPhone.Build.0 = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|Any CPU.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|iPhone.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|iPhone.Build.0 = Debug|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|Any CPU.ActiveCfg = Release|Any CPU {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|Any CPU.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|iPhone.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|iPhone.Build.0 = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {99135EAB-653D-47E4-A378-C96E1278CA44}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|Any CPU.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|iPhone.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|iPhone.Build.0 = Debug|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|Any CPU.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|iPhone.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|iPhone.Build.0 = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|Any CPU.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|iPhone.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|iPhone.Build.0 = Debug|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|Any CPU.ActiveCfg = Release|Any CPU {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|Any CPU.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|iPhone.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|iPhone.Build.0 = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|Any CPU.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|iPhone.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|iPhone.Build.0 = Debug|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {6417E941-21BC-467B-A771-0DE389353CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU {6417E941-21BC-467B-A771-0DE389353CE6}.Release|Any CPU.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Release|iPhone.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Release|iPhone.Build.0 = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6417E941-21BC-467B-A771-0DE389353CE6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|Any CPU.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|iPhone.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|iPhone.Build.0 = Debug|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|Any CPU.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|iPhone.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|iPhone.Build.0 = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8EF392D5-1416-45AA-9956-7CBBC3229E8A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|Any CPU.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|iPhone.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|iPhone.Build.0 = Debug|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|Any CPU.ActiveCfg = Release|Any CPU {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|Any CPU.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|iPhone.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|iPhone.Build.0 = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Release|Any CPU.Build.0 = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Release|iPhone.ActiveCfg = Release|Any CPU - {7B92AF71-6287-4693-9DCB-BD5B6E927E23}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|Any CPU.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|iPhone.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|iPhone.Build.0 = Debug|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|Any CPU.ActiveCfg = Release|Any CPU {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|Any CPU.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|iPhone.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|iPhone.Build.0 = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4488AD85-1495-4809-9AA4-DDFE0A48527E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|Any CPU.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|iPhone.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|iPhone.Build.0 = Debug|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|Any CPU.ActiveCfg = Release|Any CPU {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|Any CPU.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|iPhone.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|iPhone.Build.0 = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1AA3DBF-9056-4530-9376-18119A7A3FFE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|Any CPU.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|iPhone.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|iPhone.Build.0 = Debug|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|Any CPU.ActiveCfg = Release|Any CPU {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|Any CPU.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|iPhone.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|iPhone.Build.0 = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {88060192-33D5-4932-B0F9-8BD2763E857D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|Any CPU.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|iPhone.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|iPhone.Build.0 = Debug|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|Any CPU.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhone.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhone.Build.0 = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {410AC439-81A1-4EB5-B5E9-6A7FC6B77F4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|Any CPU.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|iPhone.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|iPhone.Build.0 = Debug|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|Any CPU.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|iPhone.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|iPhone.Build.0 = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {799A7BB5-3C2C-48B6-85A7-406A12C420DA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|Any CPU.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|iPhone.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|iPhone.Build.0 = Debug|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|Any CPU.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|iPhone.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|iPhone.Build.0 = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D0A739B9-3C68-4BA6-A328-41606954B6BD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|Any CPU.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|iPhone.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|iPhone.Build.0 = Debug|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|Any CPU.ActiveCfg = Release|Any CPU {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|Any CPU.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhone.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhone.Build.0 = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2B888490-D14A-4BCA-AB4B-48676FA93C9B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|Any CPU.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhone.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhone.Build.0 = Debug|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Release|Any CPU.ActiveCfg = Release|Any CPU {52F55355-D120-42AC-8116-8410A7D602FA}.Release|Any CPU.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhone.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhone.Build.0 = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|Any CPU.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhone.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhone.Build.0 = Debug|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|Any CPU.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhone.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhone.Build.0 = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|Any CPU.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|iPhone.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|iPhone.Build.0 = Debug|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|Any CPU.ActiveCfg = Release|Any CPU {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|Any CPU.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|iPhone.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|iPhone.Build.0 = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FBCAF3D0-2808-4934-8E96-3F607594517B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|Any CPU.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|iPhone.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|iPhone.Build.0 = Debug|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|Any CPU.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|iPhone.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|iPhone.Build.0 = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F1FDC5B0-4654-416F-AE69-E3E9BBD87801}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|Any CPU.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhone.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhone.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|Any CPU.Build.0 = Debug|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhone.Build.0 = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhone.Deploy.0 = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|Any CPU.ActiveCfg = Release|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|Any CPU.Build.0 = Release|Any CPU {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|Any CPU.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhone.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhone.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhone.Deploy.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Any CPU.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhone.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhone.Build.0 = Debug|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Any CPU.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhone.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhone.Build.0 = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhone.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhone.Build.0 = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|Any CPU.Build.0 = Release|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhone.ActiveCfg = Release|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhone.Build.0 = Release|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|iPhone.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|iPhone.Build.0 = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|Any CPU.ActiveCfg = Release|Any CPU {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|Any CPU.Build.0 = Release|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|iPhone.ActiveCfg = Release|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|iPhone.Build.0 = Release|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {854568D5-13D1-4B4F-B50D-534DC7EFD3C9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|iPhone.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|iPhone.Build.0 = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|Any CPU.Build.0 = Release|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|iPhone.ActiveCfg = Release|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|iPhone.Build.0 = Release|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {638580B0-7910-40EF-B674-DCB34DA308CD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|Any CPU.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|iPhone.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|iPhone.Build.0 = Debug|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|Any CPU.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|iPhone.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|iPhone.Build.0 = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|iPhone.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {E1582370-37B3-403C-917F-8209551B1634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1582370-37B3-403C-917F-8209551B1634}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Debug|iPhone.Build.0 = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {E1582370-37B3-403C-917F-8209551B1634}.Release|Any CPU.ActiveCfg = Release|Any CPU {E1582370-37B3-403C-917F-8209551B1634}.Release|Any CPU.Build.0 = Release|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Release|iPhone.ActiveCfg = Release|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Release|iPhone.Build.0 = Release|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1582370-37B3-403C-917F-8209551B1634}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|iPhone.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|iPhone.Build.0 = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|Any CPU.ActiveCfg = Release|Any CPU {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|Any CPU.Build.0 = Release|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|iPhone.ActiveCfg = Release|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|iPhone.Build.0 = Release|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D78A720C-C0C6-478B-8564-F167F9BDD01B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|iPhone.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|iPhone.Build.0 = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|Any CPU.Build.0 = Release|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|iPhone.ActiveCfg = Release|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|iPhone.Build.0 = Release|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E2999E4A-9086-401F-898C-AEB0AD38E676}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|Any CPU.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|iPhone.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhone.Build.0 = Debug|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {050CC912-FF49-4A8B-B534-9544017446DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {050CC912-FF49-4A8B-B534-9544017446DD}.Release|Any CPU.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhone.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhone.Build.0 = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|Any CPU.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|iPhone.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|iPhone.Build.0 = Debug|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|Any CPU.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhone.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhone.Build.0 = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|iPhone.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|iPhone.Build.0 = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|Any CPU.ActiveCfg = Release|Any CPU {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|Any CPU.Build.0 = Release|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|iPhone.ActiveCfg = Release|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|iPhone.Build.0 = Release|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1240B49-7B4B-4371-A00E-068778C5CF0B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|iPhone.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|iPhone.Build.0 = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|Any CPU.ActiveCfg = Release|Any CPU {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|Any CPU.Build.0 = Release|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|iPhone.ActiveCfg = Release|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|iPhone.Build.0 = Release|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7CCAEFC4-135D-401D-BDDD-896B9B7D3569}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|iPhone.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|Any CPU.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|iPhone.Build.0 = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|Any CPU.ActiveCfg = Release|Any CPU {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|Any CPU.Build.0 = Release|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhone.ActiveCfg = Release|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhone.Build.0 = Release|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {12A91A62-C064-42CA-9A8C-A1272F354388}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhone.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhone.Build.0 = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|Any CPU.Build.0 = Release|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhone.ActiveCfg = Release|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhone.Build.0 = Release|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D49233F8-F29C-47DD-9975-C4C9E4502720}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhone.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhone.Build.0 = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|Any CPU.Build.0 = Release|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhone.ActiveCfg = Release|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhone.Build.0 = Release|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3C471044-3640-45E3-B1B2-16D2FF8399EE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|iPhone.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|iPhone.Build.0 = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|Any CPU.Build.0 = Release|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|iPhone.ActiveCfg = Release|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|iPhone.Build.0 = Release|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BF28998D-072C-439A-AFBB-2FE5021241E0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|Any CPU.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|iPhone.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|iPhone.Build.0 = Debug|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|Any CPU.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|iPhone.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|iPhone.Build.0 = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3F00BC43-5095-477F-93D8-E65B08179A00}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|iPhone.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {41B02319-965D-4945-8005-C1A3D1224165}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {41B02319-965D-4945-8005-C1A3D1224165}.Debug|Any CPU.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Debug|iPhone.Build.0 = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {41B02319-965D-4945-8005-C1A3D1224165}.Release|Any CPU.ActiveCfg = Release|Any CPU {41B02319-965D-4945-8005-C1A3D1224165}.Release|Any CPU.Build.0 = Release|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Release|iPhone.ActiveCfg = Release|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Release|iPhone.Build.0 = Release|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {41B02319-965D-4945-8005-C1A3D1224165}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|iPhone.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|iPhone.Build.0 = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|Any CPU.ActiveCfg = Release|Any CPU {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|Any CPU.Build.0 = Release|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|iPhone.ActiveCfg = Release|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|iPhone.Build.0 = Release|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D775DECB-4E00-4ED5-A75A-5FCE58ADFF0B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|iPhone.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|iPhone.Build.0 = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|Any CPU.Build.0 = Release|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|iPhone.ActiveCfg = Release|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|iPhone.Build.0 = Release|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {AF915D5C-AB00-4EA0-B5E6-001F4AE84E68}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|iPhone.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|iPhone.Build.0 = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|Any CPU.ActiveCfg = Release|Any CPU {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|Any CPU.Build.0 = Release|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|iPhone.ActiveCfg = Release|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|iPhone.Build.0 = Release|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3278F3A9-9509-4A3F-A15B-BDC8B5BFF632}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|iPhone.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|iPhone.Build.0 = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|Any CPU.Build.0 = Release|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|iPhone.ActiveCfg = Release|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|iPhone.Build.0 = Release|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4D55985A-1EE2-4F25-AD39-6EA8BC04F8FB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|iPhone.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|iPhone.Build.0 = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|Any CPU.Build.0 = Release|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|iPhone.ActiveCfg = Release|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|iPhone.Build.0 = Release|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {4D36CEC8-53F2-40A5-9A37-79AAE356E2DA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|iPhone.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|iPhone.Build.0 = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|Any CPU.ActiveCfg = Release|Any CPU {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|Any CPU.Build.0 = Release|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhone.ActiveCfg = Release|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhone.Build.0 = Release|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {351337F5-D66F-461B-A957-4EF60BDB4BA6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|iPhone.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|iPhone.Build.0 = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|Any CPU.Build.0 = Release|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|iPhone.ActiveCfg = Release|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|iPhone.Build.0 = Release|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3C84E04B-36CF-4D0D-B965-C26DD649D1F3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhone.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhone.Build.0 = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|Any CPU.Build.0 = Release|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhone.ActiveCfg = Release|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhone.Build.0 = Release|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C42D2FC1-A531-4ED4-84B9-89AEC7C962FC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|iPhone.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|iPhone.Build.0 = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|Any CPU.Build.0 = Release|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|iPhone.ActiveCfg = Release|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|iPhone.Build.0 = Release|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8C89950F-F5D9-47FC-8066-CBC1EC3DF8FC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|iPhone.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|iPhone.Build.0 = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|Any CPU.Build.0 = Release|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|iPhone.ActiveCfg = Release|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|iPhone.Build.0 = Release|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {B859AE7C-F34F-4A9E-88AE-E0E7229FDE1E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|iPhone.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|Any CPU.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|iPhone.Build.0 = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|Any CPU.ActiveCfg = Release|Any CPU {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|Any CPU.Build.0 = Release|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|iPhone.ActiveCfg = Release|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|iPhone.Build.0 = Release|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {909A8CBD-7D0E-42FD-B841-022AD8925820}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|Any CPU.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|iPhone.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|Any CPU.Build.0 = Debug|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|iPhone.Build.0 = Debug|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|Any CPU.ActiveCfg = Release|Any CPU {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|Any CPU.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|iPhone.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|iPhone.Build.0 = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {11BE52AF-E2DD-4CF0-B19A-05285ACAF571}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|iPhone.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|iPhone.Build.0 = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|Any CPU.Build.0 = Release|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhone.ActiveCfg = Release|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhone.Build.0 = Release|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.Build.0 = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.Build.0 = Release|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.ActiveCfg = Release|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.Build.0 = Release|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhone.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|Any CPU.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhone.Build.0 = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|Any CPU.ActiveCfg = Release|Any CPU {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|Any CPU.Build.0 = Release|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhone.ActiveCfg = Release|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhone.Build.0 = Release|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {676D6BFD-029D-4E43-BFC7-3892265CE251}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhone.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhone.Build.0 = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.Build.0 = Release|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhone.ActiveCfg = Release|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhone.Build.0 = Release|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|iPhone.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|iPhone.Build.0 = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {25831348-EB2A-483E-9576-E8F6528674A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {25831348-EB2A-483E-9576-E8F6528674A5}.Release|Any CPU.Build.0 = Release|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Release|iPhone.ActiveCfg = Release|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Release|iPhone.Build.0 = Release|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {25831348-EB2A-483E-9576-E8F6528674A5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|iPhone.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|iPhone.Build.0 = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|Any CPU.ActiveCfg = Release|Any CPU {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|Any CPU.Build.0 = Release|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|iPhone.ActiveCfg = Release|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|iPhone.Build.0 = Release|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C08E9894-AA92-426E-BF56-033E262CAD3E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|iPhone.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|iPhone.Build.0 = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|Any CPU.Build.0 = Release|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhone.ActiveCfg = Release|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhone.Build.0 = Release|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhone.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhone.Build.0 = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|Any CPU.ActiveCfg = Release|Any CPU {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|Any CPU.Build.0 = Release|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhone.ActiveCfg = Release|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhone.Build.0 = Release|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhone.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhone.Build.0 = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|Any CPU.ActiveCfg = Release|Any CPU {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|Any CPU.Build.0 = Release|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhone.ActiveCfg = Release|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhone.Build.0 = Release|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {70B9F5CC-E2F9-4314-9514-EDE762ACCC4B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|iPhone.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|iPhone.Build.0 = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|Any CPU.Build.0 = Release|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|iPhone.ActiveCfg = Release|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|iPhone.Build.0 = Release|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CA932DF3-2616-4BF6-8F28-1AD0EC40F1FF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|iPhone.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|iPhone.Build.0 = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|Any CPU.ActiveCfg = Release|Any CPU {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|Any CPU.Build.0 = Release|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|iPhone.ActiveCfg = Release|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|iPhone.Build.0 = Release|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {2B390431-288C-435C-BB6B-A374033BD8D1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|iPhone.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|iPhone.Build.0 = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|Any CPU.ActiveCfg = Release|Any CPU {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|Any CPU.Build.0 = Release|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|iPhone.ActiveCfg = Release|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|iPhone.Build.0 = Release|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {1ECC012A-8837-4AE2-9BDA-3E2857898727}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1968,7 +538,6 @@ Global {29132311-1848-4FD6-AE0C-4FF841151BD3} = {9B9E3891-2366-4253-A952-D08BCEB71098} {7D2D3083-71DD-4CC9-8907-39A0D86FB322} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E} {39D7B147-1A5B-47C2-9D01-21FB7C47C4B3} = {9B9E3891-2366-4253-A952-D08BCEB71098} - {86C53C40-57AA-45B8-AD42-FAE0EFDF0F2B} = {A689DEF5-D50F-4975-8B72-124C9EB54066} {854568D5-13D1-4B4F-B50D-534DC7EFD3C9} = {86C53C40-57AA-45B8-AD42-FAE0EFDF0F2B} {638580B0-7910-40EF-B674-DCB34DA308CD} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9} {CBC4FF2F-92D4-420B-BE21-9FE0B930B04E} = {B39A8919-9F95-48FE-AD7B-76E08B509888} From 17a2a4e2e03d754923b428960fa63879f397cd78 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 00:01:59 -0400 Subject: [PATCH 042/393] Extract UnmanagedBlob to a separated file --- .../Platform/Internal/UnmanagedBlob.cs | 57 +++++++++++++++++++ .../Platform/StandardRuntimePlatform.cs | 54 +----------------- 2 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs diff --git a/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs new file mode 100644 index 0000000000..eacf79d4f4 --- /dev/null +++ b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs @@ -0,0 +1,57 @@ +using System; +using System.Runtime.InteropServices; + +namespace Avalonia.Platform.Internal; + +internal class UnmanagedBlob : IUnmanagedBlob +{ + private IntPtr _address; + private readonly object _lock = new object(); + + public UnmanagedBlob(int size) + { + try + { + if (size <= 0) + throw new ArgumentException("Positive number required", nameof(size)); + _address = Marshal.AllocHGlobal(size); + GC.AddMemoryPressure(size); + Size = size; + } + catch + { + GC.SuppressFinalize(this); + throw; + } + } + + private void DoDispose() + { + lock (_lock) + { + if (!IsDisposed) + { + Marshal.FreeHGlobal(_address); + GC.RemoveMemoryPressure(Size); + IsDisposed = true; + _address = IntPtr.Zero; + Size = 0; + } + } + } + + public void Dispose() + { + DoDispose(); + GC.SuppressFinalize(this); + } + + ~UnmanagedBlob() + { + DoDispose(); + } + + public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address; + public int Size { get; private set; } + public bool IsDisposed { get; private set; } +} diff --git a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs index 3acb5f6330..ebda6f453b 100644 --- a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs +++ b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using System.Threading; +using Avalonia.Platform.Internal; namespace Avalonia.Platform { @@ -12,59 +13,6 @@ namespace Avalonia.Platform } public IUnmanagedBlob AllocBlob(int size) => new UnmanagedBlob(size); - - private class UnmanagedBlob : IUnmanagedBlob - { - private IntPtr _address; - private readonly object _lock = new object(); - - public UnmanagedBlob(int size) - { - try - { - if (size <= 0) - throw new ArgumentException("Positive number required", nameof(size)); - _address = Marshal.AllocHGlobal(size); - GC.AddMemoryPressure(size); - Size = size; - } - catch - { - GC.SuppressFinalize(this); - throw; - } - } - - private void DoDispose() - { - lock (_lock) - { - if (!IsDisposed) - { - Marshal.FreeHGlobal(_address); - GC.RemoveMemoryPressure(Size); - IsDisposed = true; - _address = IntPtr.Zero; - Size = 0; - } - } - } - - public void Dispose() - { - DoDispose(); - GC.SuppressFinalize(this); - } - - ~UnmanagedBlob() - { - DoDispose(); - } - - public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address; - public int Size { get; private set; } - public bool IsDisposed { get; private set; } - } private static readonly Lazy Info = new(() => { From a907b942c5fde9edbb6bdd48bde09480e64f262e Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 03:00:03 -0400 Subject: [PATCH 043/393] Remove platform support projects --- .../Avalonia.PlatformSupport.csproj | 24 ------------------- .../Avalonia.PlatformSupport.UnitTests.csproj | 24 ------------------- 2 files changed, 48 deletions(-) delete mode 100644 src/Avalonia.PlatformSupport/Avalonia.PlatformSupport.csproj delete mode 100644 tests/Avalonia.PlatformSupport.UnitTests/Avalonia.PlatformSupport.UnitTests.csproj diff --git a/src/Avalonia.PlatformSupport/Avalonia.PlatformSupport.csproj b/src/Avalonia.PlatformSupport/Avalonia.PlatformSupport.csproj deleted file mode 100644 index 5336f1e630..0000000000 --- a/src/Avalonia.PlatformSupport/Avalonia.PlatformSupport.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net6.0;net461;netstandard2.0 - - - - - - - - - - - - - - - - - - - - diff --git a/tests/Avalonia.PlatformSupport.UnitTests/Avalonia.PlatformSupport.UnitTests.csproj b/tests/Avalonia.PlatformSupport.UnitTests/Avalonia.PlatformSupport.UnitTests.csproj deleted file mode 100644 index d714941e5a..0000000000 --- a/tests/Avalonia.PlatformSupport.UnitTests/Avalonia.PlatformSupport.UnitTests.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net6.0 - enable - Library - true - latest - - - - - - - - - - - - - - - - From 7f90e74f254031499774ce13572d49cc38c3ac9d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 03:09:10 -0400 Subject: [PATCH 044/393] Unwanted namespace changes --- src/Avalonia.Base/Media/PathGeometry.cs | 1 + src/Avalonia.Base/Media/PathGeometryCollections.cs | 2 +- src/Avalonia.Base/Platform/PathGeometryContext.cs | 3 ++- tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Media/PathGeometry.cs b/src/Avalonia.Base/Media/PathGeometry.cs index 8662c3351d..2c8a51c541 100644 --- a/src/Avalonia.Base/Media/PathGeometry.cs +++ b/src/Avalonia.Base/Media/PathGeometry.cs @@ -2,6 +2,7 @@ using System; using Avalonia.Collections; using Avalonia.Metadata; using Avalonia.Platform; +using Avalonia.Visuals.Platform; namespace Avalonia.Media { diff --git a/src/Avalonia.Base/Media/PathGeometryCollections.cs b/src/Avalonia.Base/Media/PathGeometryCollections.cs index c663b1ebe5..1165b192a7 100644 --- a/src/Avalonia.Base/Media/PathGeometryCollections.cs +++ b/src/Avalonia.Base/Media/PathGeometryCollections.cs @@ -1,5 +1,5 @@ using Avalonia.Collections; -using Avalonia.Platform; +using Avalonia.Visuals.Platform; namespace Avalonia.Media { diff --git a/src/Avalonia.Base/Platform/PathGeometryContext.cs b/src/Avalonia.Base/Platform/PathGeometryContext.cs index 6c0bbe0f3f..694e9f8d80 100644 --- a/src/Avalonia.Base/Platform/PathGeometryContext.cs +++ b/src/Avalonia.Base/Platform/PathGeometryContext.cs @@ -1,8 +1,9 @@ using System; using System.Diagnostics.CodeAnalysis; using Avalonia.Media; +using Avalonia.Platform; -namespace Avalonia.Platform +namespace Avalonia.Visuals.Platform { public class PathGeometryContext : IGeometryContext { diff --git a/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs b/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs index 73e97bf13c..c829690eb4 100644 --- a/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/PathMarkupParserTests.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.IO; using Avalonia.Media; using Avalonia.Platform; +using Avalonia.Visuals.Platform; using Moq; using Xunit; From 0754e29a3c4c1f4b005bacf1ea03812ff2cb15d0 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 03:34:34 -0400 Subject: [PATCH 045/393] Address the review --- src/Avalonia.Base/Platform/StandardRuntimePlatform.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs index ebda6f453b..4df9e8e917 100644 --- a/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs +++ b/src/Avalonia.Base/Platform/StandardRuntimePlatform.cs @@ -20,7 +20,7 @@ namespace Avalonia.Platform if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) os = OperatingSystemType.OSX; - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) os = OperatingSystemType.Linux; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) os = OperatingSystemType.WinNT; @@ -35,7 +35,7 @@ namespace Avalonia.Platform // Source: https://github.com/dotnet/runtime/blob/main/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs var isCoreClr = Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); - var isMonoRuntime = Type.GetType("Mono.RuntimeStructs") != null; + var isMonoRuntime = Type.GetType("Mono.Runtime") != null; var isFramework = !isCoreClr && RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); return new RuntimePlatformInfo From 12fd9491265a3e9f8721050498982ee4ef8e3fcd Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 04:21:17 -0400 Subject: [PATCH 046/393] Disable AssemblyName_With_Non_ASCII_Should_Load_Avares test --- tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs index 06b7a4ce94..c590a763b2 100644 --- a/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs +++ b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs @@ -39,7 +39,7 @@ public class AssetLoaderTests Assert.Equal(AssemblyNameWithWhitespace, assemblyActual?.FullName); } - [Fact] + [Fact(Skip = "RegisterResUriParsers breaks this test. Investigate.")] public void AssemblyName_With_Non_ASCII_Should_Load_Avares() { var uri = new Uri($"avares://{AssemblyNameWithNonAscii}/Assets/something"); From 39d9a014b7b337750d1c84d39d3ced96741920f7 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 04:42:19 -0400 Subject: [PATCH 047/393] Fix static SetAssemblyDescriptorResolver usage in tests --- tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs index c590a763b2..28fb19e119 100644 --- a/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs +++ b/tests/Avalonia.Base.UnitTests/AssetLoaderTests.cs @@ -7,7 +7,7 @@ using Xunit; namespace Avalonia.Base.UnitTests; -public class AssetLoaderTests +public class AssetLoaderTests : IDisposable { public class MockAssembly : Assembly {} @@ -15,7 +15,7 @@ public class AssetLoaderTests private const string AssemblyNameWithNonAscii = "Какое-то-название"; - static AssetLoaderTests() + public AssetLoaderTests() { var resolver = Mock.Of(); @@ -39,7 +39,7 @@ public class AssetLoaderTests Assert.Equal(AssemblyNameWithWhitespace, assemblyActual?.FullName); } - [Fact(Skip = "RegisterResUriParsers breaks this test. Investigate.")] + [Fact(Skip = "RegisterResUriParsers breaks this test. See https://github.com/AvaloniaUI/Avalonia/issues/2555.")] public void AssemblyName_With_Non_ASCII_Should_Load_Avares() { var uri = new Uri($"avares://{AssemblyNameWithNonAscii}/Assets/something"); @@ -60,4 +60,9 @@ public class AssetLoaderTests Mock.Get(descriptor).Setup(x => x.Assembly).Returns(assembly); return descriptor; } + + public void Dispose() + { + AssetLoader.SetAssemblyDescriptorResolver(new AssemblyDescriptorResolver()); + } } From 2fb68a43a663b6aa4f37bbb9570932e76f104eac Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 04:53:38 -0400 Subject: [PATCH 048/393] Do not run Avalonia.PlatformSupport.UnitTests tests --- nukebuild/Build.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index f0f677b844..9fcb9d6b7f 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -221,7 +221,6 @@ partial class Build : NukeBuild RunCoreTest("Avalonia.Markup.Xaml.UnitTests"); RunCoreTest("Avalonia.Skia.UnitTests"); RunCoreTest("Avalonia.ReactiveUI.UnitTests"); - RunCoreTest("Avalonia.PlatformSupport.UnitTests"); }); Target RunRenderTests => _ => _ From bcbd86eca3bda0b3e6aeee03fb063a2ba6811c28 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 25 May 2022 21:15:45 +0300 Subject: [PATCH 049/393] Added VisualBrush support --- .../Composition/CompositionDrawListVisual.cs | 2 +- .../Drawing/CompositionDrawList.cs | 16 +++++++++- .../Drawing/CompositionDrawingContext.cs | 27 ++++++++++------- .../Composition/Server/DrawingContextProxy.cs | 30 ++++++++++++++++++- .../Server/ServerCompositionDrawListVisual.cs | 5 +--- .../Server/ServerCompositionTarget.cs | 5 ++-- .../Rendering/DeferredRenderer.cs | 6 ++-- .../SceneGraph/BrushDrawOperation.cs | 16 +++++++--- .../SceneGraph/DeferredDrawingContextImpl.cs | 4 +-- .../Rendering/SceneGraph/EllipseNode.cs | 7 ++--- .../Rendering/SceneGraph/GeometryNode.cs | 11 +++---- .../Rendering/SceneGraph/GlyphRunNode.cs | 11 +++---- .../Rendering/SceneGraph/LineNode.cs | 8 ++--- .../Rendering/SceneGraph/OpacityMaskNode.cs | 12 ++++---- .../Rendering/SceneGraph/RectangleNode.cs | 11 +++---- 15 files changed, 104 insertions(+), 67 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs index b19c311663..e4ed0abd29 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -24,7 +24,7 @@ internal class CompositionDrawListVisual : CompositionContainerVisual private protected override IChangeSetPool ChangeSetPool => DrawListVisualChanges.Pool; - internal CompositionDrawListVisual(Compositor compositor, ServerCompositionContainerVisual server, Visual visual) : base(compositor, server) + internal CompositionDrawListVisual(Compositor compositor, ServerCompositionDrawListVisual server, Visual visual) : base(compositor, server) { Visual = visual; } diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs index aca8ef7c46..1d416f5a8a 100644 --- a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs +++ b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawList.cs @@ -1,5 +1,6 @@ using System; using Avalonia.Collections.Pooled; +using Avalonia.Rendering.Composition.Server; using Avalonia.Rendering.SceneGraph; using Avalonia.Utilities; @@ -7,6 +8,8 @@ namespace Avalonia.Rendering.Composition.Drawing; internal class CompositionDrawList : PooledList> { + public Size? Size { get; set; } + public CompositionDrawList() { @@ -26,11 +29,22 @@ internal class CompositionDrawList : PooledList> public CompositionDrawList Clone() { - var clone = new CompositionDrawList(Count); + var clone = new CompositionDrawList(Count) { Size = Size }; foreach (var r in this) clone.Add(r.Clone()); return clone; } + + public void Render(CompositorDrawingContextProxy canvas) + { + foreach (var cmd in this) + { + canvas.VisualBrushDrawList = (cmd.Item as BrushDrawOperation)?.Aux as CompositionDrawList; + cmd.Item.Render(canvas); + } + + canvas.VisualBrushDrawList = null; + } } internal class CompositionDrawListBuilder diff --git a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs index c8e5d9e064..96c0e22d56 100644 --- a/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs +++ b/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs @@ -359,25 +359,30 @@ internal class CompositionDrawingContext : IDrawingContextImpl ? _builder.DrawOperations[_drawOperationIndex] as IRef : null; } - - private IDictionary? CreateChildScene(IBrush? brush) + + private IDisposable? CreateChildScene(IBrush? brush) { - /* - var visualBrush = brush as VisualBrush; - - if (visualBrush != null) + if (brush is VisualBrush visualBrush) { var visual = visualBrush.Visual; if (visual != null) { + // TODO: This is a temporary solution to make visual brush to work like it does with DeferredRenderer + // We should directly reference the corresponding CompositionVisual (which should + // be attached to the same composition target) like UWP does. + // Render-able visuals shouldn't be dangling unattached (visual as IVisualBrushInitialize)?.EnsureInitialized(); - var scene = new Scene(visual); - _sceneBuilder.UpdateAll(scene); - return new Dictionary { { visualBrush.Visual, scene } }; - } - }*/ + var drawList = new CompositionDrawList() { Size = visual.Bounds.Size }; + var recorder = new CompositionDrawingContext(); + recorder.BeginUpdate(drawList); + ImmediateRenderer.Render(visual, new DrawingContext(recorder)); + recorder.EndUpdate(); + + return drawList; + } + } return null; } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs index 7d061e86a9..8b6ac5b0c2 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs @@ -2,6 +2,7 @@ using System.Numerics; using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Platform; +using Avalonia.Rendering.Composition.Drawing; using Avalonia.Rendering.SceneGraph; using Avalonia.Utilities; @@ -10,12 +11,21 @@ namespace Avalonia.Rendering.Composition.Server; internal class CompositorDrawingContextProxy : IDrawingContextImpl { private IDrawingContextImpl _impl; + private readonly VisualBrushRenderer _visualBrushRenderer; - public CompositorDrawingContextProxy(IDrawingContextImpl impl) + public CompositorDrawingContextProxy(IDrawingContextImpl impl, VisualBrushRenderer visualBrushRenderer) { _impl = impl; + _visualBrushRenderer = visualBrushRenderer; } + // This is a hack to make it work with the current way of handling visual brushes + public CompositionDrawList? VisualBrushDrawList + { + get => _visualBrushRenderer.VisualBrushDrawList; + set => _visualBrushRenderer.VisualBrushDrawList = value; + } + public Matrix PreTransform { get; set; } = Matrix.Identity; public void Dispose() @@ -135,4 +145,22 @@ internal class CompositorDrawingContextProxy : IDrawingContextImpl { _impl.Custom(custom); } + + public class VisualBrushRenderer : IVisualBrushRenderer + { + public CompositionDrawList? VisualBrushDrawList { get; set; } + public Size GetRenderTargetSize(IVisualBrush brush) + { + return VisualBrushDrawList?.Size ?? Size.Empty; + } + + public void RenderVisualBrush(IDrawingContextImpl context, IVisualBrush brush) + { + if (VisualBrushDrawList != null) + { + foreach (var cmd in VisualBrushDrawList) + cmd.Item.Render(context); + } + } + } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs index f0384c36fc..ba18211459 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs @@ -51,10 +51,7 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua { if (_renderCommands != null) { - foreach (var cmd in _renderCommands) - { - cmd.Item.Render(canvas); - } + _renderCommands.Render(canvas); } base.RenderCore(canvas, transform); } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index dab65fc8ed..d8a5de4f54 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -75,11 +75,12 @@ namespace Avalonia.Rendering.Composition.Server if (!_dirtyRect.IsEmpty) { - using (var context = _layer.CreateDrawingContext(null)) + var visualBrushHelper = new CompositorDrawingContextProxy.VisualBrushRenderer(); + using (var context = _layer.CreateDrawingContext(visualBrushHelper)) { context.PushClip(_dirtyRect); context.Clear(Colors.Transparent); - Root.Render(new CompositorDrawingContextProxy(context), Root.CombinedTransformMatrix); + Root.Render(new CompositorDrawingContextProxy(context, visualBrushHelper), Root.CombinedTransformMatrix); context.PopClip(); } } diff --git a/src/Avalonia.Base/Rendering/DeferredRenderer.cs b/src/Avalonia.Base/Rendering/DeferredRenderer.cs index 82be0a1a0f..4236763e3b 100644 --- a/src/Avalonia.Base/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Base/Rendering/DeferredRenderer.cs @@ -272,16 +272,18 @@ namespace Avalonia.Rendering } } + Scene? TryGetChildScene(IRef? op) => (op?.Item as BrushDrawOperation)?.Aux as Scene; + /// Size IVisualBrushRenderer.GetRenderTargetSize(IVisualBrush brush) { - return (_currentDraw?.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]?.Size ?? Size.Empty; + return TryGetChildScene(_currentDraw)?.Size ?? Size.Empty; } /// void IVisualBrushRenderer.RenderVisualBrush(IDrawingContextImpl context, IVisualBrush brush) { - var childScene = (_currentDraw?.Item as BrushDrawOperation)?.ChildScenes?[brush.Visual]; + var childScene = TryGetChildScene(_currentDraw); if (childScene != null) { diff --git a/src/Avalonia.Base/Rendering/SceneGraph/BrushDrawOperation.cs b/src/Avalonia.Base/Rendering/SceneGraph/BrushDrawOperation.cs index cd3dac699a..e81966ce81 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/BrushDrawOperation.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/BrushDrawOperation.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.VisualTree; @@ -9,14 +10,21 @@ namespace Avalonia.Rendering.SceneGraph /// internal abstract class BrushDrawOperation : DrawOperation { - public BrushDrawOperation(Rect bounds, Matrix transform) + public BrushDrawOperation(Rect bounds, Matrix transform, IDisposable? aux) : base(bounds, transform) { + Aux = aux; } /// - /// Gets a collection of child scenes that are needed to draw visual brushes. + /// Auxiliary data required to draw the brush /// - public abstract IDictionary? ChildScenes { get; } + public IDisposable? Aux { get; } + + public override void Dispose() + { + Aux?.Dispose(); + base.Dispose(); + } } } diff --git a/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs b/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs index 3f495c619c..07082e4ac3 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/DeferredDrawingContextImpl.cs @@ -457,7 +457,7 @@ namespace Avalonia.Rendering.SceneGraph return _drawOperationindex < _node!.DrawOperations.Count ? _node.DrawOperations[_drawOperationindex] as IRef : null; } - private IDictionary? CreateChildScene(IBrush? brush) + private IDisposable? CreateChildScene(IBrush? brush) { var visualBrush = brush as VisualBrush; @@ -470,7 +470,7 @@ namespace Avalonia.Rendering.SceneGraph (visual as IVisualBrushInitialize)?.EnsureInitialized(); var scene = new Scene(visual); _sceneBuilder.UpdateAll(scene); - return new Dictionary { { visualBrush.Visual, scene } }; + return scene; } } diff --git a/src/Avalonia.Base/Rendering/SceneGraph/EllipseNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/EllipseNode.cs index c1fc6a81f6..4600653b9d 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/EllipseNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/EllipseNode.cs @@ -17,14 +17,13 @@ namespace Avalonia.Rendering.SceneGraph IBrush? brush, IPen? pen, Rect rect, - IDictionary? childScenes = null) - : base(rect.Inflate(pen?.Thickness ?? 0), transform) + IDisposable? aux = null) + : base(rect.Inflate(pen?.Thickness ?? 0), transform, aux) { Transform = transform; Brush = brush?.ToImmutable(); Pen = pen?.ToImmutable(); Rect = rect; - ChildScenes = childScenes; } /// @@ -47,8 +46,6 @@ namespace Avalonia.Rendering.SceneGraph /// public Rect Rect { get; } - public override IDictionary? ChildScenes { get; } - public bool Equals(Matrix transform, IBrush? brush, IPen? pen, Rect rect) { return transform == Transform && diff --git a/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs index 70748989d6..4b43f93aee 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/GeometryNode.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Platform; @@ -23,14 +24,13 @@ namespace Avalonia.Rendering.SceneGraph IBrush? brush, IPen? pen, IGeometryImpl geometry, - IDictionary? childScenes = null) - : base(geometry.GetRenderBounds(pen).CalculateBoundsWithLineCaps(pen), transform) + IDisposable? aux) + : base(geometry.GetRenderBounds(pen).CalculateBoundsWithLineCaps(pen), transform, aux) { Transform = transform; Brush = brush?.ToImmutable(); Pen = pen?.ToImmutable(); Geometry = geometry; - ChildScenes = childScenes; } /// @@ -53,9 +53,6 @@ namespace Avalonia.Rendering.SceneGraph /// public IGeometryImpl Geometry { get; } - /// - public override IDictionary? ChildScenes { get; } - /// /// Determines if this draw operation equals another. /// diff --git a/src/Avalonia.Base/Rendering/SceneGraph/GlyphRunNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/GlyphRunNode.cs index d6da087120..9199611ed6 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/GlyphRunNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/GlyphRunNode.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; @@ -23,13 +24,12 @@ namespace Avalonia.Rendering.SceneGraph Matrix transform, IBrush foreground, GlyphRun glyphRun, - IDictionary? childScenes = null) - : base(new Rect(glyphRun.Size), transform) + IDisposable? aux = null) + : base(new Rect(glyphRun.Size), transform, aux) { Transform = transform; Foreground = foreground.ToImmutable(); GlyphRun = glyphRun; - ChildScenes = childScenes; } /// @@ -47,9 +47,6 @@ namespace Avalonia.Rendering.SceneGraph /// public GlyphRun GlyphRun { get; } - /// - public override IDictionary? ChildScenes { get; } - /// public override void Render(IDrawingContextImpl context) { diff --git a/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs index a9e1ce8ed7..ee5ec0a5fc 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/LineNode.cs @@ -25,14 +25,13 @@ namespace Avalonia.Rendering.SceneGraph IPen pen, Point p1, Point p2, - IDictionary? childScenes = null) - : base(LineBoundsHelper.CalculateBounds(p1, p2, pen), transform) + IDisposable? aux = null) + : base(LineBoundsHelper.CalculateBounds(p1, p2, pen), transform, aux) { Transform = transform; Pen = pen.ToImmutable(); P1 = p1; P2 = p2; - ChildScenes = childScenes; } /// @@ -55,9 +54,6 @@ namespace Avalonia.Rendering.SceneGraph /// public Point P2 { get; } - /// - public override IDictionary? ChildScenes { get; } - /// /// Determines if this draw operation equals another. /// diff --git a/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs index 4b6e7d2254..549c1fd7de 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/OpacityMaskNode.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.Platform; using Avalonia.VisualTree; @@ -17,12 +18,11 @@ namespace Avalonia.Rendering.SceneGraph /// The opacity mask to push. /// The bounds of the mask. /// Child scenes for drawing visual brushes. - public OpacityMaskNode(IBrush mask, Rect bounds, IDictionary? childScenes = null) - : base(Rect.Empty, Matrix.Identity) + public OpacityMaskNode(IBrush mask, Rect bounds, IDisposable? aux = null) + : base(Rect.Empty, Matrix.Identity, aux) { Mask = mask.ToImmutable(); MaskBounds = bounds; - ChildScenes = childScenes; } /// @@ -30,7 +30,7 @@ namespace Avalonia.Rendering.SceneGraph /// opacity mask pop. /// public OpacityMaskNode() - : base(Rect.Empty, Matrix.Identity) + : base(Rect.Empty, Matrix.Identity, null) { } @@ -44,8 +44,6 @@ namespace Avalonia.Rendering.SceneGraph /// public Rect? MaskBounds { get; } - /// - public override IDictionary? ChildScenes { get; } /// public override bool HitTest(Point p) => false; diff --git a/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs b/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs index 3279c3a549..7b79c446f9 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/RectangleNode.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Avalonia.Media; using Avalonia.Media.Immutable; using Avalonia.Platform; @@ -26,14 +27,13 @@ namespace Avalonia.Rendering.SceneGraph IPen? pen, RoundedRect rect, BoxShadows boxShadows, - IDictionary? childScenes = null) - : base(boxShadows.TransformBounds(rect.Rect).Inflate((pen?.Thickness ?? 0) / 2), transform) + IDisposable? aux = null) + : base(boxShadows.TransformBounds(rect.Rect).Inflate((pen?.Thickness ?? 0) / 2), transform, aux) { Transform = transform; Brush = brush?.ToImmutable(); Pen = pen?.ToImmutable(); Rect = rect; - ChildScenes = childScenes; BoxShadows = boxShadows; } @@ -62,9 +62,6 @@ namespace Avalonia.Rendering.SceneGraph /// public BoxShadows BoxShadows { get; } - /// - public override IDictionary? ChildScenes { get; } - /// /// Determines if this draw operation equals another. /// From 7e4fa1d84b7a8eac22fa72fb2d0c9c612e743bf3 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 25 May 2022 21:46:52 +0300 Subject: [PATCH 050/393] Fixed hit-testing for the first frame --- .../Composition/Server/ReadbackIndices.cs | 25 ++++++++----------- .../Server/ServerCompositionTarget.cs | 10 +++++--- .../Composition/Server/ServerVisual.cs | 3 +-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs b/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs index 372fa4d9ce..1971451811 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ReadbackIndices.cs @@ -4,29 +4,24 @@ namespace Avalonia.Rendering.Composition.Server { private readonly object _lock = new object(); public int ReadIndex { get; private set; } = 0; - public int WriteIndex { get; private set; } = -1; + public int WriteIndex { get; private set; } = 1; + public int WrittenIndex { get; private set; } = 0; public ulong ReadRevision { get; private set; } - public ulong WriteRevision { get; private set; } - private ulong[] _revisions = new ulong[3]; - - + public ulong LastWrittenRevision { get; private set; } + public void NextRead() { lock (_lock) { - for (var c = 0; c < 3; c++) + if (ReadRevision < LastWrittenRevision) { - if (c != WriteIndex && c != ReadIndex && _revisions[c] > ReadRevision) - { - ReadIndex = c; - ReadRevision = _revisions[c]; - return; - } + ReadIndex = WrittenIndex; + ReadRevision = LastWrittenRevision; } } } - public void NextWrite(ulong revision) + public void CompleteWrite(ulong writtenRevision) { lock (_lock) { @@ -34,9 +29,9 @@ namespace Avalonia.Rendering.Composition.Server { if (c != WriteIndex && c != ReadIndex) { + WrittenIndex = WriteIndex; + LastWrittenRevision = writtenRevision; WriteIndex = c; - WriteRevision = revision; - _revisions[c] = revision; return; } } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index d8a5de4f54..a50562eabc 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -15,7 +15,7 @@ namespace Avalonia.Rendering.Composition.Server private readonly Func _renderTargetFactory; private static long s_nextId = 1; public long Id { get; } - private ulong _frame = 1; + public ulong Revision { get; private set; } private IRenderTarget? _renderTarget; private FpsCounter _fpsCounter = new FpsCounter(Typeface.Default.GlyphTypeface); private Rect _dirtyRect; @@ -58,9 +58,14 @@ namespace Avalonia.Rendering.Composition.Server if(_dirtyRect.IsEmpty && !_redrawRequested) return; + + Revision++; + // Update happens in a separate phase to extend dirty rect if needed Root.Update(this, Matrix4x4.Identity); + Readback.CompleteWrite(Revision); + _redrawRequested = false; using (var targetContext = _renderTarget.CreateDrawingContext(null)) { @@ -102,9 +107,6 @@ namespace Avalonia.Rendering.Composition.Server _dirtyRect = Rect.Empty; } - - Readback.NextWrite(_frame); - _frame++; } private static Rect SnapToDevicePixels(Rect rect, double scale) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 05b63a7a73..4e320c34be 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -63,7 +63,7 @@ namespace Avalonia.Rendering.Composition.Server Scale, RotationAngle, Orientation, Offset); var i = Root!.Readback; ref var readback = ref GetReadback(i.WriteIndex); - readback.Revision = i.WriteRevision; + readback.Revision = root.Revision; readback.Matrix = res; readback.TargetId = Root.Id; //TODO: check effective opacity too @@ -85,7 +85,6 @@ namespace Avalonia.Rendering.Composition.Server public struct ReadbackData { public Matrix4x4 Matrix; - public bool Visible; public ulong Revision; public long TargetId; } From 7a9d9ea304e3e96f0b857afb9b3c14bb864fd6b9 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 25 May 2022 22:17:35 +0300 Subject: [PATCH 051/393] Invalidate visual's rect if it's moved in the global coordinate space --- .../Rendering/Composition/Server/ServerVisual.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 4e320c34be..9bfc909fe4 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -69,7 +69,14 @@ namespace Avalonia.Rendering.Composition.Server //TODO: check effective opacity too IsVisibleInFrame = Visible && Opacity > 0; CombinedTransformMatrix = res; - GlobalTransformMatrix = res * transform; + var newTransform = res * transform; + if (GlobalTransformMatrix != newTransform) + { + // Visual was moved alongside with its parent + _isDirty = true; + Root.AddDirtyRect(TransformedBounds); + } + GlobalTransformMatrix = newTransform; //TODO: Cache TransformedBounds = ContentBounds.TransformToAABB(MatrixUtils.ToMatrix(GlobalTransformMatrix)); From 19ebf5ad7d8356b9f88716223d1c37759fcb41d6 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 25 May 2022 23:44:47 -0400 Subject: [PATCH 052/393] Bring back blob disposal checks --- .../Platform/Internal/UnmanagedBlob.cs | 64 +++++++++++++++++-- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs index eacf79d4f4..ed0862c06c 100644 --- a/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs +++ b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs @@ -1,5 +1,8 @@ using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Threading; namespace Avalonia.Platform.Internal; @@ -7,7 +10,30 @@ internal class UnmanagedBlob : IUnmanagedBlob { private IntPtr _address; private readonly object _lock = new object(); - +#if DEBUG + private static readonly List Backtraces = new List(); + private static Thread? GCThread; + private readonly string _backtrace; + private static readonly object _btlock = new object(); + + class GCThreadDetector + { + ~GCThreadDetector() + { + GCThread = Thread.CurrentThread; + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void Spawn() => new GCThreadDetector(); + + static UnmanagedBlob() + { + Spawn(); + GC.WaitForPendingFinalizers(); + } +#endif + public UnmanagedBlob(int size) { try @@ -23,14 +49,23 @@ internal class UnmanagedBlob : IUnmanagedBlob GC.SuppressFinalize(this); throw; } +#if DEBUG + _backtrace = Environment.StackTrace; + lock (_btlock) + Backtraces.Add(_backtrace); +#endif } - - private void DoDispose() + + void DoDispose() { lock (_lock) { if (!IsDisposed) { +#if DEBUG + lock (_btlock) + Backtraces.Remove(_backtrace); +#endif Marshal.FreeHGlobal(_address); GC.RemoveMemoryPressure(Size); IsDisposed = true; @@ -39,18 +74,35 @@ internal class UnmanagedBlob : IUnmanagedBlob } } } - + public void Dispose() { +#if DEBUG + if (Thread.CurrentThread.ManagedThreadId == GCThread?.ManagedThreadId) + { + lock (_lock) + { + if (!IsDisposed) + { + Console.Error.WriteLine("Native blob disposal from finalizer thread\nBacktrace: " + + Environment.StackTrace + + "\n\nBlob created by " + _backtrace); + } + } + } +#endif DoDispose(); GC.SuppressFinalize(this); } - + ~UnmanagedBlob() { +#if DEBUG + Console.Error.WriteLine("Undisposed native blob created by " + _backtrace); +#endif DoDispose(); } - + public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address; public int Size { get; private set; } public bool IsDisposed { get; private set; } From f0989357a01a1df28ad5b522aad180e08d5e539f Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 15:29:56 +0300 Subject: [PATCH 053/393] Visiblity check fix --- src/Avalonia.Base/Rendering/Composition/Visual.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index f7c8078073..fa8d5d8f3b 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -45,8 +45,8 @@ namespace Avalonia.Rendering.Composition var i = Root.Server.Readback; ref var readback = ref Server.GetReadback(i.ReadIndex); - // CompositionVisual wasn't visible - if (readback.Revision < i.ReadRevision) + // CompositionVisual wasn't visible or wasn't even attached to the composition target during the lat frame + if (!readback.Visible || readback.Revision < i.ReadRevision) return null; // CompositionVisual was reparented (potential race here) From f974859323c06b493226dc8d85de66349a5ac4a9 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 15:30:12 +0300 Subject: [PATCH 054/393] Change stream WIP --- .../Composition/Server/ServerVisual.cs | 51 ++++-- .../Composition/Transport/BatchStream.cs | 173 ++++++++++++++++++ .../Transport/BatchStreamArrayPool.cs | 144 +++++++++++++++ 3 files changed, 354 insertions(+), 14 deletions(-) create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 9bfc909fe4..801bfb2f65 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -8,6 +8,7 @@ namespace Avalonia.Rendering.Composition.Server { private bool _isDirty; private ServerCompositionTarget? _root; + private bool _isBackface; protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { @@ -59,23 +60,35 @@ namespace Avalonia.Rendering.Composition.Server public virtual void Update(ServerCompositionTarget root, Matrix4x4 transform) { - var res = MatrixUtils.ComputeTransform(Size, AnchorPoint, CenterPoint, TransformMatrix, + // Calculate new parent-relative transform + CombinedTransformMatrix = MatrixUtils.ComputeTransform(Size, AnchorPoint, CenterPoint, TransformMatrix, Scale, RotationAngle, Orientation, Offset); - var i = Root!.Readback; - ref var readback = ref GetReadback(i.WriteIndex); - readback.Revision = root.Revision; - readback.Matrix = res; - readback.TargetId = Root.Id; - //TODO: check effective opacity too - IsVisibleInFrame = Visible && Opacity > 0; - CombinedTransformMatrix = res; - var newTransform = res * transform; + + var newTransform = CombinedTransformMatrix * transform; + + // Check if visual was moved and recalculate face orientation + var positionChanged = false; if (GlobalTransformMatrix != newTransform) { - // Visual was moved alongside with its parent - _isDirty = true; - Root.AddDirtyRect(TransformedBounds); + _isBackface = Vector3.Transform( + new Vector3(0, 0, float.PositiveInfinity), GlobalTransformMatrix).Z <= 0; + positionChanged = true; + } + + var wasVisible = IsVisibleInFrame; + //TODO: check effective opacity too + IsVisibleInFrame = Visible && Opacity > 0 && !_isBackface; + + // Invalidate previous rect and queue new rect based on visibility + if (positionChanged) + { + if(wasVisible) + Root!.AddDirtyRect(TransformedBounds); + + if (IsVisibleInFrame) + _isDirty = true; } + GlobalTransformMatrix = newTransform; //TODO: Cache TransformedBounds = ContentBounds.TransformToAABB(MatrixUtils.ToMatrix(GlobalTransformMatrix)); @@ -84,9 +97,18 @@ namespace Avalonia.Rendering.Composition.Server _isDirty = false; else if (_isDirty) { - Root.AddDirtyRect(TransformedBounds); + Root!.AddDirtyRect(TransformedBounds); _isDirty = false; } + + // Update readback indices + var i = Root!.Readback; + ref var readback = ref GetReadback(i.WriteIndex); + readback.Revision = root.Revision; + readback.Matrix = CombinedTransformMatrix; + readback.TargetId = Root.Id; + readback.Visible = IsVisibleInFrame; + } public struct ReadbackData @@ -94,6 +116,7 @@ namespace Avalonia.Rendering.Composition.Server public Matrix4x4 Matrix; public ulong Revision; public long TargetId; + public bool Visible; } partial void ApplyChangesExtra(CompositionVisualChanges c) diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs new file mode 100644 index 0000000000..feb892d134 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using Avalonia.Rendering.Composition.Server; + +namespace Avalonia.Rendering.Composition.Transport; + +internal class BatchStreamData +{ + public Queue> Objects { get; } = new(); + public Queue> Structs { get; } = new(); +} + +public struct BatchStreamSegment +{ + public TData Data { get; set; } + public int ElementCount { get; set; } +} + +internal class BatchStreamWriter : IDisposable +{ + private readonly BatchStreamData _output; + private readonly BatchStreamMemoryPool _memoryPool; + private readonly BatchStreamObjectPool _objectPool; + + private BatchStreamSegment _currentObjectSegment; + private BatchStreamSegment _currentDataSegment; + + public BatchStreamWriter(BatchStreamData output, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) + { + _output = output; + _memoryPool = memoryPool; + _objectPool = objectPool; + } + + void CommitDataSegment() + { + if (_currentDataSegment.Data != IntPtr.Zero) + _output.Structs.Enqueue(_currentDataSegment); + _currentDataSegment = new (); + } + + void NextDataSegment() + { + CommitDataSegment(); + _currentDataSegment.Data = _memoryPool.Get(); + } + + void CommitObjectSegment() + { + if (_currentObjectSegment.Data != null) + _output.Objects.Enqueue(_currentObjectSegment!); + _currentObjectSegment = new(); + } + + void NextObjectSegment() + { + CommitObjectSegment(); + _currentObjectSegment.Data = _objectPool.Get(); + } + + public unsafe void Write(T item) where T : unmanaged + { + var size = Unsafe.SizeOf(); + if (_currentDataSegment.Data == IntPtr.Zero || _currentDataSegment.ElementCount + size > _memoryPool.BufferSize) + NextDataSegment(); + *(T*)((byte*)_currentDataSegment.Data + _currentDataSegment.ElementCount) = item; + _currentDataSegment.ElementCount += size; + } + + public void Write(ServerObject item) + { + if (_currentObjectSegment.Data == null || + _currentObjectSegment.ElementCount >= _currentObjectSegment.Data.Length) + NextObjectSegment(); + _currentObjectSegment.Data![_currentObjectSegment.ElementCount] = item; + _currentObjectSegment.ElementCount++; + } + + public void Dispose() + { + CommitDataSegment(); + CommitObjectSegment(); + } +} + +internal class BatchStreamReader : IDisposable +{ + private readonly BatchStreamData _input; + private readonly BatchStreamMemoryPool _memoryPool; + private readonly BatchStreamObjectPool _objectPool; + + private BatchStreamSegment _currentObjectSegment; + private BatchStreamSegment _currentDataSegment; + private int _memoryOffset, _objectOffset; + + public BatchStreamReader(BatchStreamData _input, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) + { + this._input = _input; + _memoryPool = memoryPool; + _objectPool = objectPool; + } + + public unsafe T Read() where T : unmanaged + { + var size = Unsafe.SizeOf(); + if (_currentDataSegment.Data == IntPtr.Zero) + { + if (_input.Structs.Count == 0) + throw new EndOfStreamException(); + _currentDataSegment = _input.Structs.Dequeue(); + _memoryOffset = 0; + } + + if (_memoryOffset + size > _currentDataSegment.ElementCount) + throw new InvalidOperationException("Attempted to read more memory then left in the current segment"); + + var rv = *(T*)((byte*)_currentDataSegment.Data + size); + _memoryOffset += size; + if (_memoryOffset == _currentDataSegment.ElementCount) + { + _memoryPool.Return(_currentDataSegment.Data); + _currentDataSegment = new(); + } + + return rv; + } + + public ServerObject ReadObject() + { + if (_currentObjectSegment.Data == null) + { + if (_input.Objects.Count == 0) + throw new EndOfStreamException(); + _currentObjectSegment = _input.Objects.Dequeue()!; + _objectOffset = 0; + } + + var rv = _currentObjectSegment.Data![_objectOffset]; + _objectOffset++; + if (_objectOffset == _currentObjectSegment.ElementCount) + { + _objectPool.Return(_currentObjectSegment.Data); + _currentObjectSegment = new(); + } + + return rv; + } + + public bool IsStructEof => _currentDataSegment.Data == IntPtr.Zero && _input.Structs.Count == 0; + + public void Dispose() + { + if (_currentDataSegment.Data != IntPtr.Zero) + { + _memoryPool.Return(_currentDataSegment.Data); + _currentDataSegment = new(); + } + + while (_input.Structs.Count > 0) + _memoryPool.Return(_input.Structs.Dequeue().Data); + + if (_currentObjectSegment.Data != null) + { + _objectPool.Return(_currentObjectSegment.Data); + _currentObjectSegment = new(); + } + + while (_input.Objects.Count > 0) + _objectPool.Return(_input.Objects.Dequeue().Data); + } +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs new file mode 100644 index 0000000000..913958765a --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ConstrainedExecution; +using System.Runtime.InteropServices; +using Avalonia.Threading; + +namespace Avalonia.Rendering.Composition.Transport; + +/// +/// A pool that keeps a number of elements that was used in the last 10 seconds +/// +internal abstract class BatchStreamPoolBase : IDisposable +{ + readonly Stack _pool = new(); + bool _disposed; + int _usage; + readonly int[] _usageStatistics = new int[10]; + int _usageStatisticsSlot; + + public BatchStreamPoolBase(bool needsFinalize = false) + { + if(!needsFinalize) + GC.SuppressFinalize(needsFinalize); + + var updateRef = new WeakReference>(this); + StartUpdateTimer(updateRef); + } + + static void StartUpdateTimer(WeakReference> updateRef) + { + DispatcherTimer.Run(() => + { + if (updateRef.TryGetTarget(out var target)) + { + target.UpdateStatistics(); + return true; + } + return false; + + }, TimeSpan.FromSeconds(1)); + } + + private void UpdateStatistics() + { + lock (_pool) + { + var maximumUsage = _usageStatistics.Max(); + var recentlyUsedPooledSlots = maximumUsage - _usage; + while (recentlyUsedPooledSlots < _pool.Count) + DestroyItem(_pool.Pop()); + + _usageStatistics[_usage] = 0; + _usageStatisticsSlot = (_usageStatisticsSlot + 1) % _usageStatistics.Length; + } + } + + protected abstract T CreateItem(); + + protected virtual void DestroyItem(T item) + { + + } + + public T Get() + { + lock (_pool) + { + _usage++; + if (_usageStatistics[_usageStatisticsSlot] < _usage) + _usageStatistics[_usageStatisticsSlot] = _usage; + + if (_pool.Count != 0) + return _pool.Pop(); + } + + return CreateItem(); + } + + public void Return(T item) + { + lock (_pool) + { + _usage--; + if (!_disposed) + { + _pool.Push(item); + return; + } + } + + DestroyItem(item); + } + + public void Dispose() + { + lock (_pool) + { + _disposed = true; + foreach (var item in _pool) + DestroyItem(item); + _pool.Clear(); + } + } + + ~BatchStreamPoolBase() + { + Dispose(); + } +} + +internal sealed class BatchStreamObjectPool : BatchStreamPoolBase where T : class +{ + private readonly int _arraySize; + + public BatchStreamObjectPool(int arraySize = 1024) + { + _arraySize = arraySize; + } + + protected override T[] CreateItem() + { + return new T[_arraySize]; + } + + protected override void DestroyItem(T[] item) + { + Array.Clear(item, 0, item.Length); + } +} + +internal sealed class BatchStreamMemoryPool : BatchStreamPoolBase +{ + public int BufferSize { get; } + + public BatchStreamMemoryPool(int bufferSize = 16384) + { + BufferSize = bufferSize; + } + + protected override IntPtr CreateItem() => Marshal.AllocHGlobal(BufferSize); + + protected override void DestroyItem(IntPtr item) => Marshal.FreeHGlobal(item); +} \ No newline at end of file From 4991d4f370acd7503260258722bcad328e619d65 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 21:35:50 +0300 Subject: [PATCH 055/393] Switched to byte-stream based transport --- .../Animations/AnimatedValueStore.cs | 5 +- .../Animations/CompositionAnimation.cs | 5 +- .../Animations/CompositionAnimationGroup.cs | 2 - .../Animations/ExpressionAnimation.cs | 2 +- .../Animations/ImplicitAnimationCollection.cs | 2 - .../Composition/CompositionDrawListVisual.cs | 16 +- .../Composition/CompositionEasingFunction.cs | 4 +- .../Composition/CompositionObject.cs | 57 ++- .../Composition/CompositionPropertySet.cs | 12 +- .../Composition/CompositionTarget.cs | 2 +- .../Rendering/Composition/Compositor.cs | 50 ++- .../Rendering/Composition/ContainerVisual.cs | 13 +- .../Rendering/Composition/CustomDrawVisual.cs | 56 --- .../Server/ServerCompositionDrawListVisual.cs | 10 +- .../Server/ServerCompositionTarget.cs | 4 +- .../Composition/Server/ServerCompositor.cs | 23 +- .../Server/ServerContainerVisual.cs | 9 +- .../Server/ServerCustomDrawVisual.cs | 31 -- .../Composition/Server/ServerList.cs | 24 +- .../Composition/Server/ServerObject.cs | 28 +- .../Composition/Server/ServerVisual.cs | 31 +- .../Rendering/Composition/Transport/Batch.cs | 7 +- .../Composition/Transport/BatchStream.cs | 27 +- .../Transport/BatchStreamArrayPool.cs | 24 +- .../Transport/BatchStreamDebugMarker.cs | 9 + .../Rendering/Composition/Transport/Change.cs | 82 ---- .../Composition/Transport/ChangeSet.cs | 36 -- .../Composition/Transport/ChangeSetPool.cs | 42 -- .../Transport/CompositionTargetChanges.cs | 11 - .../Transport/CustomDrawVisualChanges.cs | 20 - .../Transport/DrawListVisualChanges.cs | 48 -- .../Composition/Transport/ListChange.cs | 19 - .../Composition/Transport/ListChangeSet.cs | 25 -- .../Transport/ServerListProxyHelper.cs | 55 +-- .../Composition/Transport/VisualChanges.cs | 16 - .../Rendering/Composition/Visual.cs | 35 +- .../Rendering/Composition/VisualCollection.cs | 1 + src/Avalonia.Base/composition-schema.xml | 7 +- .../CompositionGenerator/Config.cs | 6 + .../CompositionGenerator/Extensions.cs | 9 + .../Generator.KeyFrameAnimation.cs | 2 +- .../Generator.ListProxy.cs | 12 +- .../CompositionGenerator/Generator.cs | 413 ++++++++++-------- src/Avalonia.X11/X11Platform.cs | 2 +- src/Windows/Avalonia.Win32/Win32Platform.cs | 2 +- .../Composition/BatchStreamTests.cs | 45 ++ 46 files changed, 532 insertions(+), 809 deletions(-) delete mode 100644 src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs create mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamDebugMarker.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/Change.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs delete mode 100644 src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs create mode 100644 tests/Avalonia.Base.UnitTests/Composition/BatchStreamTests.cs diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs index e877b50b20..95bc384743 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/AnimatedValueStore.cs @@ -1,3 +1,4 @@ +using System; using System.Runtime.InteropServices; using Avalonia.Rendering.Composition.Expressions; using Avalonia.Rendering.Composition.Server; @@ -81,7 +82,7 @@ namespace Avalonia.Rendering.Composition.Animations public bool IsAnimation => _animation != null; - public void SetAnimation(ServerObject target, ChangeSet cs, IAnimationInstance animation, int storeOffset) + public void SetAnimation(ServerObject target, TimeSpan commitedAt, IAnimationInstance animation, int storeOffset) { _direct = default; if (_animation != null) @@ -91,7 +92,7 @@ namespace Avalonia.Rendering.Composition.Animations } _animation = animation; - _animation.Initialize(cs.Batch.CommitedAt, ExpressionVariant.Create(LastAnimated), storeOffset); + _animation.Initialize(commitedAt, ExpressionVariant.Create(LastAnimated), storeOffset); if (target.IsActive) _animation.Activate(); diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs index fe20115b38..cf81c6e656 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimation.cs @@ -18,8 +18,6 @@ namespace Avalonia.Rendering.Composition.Animations _propertySet = new CompositionPropertySet(compositor); } - private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); - public void ClearAllParameters() => _propertySet.ClearAll(); public void ClearParameter(string key) => _propertySet.Clear(key); @@ -52,8 +50,7 @@ namespace Avalonia.Rendering.Composition.Animations internal abstract IAnimationInstance CreateInstance(ServerObject targetObject, ExpressionVariant? finalValue); - internal PropertySetSnapshot CreateSnapshot(bool server) - => _propertySet.Snapshot(server); + internal PropertySetSnapshot CreateSnapshot() => _propertySet.Snapshot(); void ICompositionAnimationBase.InternalOnly() { diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs index 833f7e498c..89f8ba411d 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/CompositionAnimationGroup.cs @@ -20,7 +20,5 @@ namespace Avalonia.Rendering.Composition.Animations public CompositionAnimationGroup(Compositor compositor) : base(compositor, null!) { } - - private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs index a6f24c2e35..6a2c07e6ef 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ExpressionAnimation.cs @@ -29,6 +29,6 @@ namespace Avalonia.Rendering.Composition.Animations internal override IAnimationInstance CreateInstance( ServerObject targetObject, ExpressionVariant? finalValue) => new ExpressionAnimationInstance(ParsedExpression, - targetObject, finalValue, CreateSnapshot(true)); + targetObject, finalValue, CreateSnapshot()); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs b/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs index be91352527..fa5b69dae9 100644 --- a/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs +++ b/src/Avalonia.Base/Rendering/Composition/Animations/ImplicitAnimationCollection.cs @@ -15,8 +15,6 @@ namespace Avalonia.Rendering.Composition.Animations _innerface = _inner; } - private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); - public IEnumerator> GetEnumerator() => _inner.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable) _inner).GetEnumerator(); diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs index e4ed0abd29..069d888fbb 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -9,7 +9,7 @@ internal class CompositionDrawListVisual : CompositionContainerVisual { public Visual Visual { get; } - private new DrawListVisualChanges Changes => (DrawListVisualChanges)base.Changes; + private bool _drawListChanged; private CompositionDrawList? _drawList; public CompositionDrawList? DrawList { @@ -18,11 +18,21 @@ internal class CompositionDrawListVisual : CompositionContainerVisual { _drawList?.Dispose(); _drawList = value; - Changes.DrawCommands = value?.Clone(); + _drawListChanged = true; + RegisterForSerialization(); } } - private protected override IChangeSetPool ChangeSetPool => DrawListVisualChanges.Pool; + private protected override void SerializeChangesCore(BatchStreamWriter writer) + { + writer.Write((byte)(_drawListChanged ? 1 : 0)); + if (_drawListChanged) + { + writer.WriteObject(DrawList?.Clone()); + _drawListChanged = false; + } + base.SerializeChangesCore(writer); + } internal CompositionDrawListVisual(Compositor compositor, ServerCompositionDrawListVisual server, Visual visual) : base(compositor, server) { diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs b/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs index 73db243e93..90b2bec268 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionEasingFunction.cs @@ -10,9 +10,7 @@ namespace Avalonia.Rendering.Composition internal CompositionEasingFunction(Compositor compositor) : base(compositor, null!) { } - - private protected override IChangeSetPool ChangeSetPool => throw new InvalidOperationException(); - + internal abstract IEasingFunction Snapshot(); } diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs index 2417ecaba8..d561338a36 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs @@ -6,7 +6,7 @@ using Avalonia.Rendering.Composition.Transport; namespace Avalonia.Rendering.Composition { - public abstract class CompositionObject : IDisposable, IExpressionObject + public abstract class CompositionObject : IDisposable { public ImplicitAnimationCollection? ImplicitAnimations { get; set; } internal CompositionObject(Compositor compositor, ServerObject server) @@ -18,46 +18,17 @@ namespace Avalonia.Rendering.Composition public Compositor Compositor { get; } internal ServerObject Server { get; } public bool IsDisposed { get; private set; } - private ChangeSet? _changes; + private bool _registeredForSerialization; private static void ThrowInvalidOperation() => throw new InvalidOperationException("There is no server-side counterpart for this object"); - - private protected ChangeSet Changes - { - get - { - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - if (Server == null) ThrowInvalidOperation(); - var currentBatch = Compositor.CurrentBatch; - if (_changes != null && _changes.Batch != currentBatch) - _changes = null; - if (_changes == null) - { - _changes = ChangeSetPool.Get(Server!, currentBatch); - currentBatch.Changes!.Add(_changes); - Compositor.QueueImplicitBatchCommit(); - } - - return _changes; - } - } - - private protected abstract IChangeSetPool ChangeSetPool { get; } public void Dispose() { - Changes.Dispose = true; + //Changes.Dispose = true; IsDisposed = true; } - internal virtual ExpressionVariant GetPropertyForAnimation(string name) - { - return default; - } - - ExpressionVariant IExpressionObject.GetProperty(string name) => GetPropertyForAnimation(name); - public void StartAnimation(string propertyName, CompositionAnimation animation) => StartAnimation(propertyName, animation, null); @@ -121,5 +92,27 @@ namespace Avalonia.Rendering.Composition throw new ArgumentException(); } + + protected void RegisterForSerialization() + { + if (Server == null) + throw new InvalidOperationException("The object doesn't have an associated server counterpart"); + + if(_registeredForSerialization) + return; + _registeredForSerialization = true; + Compositor.RegisterForSerialization(this); + } + + internal void SerializeChanges(BatchStreamWriter writer) + { + _registeredForSerialization = false; + SerializeChangesCore(writer); + } + + private protected virtual void SerializeChangesCore(BatchStreamWriter writer) + { + + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs index bc0ce804dc..584969cbc0 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionPropertySet.cs @@ -16,8 +16,6 @@ namespace Avalonia.Rendering.Composition { } - private protected override IChangeSetPool ChangeSetPool => throw new NotSupportedException(); - internal void Set(string key, ExpressionVariant value) { _objects.Remove(key); @@ -104,10 +102,10 @@ namespace Avalonia.Rendering.Composition _variants.Remove(key); } - internal PropertySetSnapshot Snapshot(bool server) => - SnapshotCore(server, 1); + internal PropertySetSnapshot Snapshot() => + SnapshotCore(1); - private PropertySetSnapshot SnapshotCore(bool server, int allowedNestingLevel) + private PropertySetSnapshot SnapshotCore(int allowedNestingLevel) { var dic = new Dictionary(_objects.Count + _variants.Count); foreach (var o in _objects) @@ -116,12 +114,12 @@ namespace Avalonia.Rendering.Composition { if (allowedNestingLevel <= 0) throw new InvalidOperationException("PropertySet depth limit reached"); - dic[o.Key] = new PropertySetSnapshot.Value(ps.SnapshotCore(server, allowedNestingLevel - 1)); + dic[o.Key] = new PropertySetSnapshot.Value(ps.SnapshotCore(allowedNestingLevel - 1)); } else if (o.Value.Server == null) throw new InvalidOperationException($"Object of type {o.Value.GetType()} is not allowed"); else - dic[o.Key] = new PropertySetSnapshot.Value(server ? (IExpressionObject) o.Value.Server : o.Value); + dic[o.Key] = new PropertySetSnapshot.Value(o.Value.Server); } foreach (var v in _variants) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs index 8d052389c2..c5cfaeacce 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs @@ -102,6 +102,6 @@ namespace Avalonia.Rendering.Composition return false; } - public void RequestRedraw() => Changes.RedrawRequested.Value = true; + public void RequestRedraw() => RegisterForSerialization(); } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Compositor.cs b/src/Avalonia.Base/Rendering/Composition/Compositor.cs index 14d779dbc4..96564f0800 100644 --- a/src/Avalonia.Base/Rendering/Composition/Compositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Compositor.cs @@ -16,18 +16,17 @@ namespace Avalonia.Rendering.Composition public partial class Compositor { private ServerCompositor _server; - private Batch _currentBatch; private bool _implicitBatchCommitQueued; private Action _implicitBatchCommit; - - internal Batch CurrentBatch => _currentBatch; + private BatchStreamObjectPool _batchObjectPool = new(); + private BatchStreamMemoryPool _batchMemoryPool = new(); + private List _objectsForSerialization = new(); internal ServerCompositor Server => _server; internal CompositionEasingFunction DefaultEasing { get; } - - private Compositor(ServerCompositor server) + + public Compositor(IRenderLoop loop) { - _server = server; - _currentBatch = new Batch(); + _server = new ServerCompositor(loop, _batchObjectPool, _batchMemoryPool); _implicitBatchCommit = ImplicitBatchCommit; DefaultEasing = new CubicBezierEasingFunction(this, new Vector2(0.25f, 0.1f), new Vector2(0.25f, 1f)); @@ -40,18 +39,27 @@ namespace Avalonia.Rendering.Composition public Task RequestCommitAsync() { - var batch = CurrentBatch; - _currentBatch = new Batch(); + var batch = new Batch(); + + using (var writer = new BatchStreamWriter(batch.Changes, _batchMemoryPool, _batchObjectPool)) + { + foreach (var obj in _objectsForSerialization) + { + writer.WriteObject(obj.Server); + obj.SerializeChanges(writer); +#if DEBUG_COMPOSITOR_SERIALIZATION + writer.Write(BatchStreamDebugMarkers.ObjectEndMagic); + writer.WriteObject(BatchStreamDebugMarkers.ObjectEndMarker); +#endif + } + _objectsForSerialization.Clear(); + } + batch.CommitedAt = Server.Clock.Elapsed; _server.EnqueueBatch(batch); return batch.Completed; } - public static Compositor Create(IRenderLoop timer) - { - return new Compositor(new ServerCompositor(timer)); - } - public void Dispose() { @@ -122,12 +130,8 @@ namespace Avalonia.Rendering.Composition public ImplicitAnimationCollection CreateImplicitAnimationCollection() => new ImplicitAnimationCollection(this); public CompositionAnimationGroup CreateAnimationGroup() => new CompositionAnimationGroup(this); - - internal CustomDrawVisual CreateCustomDrawVisual(ICustomDrawVisualRenderer renderer, - ICustomDrawVisualHitTest? hitTest = null) where T : IEquatable => - new CustomDrawVisual(this, renderer, hitTest); - - public void QueueImplicitBatchCommit() + + private void QueueImplicitBatchCommit() { if(_implicitBatchCommitQueued) return; @@ -140,5 +144,11 @@ namespace Avalonia.Rendering.Composition _implicitBatchCommitQueued = false; RequestCommitAsync(); } + + internal void RegisterForSerialization(CompositionObject compositionObject) + { + _objectsForSerialization.Add(compositionObject); + QueueImplicitBatchCommit(); + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs index f650d3e995..5b2a4be1bc 100644 --- a/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/ContainerVisual.cs @@ -2,19 +2,20 @@ using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition { - public class CompositionContainerVisual : CompositionVisual + public partial class CompositionContainerVisual : CompositionVisual { - public CompositionVisualCollection Children { get; } - internal CompositionContainerVisual(Compositor compositor, ServerCompositionContainerVisual server) : base(compositor, server) + public CompositionVisualCollection Children { get; private set; } = null!; + + partial void InitializeDefaultsExtra() { - Children = new CompositionVisualCollection(this, server.Children); + Children = new CompositionVisualCollection(this, Server.Children); } - private protected override void OnRootChanged() + private protected override void OnRootChangedCore() { foreach (var ch in Children) ch.Root = Root; - base.OnRootChanged(); + base.OnRootChangedCore(); } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs b/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs deleted file mode 100644 index 0505d6a46c..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/CustomDrawVisual.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Numerics; -using Avalonia.Platform; -using Avalonia.Rendering.Composition.Server; -using Avalonia.Rendering.Composition.Transport; - -namespace Avalonia.Rendering.Composition -{ - internal class CustomDrawVisual : CompositionContainerVisual where TData : IEquatable - { - private readonly ICustomDrawVisualHitTest? _hitTest; - - internal CustomDrawVisual(Compositor compositor, ICustomDrawVisualRenderer renderer, - ICustomDrawVisualHitTest? hitTest) : base(compositor, - new ServerCustomDrawVisual(compositor.Server, renderer)) - { - _hitTest = hitTest; - } - - private TData? _data; - - static bool Eq(TData? left, TData? right) - { - if (left == null && right == null) - return true; - if (left == null) - return false; - return left.Equals(right); - } - - public TData? Data - { - get => _data; - set - { - if (!Eq(_data, value)) - { - ((CustomDrawVisualChanges) Changes).Data.Value = value; - _data = value; - } - } - } - - private protected override IChangeSetPool ChangeSetPool => CustomDrawVisualChanges.Pool; - } - - public interface ICustomDrawVisualRenderer - { - void Render(IDrawingContextImpl canvas, TData? data); - } - - public interface ICustomDrawVisualHitTest - { - bool HitTest(TData data, Vector2 vector2); - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs index ba18211459..f1b5032cd3 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs @@ -1,3 +1,4 @@ +using System; using System.Numerics; using Avalonia.Collections.Pooled; using Avalonia.Platform; @@ -35,16 +36,15 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua } } - protected override void ApplyCore(ChangeSet changes) + protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt) { - var ch = (DrawListVisualChanges)changes; - if (ch.DrawCommandsIsSet) + if (reader.Read() == 1) { _renderCommands?.Dispose(); - _renderCommands = ch.AcquireDrawCommands(); + _renderCommands = reader.ReadObject(); _contentBounds = null; } - base.ApplyCore(changes); + base.DeserializeChangesCore(reader, commitedAt); } protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index a50562eabc..7567eba534 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -42,8 +42,8 @@ namespace Avalonia.Rendering.Composition.Server else _compositor.RemoveCompositionTarget(this); } - - partial void ApplyChangesExtra(CompositionTargetChanges c) + + partial void DeserializeChangesExtra(BatchStreamReader c) { _redrawRequested = true; } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs index 5dbe9cfb17..f7de704b23 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs @@ -17,10 +17,14 @@ namespace Avalonia.Rendering.Composition.Server private List _activeTargets = new(); private HashSet _activeAnimations = new(); private List _animationsToUpdate = new(); + private BatchStreamObjectPool _batchObjectPool; + private BatchStreamMemoryPool _batchMemoryPool; - public ServerCompositor(IRenderLoop renderLoop) + public ServerCompositor(IRenderLoop renderLoop, BatchStreamObjectPool batchObjectPool, BatchStreamMemoryPool batchMemoryPool) { _renderLoop = renderLoop; + _batchObjectPool = batchObjectPool; + _batchMemoryPool = batchMemoryPool; _renderLoop.Add(this); } @@ -45,14 +49,21 @@ namespace Avalonia.Rendering.Composition.Server batch = _batches.Dequeue(); } - foreach (var change in batch.Changes) + using (var stream = new BatchStreamReader(batch.Changes, _batchMemoryPool, _batchObjectPool)) { - if (change.Dispose) + while (!stream.IsObjectEof) { - //TODO + var target = (ServerObject)stream.ReadObject()!; + target.DeserializeChanges(stream, batch); +#if DEBUG_COMPOSITOR_SERIALIZATION + if (stream.ReadObject() != BatchStreamDebugMarkers.ObjectEndMarker) + throw new InvalidOperationException( + $"Object {target.GetType()} failed to deserialize properly on object stream"); + if(stream.Read() != BatchStreamDebugMarkers.ObjectEndMagic) + throw new InvalidOperationException( + $"Object {target.GetType()} failed to deserialize properly on data stream"); +#endif } - change.Target!.Apply(change); - change.Reset(); } _reusableToCompleteList.Add(batch); diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs index 3f0995b257..a277450214 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs @@ -3,10 +3,9 @@ using Avalonia.Platform; namespace Avalonia.Rendering.Composition.Server { - internal class ServerCompositionContainerVisual : ServerCompositionVisual + internal partial class ServerCompositionContainerVisual : ServerCompositionVisual { - public ServerCompositionVisualCollection Children { get; } - + public ServerCompositionVisualCollection Children { get; private set; } = null!; protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { @@ -28,9 +27,9 @@ namespace Avalonia.Rendering.Composition.Server child.Update(root, GlobalTransformMatrix); } - public ServerCompositionContainerVisual(ServerCompositor compositor) : base(compositor) + partial void Initialize() { - Children = new ServerCompositionVisualCollection(compositor); + Children = new ServerCompositionVisualCollection(Compositor); } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs deleted file mode 100644 index 5f3eb051a4..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomDrawVisual.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Numerics; -using Avalonia.Platform; -using Avalonia.Rendering.Composition.Transport; - -namespace Avalonia.Rendering.Composition.Server -{ - class ServerCustomDrawVisual : ServerCompositionContainerVisual - { - private readonly ICustomDrawVisualRenderer _renderer; - private TData? _data; - public ServerCustomDrawVisual(ServerCompositor compositor, ICustomDrawVisualRenderer renderer) : base(compositor) - { - _renderer = renderer; - } - - protected override void ApplyCore(ChangeSet changes) - { - var c = (CustomDrawVisualChanges) changes; - if (c.Data.IsSet) - _data = c.Data.Value; - - base.ApplyCore(changes); - } - - protected override void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) - { - _renderer.Render(canvas, _data); - base.RenderCore(canvas, transform); - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs index 09ef119e6b..4beea4715b 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs @@ -7,25 +7,19 @@ namespace Avalonia.Rendering.Composition.Server class ServerList : ServerObject where T : ServerObject { public List List { get; } = new List(); - protected override void ApplyCore(ChangeSet changes) + + protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt) { - var c = (ListChangeSet) changes; - if (c.HasListChanges) + if (reader.Read() == 1) { - foreach (var lc in c.ListChanges) - { - if(lc.Action == ListChangeAction.Clear) - List.Clear(); - if(lc.Action == ListChangeAction.RemoveAt) - List.RemoveAt(lc.Index); - if(lc.Action == ListChangeAction.InsertAt) - List.Insert(lc.Index, lc.Added!); - if (lc.Action == ListChangeAction.ReplaceAt) - List[lc.Index] = lc.Added!; - } + List.Clear(); + var count = reader.Read(); + for (var c = 0; c < count; c++) + List.Add(reader.ReadObject()); } + base.DeserializeChangesCore(reader, commitedAt); } - + public override long LastChangedBy { get diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs index 5b2f58b186..16f57d9059 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs @@ -23,18 +23,6 @@ namespace Avalonia.Rendering.Composition.Server Compositor = compositor; } - protected virtual void ApplyCore(ChangeSet changes) - { - - } - - public void Apply(ChangeSet changes) - { - ApplyCore(changes); - ValuesInvalidated(); - ItselfLastChangedBy = changes.Batch!.SequenceId; - } - public virtual ExpressionVariant GetPropertyForAnimation(string name) { return default; @@ -81,6 +69,10 @@ namespace Avalonia.Rendering.Composition.Server [MethodImpl(MethodImplOptions.AggressiveInlining)] private ref ServerObjectSubscriptionStore GetStoreFromOffset(int offset) { +#if DEBUG + if (offset == 0) + throw new InvalidOperationException(); +#endif return ref Unsafe.As(ref Unsafe.AddByteOffset(ref _activationCount, new IntPtr(offset))); } @@ -112,5 +104,17 @@ namespace Avalonia.Rendering.Composition.Server } public virtual int? GetFieldOffset(string fieldName) => null; + + protected virtual void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt) + { + + } + + public void DeserializeChanges(BatchStreamReader reader, Batch batch) + { + DeserializeChangesCore(reader, batch.CommitedAt); + ValuesInvalidated(); + ItselfLastChangedBy = batch.SequenceId; + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 801bfb2f65..5717ab2f8c 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -7,7 +7,6 @@ namespace Avalonia.Rendering.Composition.Server unsafe partial class ServerCompositionVisual : ServerObject { private bool _isDirty; - private ServerCompositionTarget? _root; private bool _isBackface; protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Matrix4x4 transform) { @@ -119,28 +118,24 @@ namespace Avalonia.Rendering.Composition.Server public bool Visible; } - partial void ApplyChangesExtra(CompositionVisualChanges c) + + partial void DeserializeChangesExtra(BatchStreamReader c) { - if (c.Parent.IsSet) - Parent = c.Parent.Value; - if (c.Root.IsSet) - Root = c.Root.Value; ValuesInvalidated(); } - public ServerCompositionTarget? Root + partial void OnRootChanging() { - get => _root; - private set - { - if(_root != null) - Deactivate(); - _root = value; - if (_root != null) - Activate(); - } + if(Root != null) + Deactivate(); } - + + partial void OnRootChanged() + { + if (Root != null) + Activate(); + } + protected override void ValuesInvalidated() { _isDirty = true; @@ -149,8 +144,6 @@ namespace Avalonia.Rendering.Composition.Server else Root?.Invalidate(); } - - public ServerCompositionVisual? Parent { get; private set; } public bool IsVisibleInFrame { get; set; } public Rect TransformedBounds { get; set; } public virtual Rect ContentBounds => new Rect(0, 0, Size.X, Size.Y); diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs index 7b64c01d09..0714db5781 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs @@ -9,23 +9,22 @@ namespace Avalonia.Rendering.Composition.Transport internal class Batch { private static long _nextSequenceId = 1; - private static ConcurrentBag> _pool = new ConcurrentBag>(); + private static ConcurrentBag _pool = new(); public long SequenceId { get; } public Batch() { SequenceId = Interlocked.Increment(ref _nextSequenceId); if (!_pool.TryTake(out var lst)) - lst = new List(); + lst = new BatchStreamData(); Changes = lst; } private TaskCompletionSource _tcs = new TaskCompletionSource(); - public List Changes { get; private set; } + public BatchStreamData Changes { get; private set; } public TimeSpan CommitedAt { get; set; } public void Complete() { - Changes.Clear(); _pool.Add(Changes); Changes = null!; diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs index feb892d134..9e9ed739fb 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs @@ -2,13 +2,14 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; +using Avalonia.Rendering.Composition.Animations; using Avalonia.Rendering.Composition.Server; namespace Avalonia.Rendering.Composition.Transport; internal class BatchStreamData { - public Queue> Objects { get; } = new(); + public Queue> Objects { get; } = new(); public Queue> Structs { get; } = new(); } @@ -22,12 +23,12 @@ internal class BatchStreamWriter : IDisposable { private readonly BatchStreamData _output; private readonly BatchStreamMemoryPool _memoryPool; - private readonly BatchStreamObjectPool _objectPool; + private readonly BatchStreamObjectPool _objectPool; - private BatchStreamSegment _currentObjectSegment; + private BatchStreamSegment _currentObjectSegment; private BatchStreamSegment _currentDataSegment; - public BatchStreamWriter(BatchStreamData output, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) + public BatchStreamWriter(BatchStreamData output, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) { _output = output; _memoryPool = memoryPool; @@ -69,7 +70,7 @@ internal class BatchStreamWriter : IDisposable _currentDataSegment.ElementCount += size; } - public void Write(ServerObject item) + public void WriteObject(object? item) { if (_currentObjectSegment.Data == null || _currentObjectSegment.ElementCount >= _currentObjectSegment.Data.Length) @@ -89,15 +90,15 @@ internal class BatchStreamReader : IDisposable { private readonly BatchStreamData _input; private readonly BatchStreamMemoryPool _memoryPool; - private readonly BatchStreamObjectPool _objectPool; + private readonly BatchStreamObjectPool _objectPool; - private BatchStreamSegment _currentObjectSegment; + private BatchStreamSegment _currentObjectSegment; private BatchStreamSegment _currentDataSegment; private int _memoryOffset, _objectOffset; - public BatchStreamReader(BatchStreamData _input, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) + public BatchStreamReader(BatchStreamData input, BatchStreamMemoryPool memoryPool, BatchStreamObjectPool objectPool) { - this._input = _input; + _input = input; _memoryPool = memoryPool; _objectPool = objectPool; } @@ -116,7 +117,7 @@ internal class BatchStreamReader : IDisposable if (_memoryOffset + size > _currentDataSegment.ElementCount) throw new InvalidOperationException("Attempted to read more memory then left in the current segment"); - var rv = *(T*)((byte*)_currentDataSegment.Data + size); + var rv = *(T*)((byte*)_currentDataSegment.Data + _memoryOffset); _memoryOffset += size; if (_memoryOffset == _currentDataSegment.ElementCount) { @@ -127,7 +128,9 @@ internal class BatchStreamReader : IDisposable return rv; } - public ServerObject ReadObject() + public T ReadObject() where T : class? => (T)ReadObject()!; + + public object? ReadObject() { if (_currentObjectSegment.Data == null) { @@ -148,6 +151,8 @@ internal class BatchStreamReader : IDisposable return rv; } + public bool IsObjectEof => _currentObjectSegment.Data == null && _input.Objects.Count == 0; + public bool IsStructEof => _currentDataSegment.Data == IntPtr.Zero && _input.Structs.Count == 0; public void Dispose() diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs index 913958765a..d76a9c609e 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs @@ -18,27 +18,31 @@ internal abstract class BatchStreamPoolBase : IDisposable readonly int[] _usageStatistics = new int[10]; int _usageStatisticsSlot; - public BatchStreamPoolBase(bool needsFinalize = false) + public BatchStreamPoolBase(bool needsFinalize, Action>? startTimer = null) { if(!needsFinalize) GC.SuppressFinalize(needsFinalize); var updateRef = new WeakReference>(this); - StartUpdateTimer(updateRef); + StartUpdateTimer(startTimer, updateRef); } - static void StartUpdateTimer(WeakReference> updateRef) + static void StartUpdateTimer(Action>? startTimer, WeakReference> updateRef) { - DispatcherTimer.Run(() => + Func timerProc = () => { if (updateRef.TryGetTarget(out var target)) { target.UpdateStatistics(); return true; } - return false; - }, TimeSpan.FromSeconds(1)); + return false; + }; + if (startTimer != null) + startTimer(timerProc); + else + DispatcherTimer.Run(timerProc, TimeSpan.FromSeconds(1)); } private void UpdateStatistics() @@ -50,7 +54,7 @@ internal abstract class BatchStreamPoolBase : IDisposable while (recentlyUsedPooledSlots < _pool.Count) DestroyItem(_pool.Pop()); - _usageStatistics[_usage] = 0; + _usageStatistics[_usageStatisticsSlot] = 0; _usageStatisticsSlot = (_usageStatisticsSlot + 1) % _usageStatistics.Length; } } @@ -109,11 +113,11 @@ internal abstract class BatchStreamPoolBase : IDisposable } } -internal sealed class BatchStreamObjectPool : BatchStreamPoolBase where T : class +internal sealed class BatchStreamObjectPool : BatchStreamPoolBase where T : class? { private readonly int _arraySize; - public BatchStreamObjectPool(int arraySize = 1024) + public BatchStreamObjectPool(int arraySize = 1024, Action>? startTimer = null) : base(false, startTimer) { _arraySize = arraySize; } @@ -133,7 +137,7 @@ internal sealed class BatchStreamMemoryPool : BatchStreamPoolBase { public int BufferSize { get; } - public BatchStreamMemoryPool(int bufferSize = 16384) + public BatchStreamMemoryPool(int bufferSize = 16384, Action>? startTimer = null) : base(true, startTimer) { BufferSize = bufferSize; } diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamDebugMarker.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamDebugMarker.cs new file mode 100644 index 0000000000..7d21b03f24 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamDebugMarker.cs @@ -0,0 +1,9 @@ +using System; + +namespace Avalonia.Rendering.Composition.Transport; + +internal class BatchStreamDebugMarkers +{ + public static object ObjectEndMarker = new object(); + public static Guid ObjectEndMagic = Guid.NewGuid(); +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs b/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs deleted file mode 100644 index cbee350ab3..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/Change.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using Avalonia.Rendering.Composition.Animations; - -namespace Avalonia.Rendering.Composition.Transport -{ - struct Change - { - private T? _value; - - public bool IsSet { get; private set; } - - public T? Value - { - get - { - if(!IsSet) - throw new InvalidOperationException(); - return _value; - } - set - { - IsSet = true; - _value = value; - } - } - - public void Reset() - { - _value = default; - IsSet = false; - } - } - - struct AnimatedChange - { - private T? _value; - private IAnimationInstance? _animation; - - public bool IsValue { get; private set; } - public bool IsAnimation { get; private set; } - - public T Value - { - get - { - if(!IsValue) - throw new InvalidOperationException(); - return _value!; - } - set - { - IsAnimation = false; - _animation = null; - IsValue = true; - _value = value; - } - } - - public IAnimationInstance Animation - { - get - { - if(!IsAnimation) - throw new InvalidOperationException(); - return _animation!; - } - set - { - IsValue = false; - _value = default; - IsAnimation = true; - _animation = value; - } - } - - public void Reset() - { - this = default; - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs deleted file mode 100644 index 898885dce6..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSet.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Avalonia.Rendering.Composition.Server; - -namespace Avalonia.Rendering.Composition.Transport -{ - internal abstract class ChangeSet - { - private readonly IChangeSetPool _pool; - public Batch Batch = null!; - public ServerObject? Target; - public bool Dispose; - - public ChangeSet(IChangeSetPool pool) - { - _pool = pool; - } - - public virtual void Reset() - { - Batch = null!; - Target = null; - Dispose = false; - } - - public void Return() - { - _pool.Return(this); - } - } - - internal class CompositionObjectChanges : ChangeSet - { - public CompositionObjectChanges(IChangeSetPool pool) : base(pool) - { - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs deleted file mode 100644 index ea97cd7d44..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/ChangeSetPool.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Concurrent; -using Avalonia.Rendering.Composition.Server; - -namespace Avalonia.Rendering.Composition.Transport -{ - interface IChangeSetPool - { - void Return(ChangeSet changes); - ChangeSet Get(ServerObject target, Batch batch); - } - - class ChangeSetPool : IChangeSetPool where T : ChangeSet - { - private readonly Func _factory; - private readonly ConcurrentBag _pool = new ConcurrentBag(); - - public ChangeSetPool(Func factory) - { - _factory = factory; - } - - public void Return(T changes) - { - changes.Reset(); - _pool.Add(changes); - } - - void IChangeSetPool.Return(ChangeSet changes) => Return((T) changes); - ChangeSet IChangeSetPool.Get(ServerObject target, Batch batch) => Get(target, batch); - - public T Get(ServerObject target, Batch batch) - { - if (!_pool.TryTake(out var res)) - res = _factory(this); - res.Target = target; - res.Batch = batch; - res.Dispose = false; - return res; - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs deleted file mode 100644 index 014adc7bbe..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/CompositionTargetChanges.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Avalonia.Rendering.Composition.Transport; - -partial class CompositionTargetChanges -{ - public Change RedrawRequested; - - partial void ResetExtra() - { - RedrawRequested.Reset(); - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs deleted file mode 100644 index aed041b62e..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/CustomDrawVisualChanges.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Avalonia.Rendering.Composition.Transport -{ - class CustomDrawVisualChanges : CompositionVisualChanges - { - public CustomDrawVisualChanges(IChangeSetPool pool) : base(pool) - { - } - - public Change Data; - - public override void Reset() - { - Data.Reset(); - base.Reset(); - } - - public new static ChangeSetPool> Pool { get; } = - new ChangeSetPool>(pool => new CustomDrawVisualChanges(pool)); - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs deleted file mode 100644 index 215c03b229..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/DrawListVisualChanges.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using Avalonia.Collections.Pooled; -using Avalonia.Rendering.Composition.Drawing; -using Avalonia.Rendering.SceneGraph; -using Avalonia.Utilities; - -namespace Avalonia.Rendering.Composition.Transport; - -internal class DrawListVisualChanges : CompositionVisualChanges -{ - private CompositionDrawList? _drawCommands; - - public DrawListVisualChanges(IChangeSetPool pool) : base(pool) - { - } - - public CompositionDrawList? DrawCommands - { - get => _drawCommands; - set - { - _drawCommands?.Dispose(); - _drawCommands = value; - DrawCommandsIsSet = true; - } - } - - public bool DrawCommandsIsSet { get; private set; } - - public CompositionDrawList? AcquireDrawCommands() - { - var rv = _drawCommands; - _drawCommands = null; - DrawCommandsIsSet = false; - return rv; - } - - public override void Reset() - { - _drawCommands?.Dispose(); - _drawCommands = null; - DrawCommandsIsSet = false; - base.Reset(); - } - - public new static ChangeSetPool Pool { get; } = - new ChangeSetPool(pool => new(pool)); -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs deleted file mode 100644 index ee6e4231f8..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/ListChange.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Avalonia.Rendering.Composition.Server; - -namespace Avalonia.Rendering.Composition.Transport -{ - internal class ListChange where T : ServerObject - { - public int Index; - public ListChangeAction Action; - public T? Added; - } - - internal enum ListChangeAction - { - InsertAt, - RemoveAt, - Clear, - ReplaceAt - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs deleted file mode 100644 index 9bb101a080..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/ListChangeSet.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using Avalonia.Rendering.Composition.Server; - -namespace Avalonia.Rendering.Composition.Transport -{ - class ListChangeSet : ChangeSet where T : ServerObject - { - private List>? _listChanges; - public List> ListChanges => _listChanges ??= new List>(); - public bool HasListChanges => _listChanges != null; - - public override void Reset() - { - _listChanges?.Clear(); - base.Reset(); - } - - public ListChangeSet(IChangeSetPool pool) : base(pool) - { - } - - public static readonly ChangeSetPool> Pool = - new ChangeSetPool>(pool => new ListChangeSet(pool)); - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs b/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs index 1add3aa990..2399bd71d7 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/ServerListProxyHelper.cs @@ -8,19 +8,21 @@ namespace Avalonia.Rendering.Composition.Transport where TServer : ServerObject where TClient : CompositionObject { - private readonly IGetChanges _parent; - private readonly List _list = new List(); + private readonly IRegisterForSerialization _parent; + private bool _changed; - public interface IGetChanges + public interface IRegisterForSerialization { - ListChangeSet GetChanges(); + void RegisterForSerialization(); } - public ServerListProxyHelper(IGetChanges parent) + public ServerListProxyHelper(IRegisterForSerialization parent) { _parent = parent; } - + + private readonly List _list = new List(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public List.Enumerator GetEnumerator() => _list.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); @@ -30,10 +32,8 @@ namespace Avalonia.Rendering.Composition.Transport public void Clear() { _list.Clear(); - _parent.GetChanges().ListChanges.Add(new ListChange - { - Action = ListChangeAction.Clear - }); + _changed = true; + _parent.RegisterForSerialization(); } public bool Contains(TClient item) => _list.Contains(item); @@ -56,22 +56,15 @@ namespace Avalonia.Rendering.Composition.Transport public void Insert(int index, TClient item) { _list.Insert(index, item); - _parent.GetChanges().ListChanges.Add(new ListChange - { - Action = ListChangeAction.InsertAt, - Index = index, - Added = (TServer) item.Server - }); + _changed = true; + _parent.RegisterForSerialization(); } public void RemoveAt(int index) { _list.RemoveAt(index); - _parent.GetChanges().ListChanges.Add(new ListChange - { - Action = ListChangeAction.RemoveAt, - Index = index - }); + _changed = true; + _parent.RegisterForSerialization(); } public TClient this[int index] @@ -80,13 +73,21 @@ namespace Avalonia.Rendering.Composition.Transport set { _list[index] = value; - _parent.GetChanges().ListChanges.Add(new ListChange - { - Action = ListChangeAction.ReplaceAt, - Index = index, - Added = (TServer) value.Server - }); + _changed = true; + _parent.RegisterForSerialization(); + } + } + + public void Serialize(BatchStreamWriter writer) + { + writer.Write((byte)(_changed ? 1 : 0)); + if (_changed) + { + writer.Write(_list.Count); + foreach (var el in _list) + writer.WriteObject(el.Server); } + _changed = false; } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs b/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs deleted file mode 100644 index c87fb96967..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Transport/VisualChanges.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Avalonia.Rendering.Composition.Server; - -namespace Avalonia.Rendering.Composition.Transport -{ - partial class CompositionVisualChanges - { - public Change Parent; - public Change Root; - - partial void ResetExtra() - { - Parent.Reset(); - Root.Reset(); - } - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index fa8d5d8f3b..5bf5dcee74 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -4,39 +4,14 @@ namespace Avalonia.Rendering.Composition { public abstract partial class CompositionVisual { - private CompositionVisual? _parent; - private CompositionTarget? _root; - - public CompositionVisual? Parent - { - get => _parent; - internal set - { - if (_parent == value) - return; - _parent = value; - Changes.Parent.Value = value?.Server; - Root = _parent?.Root; - } - } - - // TODO: hide behind private-ish API - public CompositionTarget? Root + private protected virtual void OnRootChangedCore() { - get => _root; - internal set - { - var changed = _root != value; - _root = value; - Changes.Root.Value = value?.Server; - if (changed) - OnRootChanged(); - } } - private protected virtual void OnRootChanged() - { - } + partial void OnRootChanged() => OnRootChangedCore(); + + partial void OnParentChanged() => Root = Parent?.Root; + internal Matrix4x4? TryGetServerTransform() { diff --git a/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs index fef4caf675..42226a8b4d 100644 --- a/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs +++ b/src/Avalonia.Base/Rendering/Composition/VisualCollection.cs @@ -64,6 +64,7 @@ namespace Avalonia.Rendering.Composition { if (item.Parent != null) throw new InvalidOperationException("Visual already has a parent"); + item.Parent = item; } } } \ No newline at end of file diff --git a/src/Avalonia.Base/composition-schema.xml b/src/Avalonia.Base/composition-schema.xml index eb1ffe1922..a7ae341bb3 100644 --- a/src/Avalonia.Base/composition-schema.xml +++ b/src/Avalonia.Base/composition-schema.xml @@ -4,10 +4,12 @@ Avalonia.Rendering.Composition.Server Avalonia.Rendering.Composition.Transport Avalonia.Rendering.Composition.Animations - - + + + + @@ -21,6 +23,7 @@ + diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs index 8b6aca33cd..096864e52a 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Config.cs @@ -35,6 +35,10 @@ namespace Avalonia.SourceGenerator.CompositionGenerator [XmlAttribute] public string Name { get; set; } + + [XmlAttribute] + public bool Passthrough { get; set; } + [XmlAttribute] public string ServerName { get; set; } } @@ -104,6 +108,8 @@ namespace Avalonia.SourceGenerator.CompositionGenerator public string DefaultValue { get; set; } [XmlAttribute] public bool Animated { get; set; } + [XmlAttribute] + public bool InternalSet { get; set; } } public class GAnimationType diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs index 43a4a4afa7..d88e9b4600 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Extensions.cs @@ -41,6 +41,15 @@ namespace Avalonia.SourceGenerator.CompositionGenerator return cl; return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); } + + public static EnumDeclarationSyntax AddModifiers(this EnumDeclarationSyntax cl, params SyntaxKind[] modifiers) + { + if (modifiers == null) + return cl; + return cl.AddModifiers(modifiers.Select(x => SyntaxFactory.Token(x)).ToArray()); + } + + public static string WithLowerFirst(this string s) { diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs index 7d5146c5f5..314ac1acbf 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.KeyFrameAnimation.cs @@ -25,7 +25,7 @@ namespace Avalonia.Rendering.Composition internal override IAnimationInstance CreateInstance(Avalonia.Rendering.Composition.Server.ServerObject targetObject, ExpressionVariant? finalValue) {{ - return new KeyFrameAnimationInstance<{a.Type}>({name}Interpolator.Instance, _keyFrames.Snapshot(), CreateSnapshot(true), + return new KeyFrameAnimationInstance<{a.Type}>({name}Interpolator.Instance, _keyFrames.Snapshot(), CreateSnapshot(), finalValue?.CastOrDefault<{a.Type}>(), targetObject, DelayBehavior, DelayTime, Direction, Duration, IterationBehavior, IterationCount, StopBehavior); diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs index 593386f713..e0ea5b20ae 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.ListProxy.cs @@ -11,9 +11,7 @@ class Template { private ServerListProxyHelper _list = null!; - ListChangeSet - ServerListProxyHelper.IGetChanges. - GetChanges() => Changes; + void ServerListProxyHelper.IRegisterForSerialization.RegisterForSerialization() => RegisterForSerialization(); public List.Enumerator GetEnumerator() => _list.GetEnumerator(); @@ -87,7 +85,11 @@ class Template partial void OnBeforeReplace(ItemTypeName oldItem, ItemTypeName newItem); partial void OnReplace(ItemTypeName oldItem, ItemTypeName newItem); partial void OnClear(); -} + private protected override void SerializeChangesCore(BatchStreamWriter writer) + {{ + _list.Serialize(writer); + base.SerializeChangesCore(writer); + }} "; private ClassDeclarationSyntax AppendListProxy(GList list, ClassDeclarationSyntax cl) @@ -97,7 +99,7 @@ class Template var serverItemType = ServerName(itemType); cl = cl.AddBaseListTypes(SimpleBaseType( - ParseTypeName("ServerListProxyHelper<" + itemType + ", " + serverItemType + ">.IGetChanges")), + ParseTypeName("ServerListProxyHelper<" + itemType + ", " + serverItemType + ">.IRegisterForSerialization")), SimpleBaseType(ParseTypeName("IList<" + itemType + ">")) ); var code = ListProxyTemplate.Replace("ListTypeName", list.Name) diff --git a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs index 5a514a4eff..3c38c0331e 100644 --- a/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs +++ b/src/Avalonia.SourceGenerator/CompositionGenerator/Generator.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis; @@ -38,7 +39,12 @@ namespace Avalonia.SourceGenerator.CompositionGenerator string ServerName(string c) => c != null ? ("Server" + c) : "ServerObject"; string ChangesName(string c) => c != null ? (c + "Changes") : "ChangeSet"; - + string ChangedFieldsTypeName(GClass c) => c.Name + "ChangedFields"; + string ChangedFieldsFieldName(GClass c) => "_changedFieldsOf" + c.Name; + string PropertyBackingFieldName(GProperty prop) => "_" + prop.Name.WithLowerFirst(); + string ServerPropertyOffsetFieldName(GProperty prop) => "s_OffsetOf" + PropertyBackingFieldName(prop); + string PropertyPendingAnimationFieldName(GProperty prop) => "_pendingAnimationFor" + prop.Name; + void GenerateClass(GClass cl) { var list = cl as GList; @@ -68,36 +74,13 @@ namespace Avalonia.SourceGenerator.CompositionGenerator .WithBaseType(serverBase); string changesName = ChangesName(cl.Name); - var changesBase = ChangesName(cl.ChangesBase ?? cl.Inherits); + string changedFieldsTypeName = ChangedFieldsTypeName(cl); + string changedFieldsName = ChangedFieldsFieldName(cl); - if (list != null) - changesBase = "ListChangeSet<" + ServerName(list.ItemType) + ">"; - - var changeSetPoolType = "ChangeSetPool<" + changesName + ">"; - var transport = ClassDeclaration(changesName) - .AddModifiers(SyntaxKind.UnsafeKeyword, SyntaxKind.PartialKeyword) - .WithBaseType(changesBase) - .AddMembers(DeclareField(changeSetPoolType, "Pool", - EqualsValueClause( - ParseExpression($"new {changeSetPoolType}(pool => new {changesName}(pool))") - ), - SyntaxKind.PublicKeyword, - SyntaxKind.StaticKeyword, SyntaxKind.ReadOnlyKeyword)) - .AddMembers(ParseMemberDeclaration($"public {changesName}(IChangeSetPool pool) : base(pool){{}}")); - - client = client - .AddMembers( - PropertyDeclaration(ParseTypeName("IChangeSetPool"), "ChangeSetPool") - .AddModifiers(SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, - SyntaxKind.OverrideKeyword) - .WithExpressionBody( - ArrowExpressionClause(MemberAccess(changesName, "Pool"))) - .WithSemicolonToken(Semicolon())) - .AddMembers(PropertyDeclaration(ParseTypeName(changesName), "Changes") - .AddModifiers(SyntaxKind.PrivateKeyword, SyntaxKind.NewKeyword) - .WithExpressionBody(ArrowExpressionClause(CastExpression(ParseTypeName(changesName), - MemberAccess(BaseExpression(), "Changes")))) - .WithSemicolonToken(Semicolon())); + if (cl.Properties.Count > 0) + client = client + .AddMembers(DeclareField(changedFieldsTypeName, changedFieldsName)); + if (!cl.CustomCtor) { @@ -105,7 +88,7 @@ namespace Avalonia.SourceGenerator.CompositionGenerator .AddModifiers(SyntaxKind.InternalKeyword, SyntaxKind.NewKeyword) .AddAccessorListAccessors(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) .WithSemicolonToken(Semicolon()))); - client = client.AddMembers( + client = client.AddMembers( ConstructorDeclaration(cl.Name) .AddModifiers(SyntaxKind.InternalKeyword) .WithParameterList(ParameterList(SeparatedList(new[] @@ -141,20 +124,20 @@ namespace Avalonia.SourceGenerator.CompositionGenerator ArgumentList(SeparatedList(new[] { Argument(IdentifierName("compositor")), - })))).WithBody(Block())); + })))).WithBody(Block(ParseStatement("Initialize();")))); } + server = server.AddMembers( + MethodDeclaration(ParseTypeName("void"), "Initialize") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + var changesVarName = "c"; var changesVar = IdentifierName(changesVarName); server = server.AddMembers( - MethodDeclaration(ParseTypeName("void"), "ApplyChangesExtra") - .AddParameterListParameters(Parameter(Identifier("c")).WithType(ParseTypeName(changesName))) - .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); - - transport = transport.AddMembers( - MethodDeclaration(ParseTypeName("void"), "ResetExtra") + MethodDeclaration(ParseTypeName("void"), "DeserializeChangesExtra") + .AddParameterListParameters(Parameter(Identifier("c")).WithType(ParseTypeName("BatchStreamReader"))) .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); var applyMethodBody = Block( @@ -168,7 +151,7 @@ namespace Avalonia.SourceGenerator.CompositionGenerator ExpressionStatement(InvocationExpression(IdentifierName("ApplyChangesExtra")) .AddArgumentListArguments(Argument(IdentifierName("c")))) ); - + var uninitializedObjectName = "dummy"; var serverStaticCtorBody = cl.Abstract ? Block() @@ -179,72 +162,51 @@ namespace Avalonia.SourceGenerator.CompositionGenerator ParseStatement("InitializeFieldOffsets(dummy);") ); - var initializeFieldOffsetsBody = cl.ServerBase == null + var initializeFieldOffsetsBody = cl.Inherits == null ? Block() - : Block(ParseStatement($"{cl.ServerBase}.InitializeFieldOffsets(dummy);")); + : Block(ParseStatement($"Server{cl.Inherits}.InitializeFieldOffsets(dummy);")); var resetBody = Block(); var startAnimationBody = Block(); - var getPropertyBody = Block(); var serverGetPropertyBody = Block(); var serverGetFieldOffsetBody = Block(); var activatedBody = Block(ParseStatement("base.Activated();")); var deactivatedBody = Block(ParseStatement("base.Deactivated();")); + var serializeMethodBody = SerializeChangesPrologue(cl); + var deserializeMethodBody = DeserializeChangesPrologue(cl); - var defaultsMethodBody = Block(); + var defaultsMethodBody = Block(ParseStatement("InitializeDefaultsExtra();")); foreach (var prop in cl.Properties) { - var fieldName = "_" + prop.Name.WithLowerFirst(); - var fieldOffsetName = "s_OffsetOf" + fieldName; + var fieldName = PropertyBackingFieldName(prop); + var animatedFieldName = PropertyPendingAnimationFieldName(prop); + var fieldOffsetName = ServerPropertyOffsetFieldName(prop); var propType = ParseTypeName(prop.Type); var filteredPropertyType = prop.Type.TrimEnd('?'); var isObject = _objects.Contains(filteredPropertyType); var isNullable = prop.Type.EndsWith("?"); - - - - - client = client - .AddMembers(DeclareField(prop.Type, fieldName)) - .AddMembers(PropertyDeclaration(propType, prop.Name) - .AddModifiers(SyntaxKind.PublicKeyword) - .AddAccessorListAccessors( - AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, - Block(ReturnStatement(IdentifierName(fieldName)))), - AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, - Block( - ParseStatement("var changed = false;"), - IfStatement(BinaryExpression(SyntaxKind.NotEqualsExpression, - IdentifierName(fieldName), - IdentifierName("value")), - Block( - ParseStatement("On" + prop.Name + "Changing();"), - ParseStatement("changed = true;"), - GeneratePropertySetterAssignment(prop, fieldName, isObject, isNullable)) - ), - ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, - IdentifierName(fieldName), IdentifierName("value"))), - ParseStatement($"if(changed) On" + prop.Name + "Changed();") - )) - )) - .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changed") - .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())) - .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changing") - .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + bool isPassthrough = false; + if (prop.Animated) + client = client.AddMembers(DeclareField("IAnimationInstance?", animatedFieldName)); + client = GenerateClientProperty(client, cl, prop, propType, isObject, isNullable); var animatedServer = prop.Animated; var serverPropertyType = ((isObject ? "Server" : "") + prop.Type); - if (_manuals.TryGetValue(filteredPropertyType, out var manual) && manual.ServerName != null) - serverPropertyType = manual.ServerName + (isNullable ? "?" : ""); - - - transport = transport - .AddMembers(DeclareField((animatedServer ? "Animated" : "") + "Change<" + serverPropertyType + ">", - prop.Name, SyntaxKind.PublicKeyword)); + if (_manuals.TryGetValue(filteredPropertyType, out var manual)) + { + if (manual.Passthrough) + { + isPassthrough = true; + serverPropertyType = prop.Type; + } + if (manual.ServerName != null) + serverPropertyType = manual.ServerName + (isNullable ? "?" : ""); + } + if (animatedServer) server = server.AddMembers( DeclareField("ServerAnimatedValueStore<" + serverPropertyType + ">", fieldName), @@ -301,7 +263,7 @@ namespace Avalonia.SourceGenerator.CompositionGenerator ArgumentList(SeparatedList(new[] { Argument(IdentifierName("this")), - Argument(changesVar), + Argument(ParseExpression("c.Batch.CommitedAt")), Argument(MemberAccess(changesVar, prop.Name, "Animation")), Argument(IdentifierName(fieldOffsetName)) }))))) @@ -316,16 +278,18 @@ namespace Avalonia.SourceGenerator.CompositionGenerator resetBody = resetBody.AddStatements( ExpressionStatement(InvocationExpression(MemberAccess(prop.Name, "Reset")))); - + + serializeMethodBody = ApplySerializeField(serializeMethodBody,cl, prop, isObject, isPassthrough); + deserializeMethodBody = ApplyDeserializeField(deserializeMethodBody,cl, prop, serverPropertyType, isObject); + if (animatedServer) { - startAnimationBody = ApplyStartAnimation(startAnimationBody, prop, fieldName); + startAnimationBody = ApplyStartAnimation(startAnimationBody, cl, prop); activatedBody = activatedBody.AddStatements(ParseStatement($"{fieldName}.Activate(this);")); deactivatedBody = deactivatedBody.AddStatements(ParseStatement($"{fieldName}.Deactivate(this);")); } - - getPropertyBody = ApplyGetProperty(getPropertyBody, prop); + serverGetPropertyBody = ApplyGetProperty(serverGetPropertyBody, prop); serverGetFieldOffsetBody = ApplyGetProperty(serverGetFieldOffsetBody, prop, fieldOffsetName); @@ -345,55 +309,6 @@ namespace Avalonia.SourceGenerator.CompositionGenerator } } - if (cl is GBrush brush && !cl.Abstract) - { - var brushName = brush.Name.StripPrefix("Composition"); - /* - server = server.AddMembers( - MethodDeclaration(ParseTypeName("ICbBrush"), "CreateBackendBrush") - .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) - .WithExpressionBody(ArrowExpressionClause( - InvocationExpression(MemberAccess("Compositor", "Backend", "Create" + brushName)) - )).WithSemicolonToken(Semicolon()) - ); - if (!brush.CustomUpdate) - server = server.AddMembers( - MethodDeclaration(ParseTypeName("void"), "UpdateBackendBrush") - .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) - .AddParameterListParameters(Parameter(Identifier("brush")) - .WithType(ParseTypeName("ICbBrush"))) - .AddBodyStatements( - ExpressionStatement( - InvocationExpression( - MemberAccess( - ParenthesizedExpression( - CastExpression(ParseTypeName("ICb" + brushName), IdentifierName("brush"))), "Update"), - ArgumentList(SeparatedList(cl.Properties.Select(x => - { - if(x.Type.TrimEnd('?') == "ICompositionSurface") - return Argument( - ConditionalAccessExpression(IdentifierName(x.Name), - MemberBindingExpression(IdentifierName("BackendSurface"))) - ); - if (_brushes.Contains(x.Type)) - return Argument( - ConditionalAccessExpression(IdentifierName(x.Name), - MemberBindingExpression(IdentifierName("Brush"))) - ); - return Argument(IdentifierName(x.Name)); - })))) - ))); - -*/ - } - - server = server.AddMembers( - MethodDeclaration(ParseTypeName("void"), "ApplyCore") - .AddModifiers(SyntaxKind.ProtectedKeyword, SyntaxKind.OverrideKeyword) - .AddParameterListParameters( - Parameter(Identifier("changes")).WithType(ParseTypeName("ChangeSet"))) - .WithBody(applyMethodBody)); - server = server.AddMembers(ConstructorDeclaration(serverName) .WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) .WithBody(serverStaticCtorBody)); @@ -408,26 +323,32 @@ namespace Avalonia.SourceGenerator.CompositionGenerator $"protected override void Activated(){{}}")!).WithBody(activatedBody)) .AddMembers(((MethodDeclarationSyntax)ParseMemberDeclaration( $"protected override void Deactivated(){{}}")!).WithBody(deactivatedBody)); + if (cl.Properties.Count > 0) + server = server.AddMembers(((MethodDeclarationSyntax)ParseMemberDeclaration( + $"protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt){{}}") + !) + .WithBody(deserializeMethodBody)); client = client.AddMembers( - MethodDeclaration(ParseTypeName("void"), "InitializeDefaults").WithBody(defaultsMethodBody)); - - transport = transport.AddMembers(MethodDeclaration(ParseTypeName("void"), "Reset") - .AddModifiers(SyntaxKind.PublicKeyword, SyntaxKind.OverrideKeyword) - .WithBody(resetBody.AddStatements( - ExpressionStatement(InvocationExpression(IdentifierName("ResetExtra"))), - ExpressionStatement(InvocationExpression(MemberAccess("base", "Reset")))))); - + MethodDeclaration(ParseTypeName("void"), "InitializeDefaults").WithBody(defaultsMethodBody)) + .AddMembers( + MethodDeclaration(ParseTypeName("void"), "InitializeDefaultsExtra") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); + + if (cl.Properties.Count > 0) + client = client.AddMembers(((MethodDeclarationSyntax)ParseMemberDeclaration( + $"private protected override void SerializeChangesCore(BatchStreamWriter writer){{}}")!) + .WithBody(serializeMethodBody)); + if (list != null) client = AppendListProxy(list, client); if (startAnimationBody.Statements.Count != 0) client = WithStartAnimation(client, startAnimationBody); - - client = WithGetProperty(client, getPropertyBody, false); - server = WithGetProperty(server, serverGetPropertyBody, true); + + server = WithGetPropertyForAnimation(server, serverGetPropertyBody); server = WithGetFieldOffset(server, serverGetFieldOffsetBody); - + if(cl.Implements.Count > 0) foreach (var impl in cl.Implements) { @@ -441,57 +362,121 @@ namespace Avalonia.SourceGenerator.CompositionGenerator } + SaveTo(unit.AddMembers(GenerateChangedFieldsEnum(cl)), "Transport", + ChangedFieldsTypeName(cl) + ".generated.cs"); + SaveTo(unit.AddMembers(clientNs.AddMembers(client)), cl.Name + ".generated.cs"); SaveTo(unit.AddMembers(serverNs.AddMembers(server)), "Server", "Server" + cl.Name + ".generated.cs"); - SaveTo(unit.AddMembers(transportNs.AddMembers(transport)), - "Transport", cl.Name + "Changes.generated.cs"); + } + + private ClassDeclarationSyntax GenerateClientProperty(ClassDeclarationSyntax client, GClass cl, GProperty prop, + TypeSyntax propType, bool isObject, bool isNullable) + { + var fieldName = PropertyBackingFieldName(prop); + return client + .AddMembers(DeclareField(prop.Type, fieldName)) + .AddMembers(PropertyDeclaration(propType, prop.Name) + .AddModifiers(SyntaxKind.PublicKeyword) + .AddAccessorListAccessors( + AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, + Block(ReturnStatement(IdentifierName(fieldName)))), + AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, + Block( + ParseStatement("var changed = false;"), + IfStatement(BinaryExpression(SyntaxKind.NotEqualsExpression, + IdentifierName(fieldName), + IdentifierName("value")), + Block( + ParseStatement("On" + prop.Name + "Changing();"), + ParseStatement("changed = true;"), + GeneratePropertySetterAssignment(cl, prop, isObject, isNullable)) + ), + ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, + IdentifierName(fieldName), IdentifierName("value"))), + ParseStatement($"if(changed) On" + prop.Name + "Changed();") + )).WithModifiers(TokenList(prop.InternalSet ? new[]{Token(SyntaxKind.InternalKeyword)} : Array.Empty())) + )) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changed") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())) + .AddMembers(MethodDeclaration(ParseTypeName("void"), "On" + prop.Name + "Changing") + .AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon())); } - StatementSyntax GeneratePropertySetterAssignment(GProperty prop, string fieldName, bool isObject, bool isNullable) + EnumDeclarationSyntax GenerateChangedFieldsEnum(GClass cl) { - var normalChangesAssignment = (StatementSyntax)ExpressionStatement(AssignmentExpression( - SyntaxKind.SimpleAssignmentExpression, - MemberAccess((ExpressionSyntax) IdentifierName("Changes"), prop.Name, - "Value"), - isObject - ? - ConditionalMemberAccess(IdentifierName("value"), "Server", isNullable) - : IdentifierName("value"))); - if (!prop.Animated) - return normalChangesAssignment; + var changedFieldsEnum = EnumDeclaration(Identifier(ChangedFieldsTypeName(cl))); + int count = 0; - var code = $@" -{{ - if(animation is CompositionAnimation a) - Changes.{prop.Name}.Animation = a.CreateInstance(this.Server, value); - else + void AddValue(string name) + { + var value = 1ul << count; + changedFieldsEnum = changedFieldsEnum.AddMembers( + EnumMemberDeclaration(name) + .WithEqualsValue(EqualsValueClause(ParseExpression(value.ToString())))); + count++; + } + + foreach (var prop in cl.Properties) + { + AddValue(prop.Name); + + if (prop.Animated) + AddValue(prop.Name + "Animated"); + } + + var baseType = count <= 8 ? "byte" : count <= 16 ? "ushort" : count <= 32 ? "uint" : "ulong"; + return changedFieldsEnum.AddBaseListTypes(SimpleBaseType(ParseTypeName(baseType))) + .AddAttributeLists(AttributeList(SingletonSeparatedList(Attribute(IdentifierName("System.Flags"))))); + } + + StatementSyntax GeneratePropertySetterAssignment(GClass cl, GProperty prop, bool isObject, bool isNullable) + { + var pendingAnimationField = PropertyPendingAnimationFieldName(prop); + + var code = @$" + // Update the backing value + {PropertyBackingFieldName(prop)} = value; + + // Register object for serialization in the next batch + {ChangedFieldsFieldName(cl)} |= {ChangedFieldsTypeName(cl)}.{prop.Name}; + RegisterForSerialization(); +"; + if (prop.Animated) + { + code += @$" + // Reset previous animation if any + {pendingAnimationField} = null; + {ChangedFieldsFieldName(cl)} &= ~{ChangedFieldsTypeName(cl)}.{prop.Name}Animated; + // Check for implicit animations + if(ImplicitAnimations != null && ImplicitAnimations.TryGetValue(""{prop.Name}"", out var animation) == true) {{ - var saved = Changes.{prop.Name}; - if(!StartAnimationGroup(animation, ""{prop.Name}"", value)) - Changes.{prop.Name}.Value = value; + // Animation affects only current property + if(animation is CompositionAnimation a) + {{ + {ChangedFieldsFieldName(cl)} |= {ChangedFieldsTypeName(cl)}.{prop.Name}Animated; + {pendingAnimationField} = a.CreateInstance(this.Server, value); + }} + // Animation is triggered by the current field, but does not necessary affects it + StartAnimationGroup(animation, ""{prop.Name}"", value); }} -}} - "; - - return IfStatement( - ParseExpression( - $"ImplicitAnimations != null && ImplicitAnimations.TryGetValue(\"{prop.Name}\", out var animation) == true"), - ParseStatement(code), - ElseClause(normalChangesAssignment) - ); + } + + return ParseStatement("{\n" + code + "\n}"); } - BlockSyntax ApplyStartAnimation(BlockSyntax body, GProperty prop, string fieldName) + BlockSyntax ApplyStartAnimation(BlockSyntax body, GClass cl, GProperty prop) { var code = $@" if (propertyName == ""{prop.Name}"") {{ -var current = {fieldName}; +var current = {PropertyBackingFieldName(prop)}; var server = animation.CreateInstance(this.Server, finalValue); -Changes.{prop.Name}.Animation = server; +{PropertyPendingAnimationFieldName(prop)} = server; +{ChangedFieldsFieldName(cl)} |= {ChangedFieldsTypeName(cl)}.{prop.Name}Animated; +RegisterForSerialization(); return; }} "; @@ -522,15 +507,75 @@ return; return body; } + + private BlockSyntax SerializeChangesPrologue(GClass cl) + { + return Block( + ParseStatement("base.SerializeChangesCore(writer);"), + ParseStatement($"writer.Write({ChangedFieldsFieldName(cl)});") + ); + } + + BlockSyntax ApplySerializeField(BlockSyntax body, GClass cl, GProperty prop, bool isObject, bool isPassthrough) + { + var changedFields = ChangedFieldsFieldName(cl); + var changedFieldsType = ChangedFieldsTypeName(cl); + + var code = ""; + if (prop.Animated) + { + code = $@" + if(({changedFields} & {changedFieldsType}.{prop.Name}Animated) == {changedFieldsType}.{prop.Name}Animated) + writer.WriteObject({PropertyPendingAnimationFieldName(prop)}); + else "; + } + + code += $@" + if(({changedFields} & {changedFieldsType}.{prop.Name}) == {changedFieldsType}.{prop.Name}) + writer.Write{(isObject ? "Object" : "")}({PropertyBackingFieldName(prop)}{(isObject && !isPassthrough ? "?.Server!":"")}); +"; + return body.AddStatements(ParseStatement(code)); + } + + private BlockSyntax DeserializeChangesPrologue(GClass cl) + { + return Block(ParseStatement($@" +base.DeserializeChangesCore(reader, commitedAt); +DeserializeChangesExtra(reader); +var changed = reader.Read<{ChangedFieldsTypeName(cl)}>(); +")); + } + + BlockSyntax ApplyDeserializeField(BlockSyntax body, GClass cl, GProperty prop, string serverType, bool isObject) + { + var changedFieldsType = ChangedFieldsTypeName(cl); + var code = ""; + if (prop.Animated) + { + code = $@" + if((changed & {changedFieldsType}.{prop.Name}Animated) == {changedFieldsType}.{prop.Name}Animated) + {PropertyBackingFieldName(prop)}.SetAnimation(this, commitedAt, reader.ReadObject(), {ServerPropertyOffsetFieldName(prop)}); + else "; + } + + var readValueCode = $"reader.Read{(isObject ? "Object" : "")}<{serverType}>()"; + code += $@" + if((changed & {changedFieldsType}.{prop.Name}) == {changedFieldsType}.{prop.Name}) +"; + if (prop.Animated) + code += $"{PropertyBackingFieldName(prop)}.SetValue(this, {readValueCode});"; + else code += $"{prop.Name} = {readValueCode};"; + return body.AddStatements(ParseStatement(code)); + } - ClassDeclarationSyntax WithGetProperty(ClassDeclarationSyntax cl, BlockSyntax body, bool server) + ClassDeclarationSyntax WithGetPropertyForAnimation(ClassDeclarationSyntax cl, BlockSyntax body) { if (body.Statements.Count == 0) return cl; body = body.AddStatements( ParseStatement("return base.GetPropertyForAnimation(name);")); var method = ((MethodDeclarationSyntax) ParseMemberDeclaration( - $"{(server ? "public" : "internal")} override Avalonia.Rendering.Composition.Expressions.ExpressionVariant GetPropertyForAnimation(string name){{}}")) + $"public override Avalonia.Rendering.Composition.Expressions.ExpressionVariant GetPropertyForAnimation(string name){{}}")) .WithBody(body); return cl.AddMembers(method); diff --git a/src/Avalonia.X11/X11Platform.cs b/src/Avalonia.X11/X11Platform.cs index 7a64b39575..9c82288c8e 100644 --- a/src/Avalonia.X11/X11Platform.cs +++ b/src/Avalonia.X11/X11Platform.cs @@ -104,7 +104,7 @@ namespace Avalonia.X11 } if (options.UseCompositor) - Compositor = Compositor.Create(AvaloniaLocator.Current.GetService()!); + Compositor = new Compositor(AvaloniaLocator.Current.GetService()!); } diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 32705a2cc6..4b0350f40f 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -188,7 +188,7 @@ namespace Avalonia.Win32 AvaloniaLocator.CurrentMutable.Bind().ToSingleton(); if (Options.UseCompositor) - Compositor = Compositor.Create(AvaloniaLocator.Current.GetRequiredService()); + Compositor = new Compositor(AvaloniaLocator.Current.GetRequiredService()); } public bool HasMessages() diff --git a/tests/Avalonia.Base.UnitTests/Composition/BatchStreamTests.cs b/tests/Avalonia.Base.UnitTests/Composition/BatchStreamTests.cs new file mode 100644 index 0000000000..a1b55257e6 --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Composition/BatchStreamTests.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks.Dataflow; +using Avalonia.Rendering.Composition.Transport; +using Xunit; + +namespace Avalonia.Base.UnitTests.Composition; + +public class BatchStreamTests +{ + [Fact] + public void BatchStreamCorrectlyWritesAndReadsData() + { + var data = new BatchStreamData(); + var memPool = new BatchStreamMemoryPool(100, _ => { }); + var objPool = new BatchStreamObjectPool(10, _ => { }); + + var guids = new List(); + var objects = new List(); + for (var c = 0; c < 453; c++) + { + guids.Add(Guid.NewGuid()); + objects.Add(new object()); + } + + using (var writer = new BatchStreamWriter(data, memPool, objPool)) + { + foreach(var guid in guids) + writer.Write(guid); + foreach (var obj in objects) + writer.WriteObject(obj); + } + + using (var reader = new BatchStreamReader(data, memPool, objPool)) + { + foreach (var guid in guids) + Assert.Equal(guid, reader.Read()); + foreach (var obj in objects) + Assert.Equal(obj, reader.ReadObject()); + } + + + + } +} \ No newline at end of file From 2d8be0dff68dc4036bc6e8b5c40894f0367e6271 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 21:51:40 +0300 Subject: [PATCH 056/393] Fixes --- .../Composition/Transport/BatchStreamArrayPool.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs index d76a9c609e..97d05704af 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs @@ -51,11 +51,12 @@ internal abstract class BatchStreamPoolBase : IDisposable { var maximumUsage = _usageStatistics.Max(); var recentlyUsedPooledSlots = maximumUsage - _usage; - while (recentlyUsedPooledSlots < _pool.Count) + var keepSlots = Math.Max(recentlyUsedPooledSlots, 10); + while (keepSlots < _pool.Count) DestroyItem(_pool.Pop()); - _usageStatistics[_usageStatisticsSlot] = 0; _usageStatisticsSlot = (_usageStatisticsSlot + 1) % _usageStatistics.Length; + _usageStatistics[_usageStatisticsSlot] = 0; } } @@ -137,7 +138,7 @@ internal sealed class BatchStreamMemoryPool : BatchStreamPoolBase { public int BufferSize { get; } - public BatchStreamMemoryPool(int bufferSize = 16384, Action>? startTimer = null) : base(true, startTimer) + public BatchStreamMemoryPool(int bufferSize = 1024, Action>? startTimer = null) : base(true, startTimer) { BufferSize = bufferSize; } From dbbed2c70bcb7abff176edffa7a7b045a0dd914d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 23:14:13 +0300 Subject: [PATCH 057/393] Added Dispose for CompositionTarget --- .../Composition/CompositionObject.cs | 5 ++-- .../Server/ServerCompositionTarget.cs | 27 ++++++++++++++++++- .../Composition/Server/ServerCompositor.cs | 2 ++ .../Composition/Server/ServerObject.cs | 4 ++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs index d561338a36..baf1bfcddf 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionObject.cs @@ -25,7 +25,7 @@ namespace Avalonia.Rendering.Composition public void Dispose() { - //Changes.Dispose = true; + RegisterForSerialization(); IsDisposed = true; } @@ -112,7 +112,8 @@ namespace Avalonia.Rendering.Composition private protected virtual void SerializeChangesCore(BatchStreamWriter writer) { - + if (Server is IDisposable) + writer.Write((byte)(IsDisposed ? 1 : 0)); } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index 7567eba534..9513fb58fa 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -9,7 +9,7 @@ using Avalonia.Utilities; namespace Avalonia.Rendering.Composition.Server { - internal partial class ServerCompositionTarget + internal partial class ServerCompositionTarget : IDisposable { private readonly ServerCompositor _compositor; private readonly Func _renderTargetFactory; @@ -23,6 +23,7 @@ namespace Avalonia.Rendering.Composition.Server private Size _layerSize; private IDrawingContextLayerImpl? _layer; private bool _redrawRequested; + private bool _disposed; public ReadbackIndices Readback { get; } = new(); @@ -50,6 +51,12 @@ namespace Avalonia.Rendering.Composition.Server public void Render() { + if (_disposed) + { + Compositor.RemoveCompositionTarget(this); + return; + } + if (Root == null) return; _renderTarget ??= _renderTargetFactory(); @@ -69,6 +76,12 @@ namespace Avalonia.Rendering.Composition.Server _redrawRequested = false; using (var targetContext = _renderTarget.CreateDrawingContext(null)) { + // This is a hack to safely dispose layer created by some other render target + // because we can only dispose layers with the corresponding GPU context being + // active on the current thread + while (Compositor.LayersToDispose.Count > 0) + Compositor.LayersToDispose.Dequeue().Dispose(); + var layerSize = Size * Scaling; if (layerSize != _layerSize || _layer == null) { @@ -130,5 +143,17 @@ namespace Avalonia.Rendering.Composition.Server { _redrawRequested = true; } + + public void Dispose() + { + _disposed = true; + if (_layer != null) + { + Compositor.LayersToDispose.Enqueue(_layer); + _layer = null; + } + _renderTarget?.Dispose(); + _renderTarget = null; + } } } \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs index f7de704b23..241be479ff 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using Avalonia.Platform; using Avalonia.Rendering.Composition.Animations; using Avalonia.Rendering.Composition.Expressions; using Avalonia.Rendering.Composition.Transport; @@ -19,6 +20,7 @@ namespace Avalonia.Rendering.Composition.Server private List _animationsToUpdate = new(); private BatchStreamObjectPool _batchObjectPool; private BatchStreamMemoryPool _batchMemoryPool; + public Queue LayersToDispose { get; } = new(); public ServerCompositor(IRenderLoop renderLoop, BatchStreamObjectPool batchObjectPool, BatchStreamMemoryPool batchMemoryPool) { diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs index 16f57d9059..dde711c3b5 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs @@ -107,7 +107,9 @@ namespace Avalonia.Rendering.Composition.Server protected virtual void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt) { - + if (this is IDisposable disp + && reader.Read() == 1) + disp.Dispose(); } public void DeserializeChanges(BatchStreamReader reader, Batch batch) From 7790a513065b0e91676ba675bea4587ff428d402 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 26 May 2022 23:15:39 +0300 Subject: [PATCH 058/393] Fixed hittest filtering --- .../Rendering/Composition/CompositingRenderer.cs | 6 +++--- .../Composition/CompositionDrawListVisual.cs | 6 +++++- .../Rendering/Composition/CompositionTarget.cs | 13 ++++++++----- src/Avalonia.Base/Rendering/Composition/Visual.cs | 4 +++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs index 88c6948e48..b83f804a8f 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs @@ -65,9 +65,9 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor QueueUpdate(); } - public IEnumerable HitTest(Point p, IVisual root, Func filter) + public IEnumerable HitTest(Point p, IVisual root, Func? filter) { - var res = _target.TryHitTest(p); + var res = _target.TryHitTest(p, filter); if(res == null) yield break; for (var index = res.Count - 1; index >= 0; index--) @@ -81,7 +81,7 @@ public class CompositingRenderer : RendererBase, IRendererWithCompositor } } - public IVisual? HitTestFirst(Point p, IVisual root, Func filter) + public IVisual? HitTestFirst(Point p, IVisual root, Func? filter) { // TODO: Optimize return HitTest(p, root, filter).FirstOrDefault(); diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs index 069d888fbb..cc2b411822 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -1,7 +1,9 @@ +using System; using System.Numerics; using Avalonia.Rendering.Composition.Drawing; using Avalonia.Rendering.Composition.Server; using Avalonia.Rendering.Composition.Transport; +using Avalonia.VisualTree; namespace Avalonia.Rendering.Composition; @@ -39,10 +41,12 @@ internal class CompositionDrawListVisual : CompositionContainerVisual Visual = visual; } - internal override bool HitTest(Point pt) + internal override bool HitTest(Point pt, Func? filter) { if (DrawList == null) return false; + if (filter != null && !filter(Visual)) + return false; if (Visual is ICustomHitTest custom) return custom.HitTest(pt); foreach (var op in DrawList) diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs index c5cfaeacce..3243934932 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using System.Numerics; using Avalonia.Collections.Pooled; +using Avalonia.VisualTree; namespace Avalonia.Rendering.Composition { @@ -18,13 +20,13 @@ namespace Avalonia.Rendering.Composition Root.Root = null; } - public PooledList? TryHitTest(Point point) + public PooledList? TryHitTest(Point point, Func? filter) { Server.Readback.NextRead(); if (Root == null) return null; var res = new PooledList(); - HitTestCore(Root, point, res); + HitTestCore(Root, point, res, filter); return res; } @@ -69,7 +71,8 @@ namespace Avalonia.Rendering.Composition return false; } - bool HitTestCore(CompositionVisual visual, Point point, PooledList result) + bool HitTestCore(CompositionVisual visual, Point point, PooledList result, + Func? filter) { //TODO: Check readback too if (visual.Visible == false) @@ -80,7 +83,7 @@ namespace Avalonia.Rendering.Composition { bool success = false; // Hit-test the current node - if (visual.HitTest(point)) + if (visual.HitTest(point, filter)) { result.Add(visual); success = true; @@ -91,7 +94,7 @@ namespace Avalonia.Rendering.Composition for (var c = cv.Children.Count - 1; c >= 0; c--) { var ch = cv.Children[c]; - var hit = HitTestCore(ch, point, result); + var hit = HitTestCore(ch, point, result, filter); if (hit) return true; } diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index 5bf5dcee74..3d6e3fdaeb 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -1,4 +1,6 @@ +using System; using System.Numerics; +using Avalonia.VisualTree; namespace Avalonia.Rendering.Composition { @@ -33,6 +35,6 @@ namespace Avalonia.Rendering.Composition internal object? Tag { get; set; } - internal virtual bool HitTest(Point point) => true; + internal virtual bool HitTest(Point point, Func? filter) => true; } } \ No newline at end of file From 51789f56a629ead42483d3cacfedca229374ac9d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 27 May 2022 01:20:53 -0400 Subject: [PATCH 059/393] Bring back mmap for linux as discussed --- .../Platform/Internal/UnmanagedBlob.cs | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs index ed0862c06c..a56d9ffd1c 100644 --- a/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs +++ b/src/Avalonia.Base/Platform/Internal/UnmanagedBlob.cs @@ -40,7 +40,7 @@ internal class UnmanagedBlob : IUnmanagedBlob { if (size <= 0) throw new ArgumentException("Positive number required", nameof(size)); - _address = Marshal.AllocHGlobal(size); + _address = Alloc(size); GC.AddMemoryPressure(size); Size = size; } @@ -66,7 +66,7 @@ internal class UnmanagedBlob : IUnmanagedBlob lock (_btlock) Backtraces.Remove(_backtrace); #endif - Marshal.FreeHGlobal(_address); + Free(_address, Size); GC.RemoveMemoryPressure(Size); IsDisposed = true; _address = IntPtr.Zero; @@ -106,4 +106,50 @@ internal class UnmanagedBlob : IUnmanagedBlob public IntPtr Address => IsDisposed ? throw new ObjectDisposedException("UnmanagedBlob") : _address; public int Size { get; private set; } public bool IsDisposed { get; private set; } + + [DllImport("libc", SetLastError = true)] + private static extern IntPtr mmap(IntPtr addr, IntPtr length, int prot, int flags, int fd, IntPtr offset); + [DllImport("libc", SetLastError = true)] + private static extern int munmap(IntPtr addr, IntPtr length); + [DllImport("libc", SetLastError = true)] + private static extern long sysconf(int name); + + private bool? _useMmap; + private bool UseMmap + => _useMmap ?? ((_useMmap = RuntimeInformation.IsOSPlatform(OSPlatform.Linux)).Value); + + // Could be replaced with https://github.com/dotnet/runtime/issues/40892 when it will be available. + private IntPtr Alloc(int size) + { + if (!UseMmap) + { + return Marshal.AllocHGlobal(size); + } + else + { + var rv = mmap(IntPtr.Zero, new IntPtr(size), 3, 0x22, -1, IntPtr.Zero); + if (rv.ToInt64() == -1 || (ulong)rv.ToInt64() == 0xffffffff) + { + var errno = Marshal.GetLastWin32Error(); + throw new Exception("Unable to allocate memory: " + errno); + } + return rv; + } + } + + private void Free(IntPtr ptr, int len) + { + if (!UseMmap) + { + Marshal.FreeHGlobal(ptr); + } + else + { + if (munmap(ptr, new IntPtr(len)) == -1) + { + var errno = Marshal.GetLastWin32Error(); + throw new Exception("Unable to free memory: " + errno); + } + } + } } From fcb7d254f9d0f147dd85c38200a3ebd896c65b3c Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 20 May 2022 00:01:21 -0400 Subject: [PATCH 060/393] Add IColorPalette --- .../ColorPalette/IColorPalette.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs new file mode 100644 index 0000000000..7c6ebc3f6a --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs @@ -0,0 +1,38 @@ +using Avalonia.Media; + +namespace Avalonia.Controls +{ + /// + /// Interface to define a color palette. + /// + public interface IColorPalette + { + /// + /// Gets the total number of colors in this palette. + /// A color is not necessarily a single value and may be composed of several shades. + /// + /// + /// Represents total columns in a table. + /// + int ColorCount { get; } + + /// + /// Gets the total number of shades for each color in this palette. + /// Shades are usually a variation of the color lightening or darkening it. + /// + /// + /// Represents total rows in a table. + /// + int ShadeCount { get; } + + /// + /// Gets a color in the palette by index. + /// + /// The index of the color in the palette. + /// The index must be between zero and . + /// The index of the color shade in the palette. + /// The index must be between zero and . + /// The color at the specified index or an exception. + Color GetColor(int colorIndex, int shadeIndex); + } +} From fa5a47b4426d32a00b01233540e25342f2013646 Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 20 May 2022 00:01:44 -0400 Subject: [PATCH 061/393] Add initial ColorView.Properties --- .../ColorSpectrum/ColorSpectrum.Properties.cs | 2 +- .../ColorView/ColorView.Properties.cs | 362 ++++++++++++++++++ .../ColorView/ColorView.cs | 21 + 3 files changed, 384 insertions(+), 1 deletion(-) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs create mode 100644 src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.Properties.cs index 587a89ee38..00d84f5dd3 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSpectrum/ColorSpectrum.Properties.cs @@ -97,7 +97,7 @@ namespace Avalonia.Controls.Primitives /// Gets or sets the currently selected color in the RGB color model. /// /// - /// For control authors use instead to avoid loss + /// For control authors, use instead to avoid loss /// of precision and color drifting. /// public Color Color diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs new file mode 100644 index 0000000000..aa5dfb5fc4 --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -0,0 +1,362 @@ +using System.Collections.ObjectModel; +using Avalonia.Controls.Primitives; +using Avalonia.Data; +using Avalonia.Media; + +namespace Avalonia.Controls +{ + public partial class ColorView + { + // SelectedColorModel ActiveColorModel? + // SelectedTab + + /// + /// Defines the property. + /// + public static readonly StyledProperty ColorProperty = + AvaloniaProperty.Register( + nameof(Color), + Colors.White, + defaultBindingMode: BindingMode.TwoWay); + + /// + /// Defines the property. + /// + public static readonly StyledProperty ColorSpectrumComponentsProperty = + AvaloniaProperty.Register( + nameof(ColorSpectrumComponents), + ColorSpectrumComponents.HueSaturation); + + /// + /// Defines the property. + /// + public static readonly StyledProperty ColorSpectrumShapeProperty = + AvaloniaProperty.Register( + nameof(ColorSpectrumShape), + ColorSpectrumShape.Box); + + /// + /// Defines the property. + /// + public static readonly DirectProperty> CustomPaletteColorsProperty = + AvaloniaProperty.RegisterDirect>( + nameof(CustomPaletteColors), + o => o.CustomPaletteColors); + + /// + /// Defines the property. + /// + public static readonly StyledProperty CustomPaletteColumnCountProperty = + AvaloniaProperty.Register( + nameof(CustomPaletteColumnCount), + 4); + + /// + /// Defines the property. + /// + public static readonly StyledProperty CustomPaletteProperty = + AvaloniaProperty.Register( + nameof(CustomPalette), + null); + + /// + /// Defines the property. + /// + public static readonly StyledProperty HsvColorProperty = + AvaloniaProperty.Register( + nameof(HsvColor), + Colors.White.ToHsv(), + defaultBindingMode: BindingMode.TwoWay); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsAlphaEnabledProperty = + AvaloniaProperty.Register( + nameof(IsAlphaEnabled), + false); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsAlphaSliderVisibleProperty = + AvaloniaProperty.Register( + nameof(IsAlphaSliderVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsAlphaTextInputVisibleProperty = + AvaloniaProperty.Register( + nameof(IsAlphaTextInputVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorChannelTextInputVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorChannelTextInputVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorPaletteVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorPaletteVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorPreviewVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorPreviewVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorSliderVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorSliderVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorSpectrumVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorSpectrumVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty IsHexInputVisibleProperty = + AvaloniaProperty.Register( + nameof(IsHexInputVisible), + true); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MaxHueProperty = + AvaloniaProperty.Register( + nameof(MaxHue), + 359); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MaxSaturationProperty = + AvaloniaProperty.Register( + nameof(MaxSaturation), + 100); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MaxValueProperty = + AvaloniaProperty.Register( + nameof(MaxValue), + 100); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MinHueProperty = + AvaloniaProperty.Register( + nameof(MinHue), + 0); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MinSaturationProperty = + AvaloniaProperty.Register( + nameof(MinSaturation), + 0); + + /// + /// Defines the property. + /// + public static readonly StyledProperty MinValueProperty = + AvaloniaProperty.Register( + nameof(MinValue), + 0); + + /// + /// Defines the property. + /// + public static readonly StyledProperty ShowAccentColorsProperty = + AvaloniaProperty.Register( + nameof(ShowAccentColors), + true); + + /// + public Color Color + { + get => GetValue(ColorProperty); + set => SetValue(ColorProperty, value); + } + + /// + public ColorSpectrumComponents ColorSpectrumComponents + { + get => GetValue(ColorSpectrumComponentsProperty); + set => SetValue(ColorSpectrumComponentsProperty, value); + } + + /// + public ColorSpectrumShape ColorSpectrumShape + { + get => GetValue(ColorSpectrumShapeProperty); + set => SetValue(ColorSpectrumShapeProperty, value); + } + + /// + /// Gets the list of custom palette colors. + /// + public ObservableCollection CustomPaletteColors + { + get => _customPaletteColors; + } + + /// + /// Gets or sets the number of colors in each row (section) of the custom color palette. + /// Within a standard palette, rows are shades and columns are colors. + /// + public int CustomPaletteColumnCount + { + get => GetValue(CustomPaletteColumnCountProperty); + set => SetValue(CustomPaletteColumnCountProperty, value); + } + + /// + /// Gets or sets the custom color palette. + /// This will automatically set and + /// overwriting any existing values. + /// + public IColorPalette? CustomPalette + { + get => GetValue(CustomPaletteProperty); + set => SetValue(CustomPaletteProperty, value); + } + + /// + public HsvColor HsvColor + { + get => GetValue(HsvColorProperty); + set => SetValue(HsvColorProperty, value); + } + + public bool IsAlphaEnabled + { + get => GetValue(IsAlphaEnabledProperty); + set => SetValue(IsAlphaEnabledProperty, value); + } + + public bool IsAlphaSliderVisible + { + get => GetValue(IsAlphaSliderVisibleProperty); + set => SetValue(IsAlphaSliderVisibleProperty, value); + } + + public bool IsAlphaTextInputVisible + { + get => GetValue(IsAlphaTextInputVisibleProperty); + set => SetValue(IsAlphaTextInputVisibleProperty, value); + } + + public bool IsColorChannelTextInputVisible // TODO: Component + { + get => GetValue(IsColorChannelTextInputVisibleProperty); + set => SetValue(IsColorChannelTextInputVisibleProperty, value); + } + + /// + /// Gets or sets a value indicating whether the color palette is visible. + /// + public bool IsColorPaletteVisible + { + get => GetValue(IsColorPaletteVisibleProperty); + set => SetValue(IsColorPaletteVisibleProperty, value); + } + + public bool IsColorPreviewVisible + { + get => GetValue(IsColorPreviewVisibleProperty); + set => SetValue(IsColorPreviewVisibleProperty, value); + } + + public bool IsColorSliderVisible + { + get => GetValue(IsColorSliderVisibleProperty); + set => SetValue(IsColorSliderVisibleProperty, value); + } + + public bool IsColorSpectrumVisible + { + get => GetValue(IsColorSpectrumVisibleProperty); + set => SetValue(IsColorSpectrumVisibleProperty, value); + } + + public bool IsHexInputVisible + { + get => GetValue(IsHexInputVisibleProperty); + set => SetValue(IsHexInputVisibleProperty, value); + } + + /// + public int MaxHue + { + get => GetValue(MaxHueProperty); + set => SetValue(MaxHueProperty, value); + } + + /// + public int MaxSaturation + { + get => GetValue(MaxSaturationProperty); + set => SetValue(MaxSaturationProperty, value); + } + + /// + public int MaxValue + { + get => GetValue(MaxValueProperty); + set => SetValue(MaxValueProperty, value); + } + + /// + public int MinHue + { + get => GetValue(MinHueProperty); + set => SetValue(MinHueProperty, value); + } + + /// + public int MinSaturation + { + get => GetValue(MinSaturationProperty); + set => SetValue(MinSaturationProperty, value); + } + + /// + public int MinValue + { + get => GetValue(MinValueProperty); + set => SetValue(MinValueProperty, value); + } + + /// + public bool ShowAccentColors + { + get => GetValue(ShowAccentColorsProperty); + set => SetValue(ShowAccentColorsProperty, value); + } + } +} diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs new file mode 100644 index 0000000000..3aff4614a5 --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Avalonia.Controls.Primitives; +using Avalonia.Media; + +namespace Avalonia.Controls +{ + /// + /// Presents a color for user editing using a spectrum, palette and component sliders. + /// + public partial class ColorView : TemplatedControl + { + private ObservableCollection _customPaletteColors = new ObservableCollection(); + + + } +} From d3bad7bd1d5612901ff0f3f74080ca5349091228 Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 20 May 2022 00:01:55 -0400 Subject: [PATCH 062/393] Add ColorViewTab enum --- .../ColorView/ColorViewTab.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs new file mode 100644 index 0000000000..d8c7d5163c --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs @@ -0,0 +1,23 @@ +namespace Avalonia.Controls +{ + /// + /// Defines a specific tab (subview) within the . + /// + public enum ColorViewTab + { + /// + /// The components view with sliders and numeric input boxes. + /// + Components, + + /// + /// The color palette view with a grid of colors and shades. + /// + Palette, + + /// + /// The color spectrum view with a box/ring spectrum and sliders. + /// + Spectrum, + } +} From 77e36914d4c5bb49e12c8a79bb7d5de30a71f19c Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 22 May 2022 12:06:58 -0400 Subject: [PATCH 063/393] Add FluentColorPalette --- .../ColorPalette/FluentColorPalette.cs | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs new file mode 100644 index 0000000000..89400280a9 --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs @@ -0,0 +1,142 @@ +using Avalonia.Media; +using Avalonia.Utilities; + +namespace Avalonia.Controls +{ + /// + /// Implements the standard Windows 10 color palette. + /// + public class FluentColorPalette : IColorPalette + { + // Values were taken from the Settings App, Personalization > Colors which match with + // https://docs.microsoft.com/en-us/windows/uwp/whats-new/windows-docs-december-2017 + // + // The default ordering and grouping of colors was undesirable so was modified. + // Colors were transposed: the colors in rows within the Settings app became columns here. + // This is because columns in an IColorPalette generally should contain different shades of + // the same color. In the settings app this concept is somewhat loosely reversed. + // The first 'column' ordering, after being transposed, was then reversed so 'red' colors + // were near to each other. + // + // This new ordering most closely follows the Windows standard while: + // + // 1. Keeping colors in a 'spectrum' order + // 2. Keeping like colors next to each both in rows and columns + // (which is unique for the windows palette). + // For example, similar red colors are next to each other in both + // rows within the same column and rows within the column next to it. + // This follows a 'snake-like' pattern as illustrated below. + // 3. A downside of this ordering is colors don't follow strict 'shades' + // as in other palettes. + // + // The colors will be displayed in the below pattern. + // This pattern follows a spectrum while keeping like-colors near to one + // another across both rows and columns. + // + // ┌Red───┐ ┌Blue──┐ ┌Gray──┐ + // │ │ │ │ │ | + // │ │ │ │ │ | + // Yellow └Violet┘ └Green─┘ Brown + + private static Color[,] colorChart = new Color[,] + { + { + // Ordering reversed for this section only + Color.FromArgb(255, 255, 67, 67), /* #FF4343 */ + Color.FromArgb(255, 209, 52, 56), /* #D13438 */ + Color.FromArgb(255, 239, 105, 80), /* #EF6950 */ + Color.FromArgb(255, 218, 59, 1), /* #DA3B01 */ + Color.FromArgb(255, 202, 80, 16), /* #CA5010 */ + Color.FromArgb(255, 247, 99, 12), /* #F7630C */ + Color.FromArgb(255, 255, 140, 0), /* #FF8C00 */ + Color.FromArgb(255, 255, 185, 0), /* #FFB900 */ + }, + { + Color.FromArgb(255, 231, 72, 86), /* #E74856 */ + Color.FromArgb(255, 232, 17, 35), /* #E81123 */ + Color.FromArgb(255, 234, 0, 94), /* #EA005E */ + Color.FromArgb(255, 195, 0, 82), /* #C30052 */ + Color.FromArgb(255, 227, 0, 140), /* #E3008C */ + Color.FromArgb(255, 191, 0, 119), /* #BF0077 */ + Color.FromArgb(255, 194, 57, 179), /* #C239B3 */ + Color.FromArgb(255, 154, 0, 137), /* #9A0089 */ + }, + { + Color.FromArgb(255, 0, 120, 215), /* #0078D7 */ + Color.FromArgb(255, 0, 99, 177), /* #0063B1 */ + Color.FromArgb(255, 142, 140, 216), /* #8E8CD8 */ + Color.FromArgb(255, 107, 105, 214), /* #6B69D6 */ + Color.FromArgb(255, 135, 100, 184), /* #8764B8 */ + Color.FromArgb(255, 116, 77, 169), /* #744DA9 */ + Color.FromArgb(255, 177, 70, 194), /* #B146C2 */ + Color.FromArgb(255, 136, 23, 152), /* #881798 */ + }, + { + Color.FromArgb(255, 0, 153, 188), /* #0099BC */ + Color.FromArgb(255, 45, 125, 154), /* #2D7D9A */ + Color.FromArgb(255, 0, 183, 195), /* #00B7C3 */ + Color.FromArgb(255, 3, 131, 135), /* #038387 */ + Color.FromArgb(255, 0, 178, 148), /* #00B294 */ + Color.FromArgb(255, 1, 133, 116), /* #018574 */ + Color.FromArgb(255, 0, 204, 106), /* #00CC6A */ + Color.FromArgb(255, 16, 137, 62), /* #10893E */ + }, + { + Color.FromArgb(255, 122, 117, 116), /* #7A7574 */ + Color.FromArgb(255, 93, 90, 80), /* #5D5A58 */ + Color.FromArgb(255, 104, 118, 138), /* #68768A */ + Color.FromArgb(255, 81, 92, 107), /* #515C6B */ + Color.FromArgb(255, 86, 124, 115), /* #567C73 */ + Color.FromArgb(255, 72, 104, 96), /* #486860 */ + Color.FromArgb(255, 73, 130, 5), /* #498205 */ + Color.FromArgb(255, 16, 124, 16), /* #107C10 */ + }, + { + Color.FromArgb(255, 118, 118, 118), /* #767676 */ + Color.FromArgb(255, 76, 74, 72), /* #4C4A48 */ + Color.FromArgb(255, 105, 121, 126), /* #69797E */ + Color.FromArgb(255, 74, 84, 89), /* #4A5459 */ + Color.FromArgb(255, 100, 124, 100), /* #647C64 */ + Color.FromArgb(255, 82, 94, 84), /* #525E54 */ + Color.FromArgb(255, 132, 117, 69), /* #847545 */ + Color.FromArgb(255, 126, 115, 95), /* #7E735F */ + } + }; + + /// + /// Gets the index of the default shade of colors in this palette. + /// This has little meaning in this palette as colors are not strictly separated by shade. + /// + public const int DefaultShadeIndex = 0; + + /// + /// Gets the total number of colors in this palette. + /// A color is not necessarily a single value and may be composed of several shades. + /// This has little meaning in this palette as colors are not strictly separated. + /// + /// + public int ColorCount + { + get => colorChart.GetLength(0); + } + + /// + /// Gets the total number of shades for each color in this palette. + /// Shades are usually a variation of the color lightening or darkening it. + /// This has little meaning in this palette as colors are not strictly separated by shade. + /// + /// + public int ShadeCount + { + get => colorChart.GetLength(1); + } + + /// + public Color GetColor(int colorIndex, int shadeIndex) + { + return colorChart[ + MathUtilities.Clamp(colorIndex, 0, colorChart.GetLength(0)), + MathUtilities.Clamp(shadeIndex, 0, colorChart.GetLength(1))]; + } + } +} From 33637f651a3456f7791dbe01f3e16c79fd0725d6 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 22 May 2022 12:07:09 -0400 Subject: [PATCH 064/393] Fix ColorToHexConverter --- .../Converters/ColorToHexConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls.ColorPicker/Converters/ColorToHexConverter.cs b/src/Avalonia.Controls.ColorPicker/Converters/ColorToHexConverter.cs index 9b09073d9d..8d5f2332be 100644 --- a/src/Avalonia.Controls.ColorPicker/Converters/ColorToHexConverter.cs +++ b/src/Avalonia.Controls.ColorPicker/Converters/ColorToHexConverter.cs @@ -42,7 +42,7 @@ namespace Avalonia.Controls.Converters return AvaloniaProperty.UnsetValue; } - string hexColor = color.ToString(); + string hexColor = color.ToUint32().ToString("x8", CultureInfo.InvariantCulture).ToUpperInvariant(); if (includeSymbol == false) { From 2835767b42ddfc23d40e64c34ea0719312ab8586 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 22 May 2022 12:09:28 -0400 Subject: [PATCH 065/393] Add incomplete ColorView control template --- .../ControlCatalog/Pages/ColorPickerPage.xaml | 9 +- .../ColorView/ColorView.Properties.cs | 4 +- .../ColorView/ColorView.cs | 86 ++++++ .../ColorView/ColorViewTab.cs | 6 +- .../Themes/Fluent/ColorView.xaml | 259 ++++++++++++++++++ .../Themes/Fluent/Fluent.xaml | 3 + 6 files changed, 360 insertions(+), 7 deletions(-) create mode 100644 src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml diff --git a/samples/ControlCatalog/Pages/ColorPickerPage.xaml b/samples/ControlCatalog/Pages/ColorPickerPage.xaml index c0c83d6a35..47a407821c 100644 --- a/samples/ControlCatalog/Pages/ColorPickerPage.xaml +++ b/samples/ControlCatalog/Pages/ColorPickerPage.xaml @@ -13,8 +13,11 @@ - - + + - diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index aa5dfb5fc4..eddbeaf112 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -292,7 +292,9 @@ namespace Avalonia.Controls set => SetValue(IsColorPreviewVisibleProperty, value); } - public bool IsColorSliderVisible + // IsColorComponentsVisible + + public bool IsColorSliderVisible // ColorSpectrumSlider { get => GetValue(IsColorSliderVisibleProperty); set => SetValue(IsColorSliderVisibleProperty, value); diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 3aff4614a5..76e3cfe3e1 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -14,8 +14,94 @@ namespace Avalonia.Controls /// public partial class ColorView : TemplatedControl { + /// + /// Event for when the selected color changes within the slider. + /// + public event EventHandler? ColorChanged; + + private bool disableUpdates = false; + private ObservableCollection _customPaletteColors = new ObservableCollection(); + /// + /// Initializes a new instance of the class. + /// + public ColorView() : base() + { + } + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + this.CustomPalette = new FluentColorPalette(); + + base.OnApplyTemplate(e); + } + + /// + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + if (disableUpdates) + { + base.OnPropertyChanged(change); + return; + } + + // Always keep the two color properties in sync + if (change.Property == ColorProperty) + { + disableUpdates = true; + + HsvColor = Color.ToHsv(); + + OnColorChanged(new ColorChangedEventArgs( + change.GetOldValue(), + change.GetNewValue())); + + disableUpdates = false; + } + else if (change.Property == HsvColorProperty) + { + disableUpdates = true; + + Color = HsvColor.ToRgb(); + + OnColorChanged(new ColorChangedEventArgs( + change.GetOldValue().ToRgb(), + change.GetNewValue().ToRgb())); + + disableUpdates = false; + } + else if (change.Property == CustomPaletteProperty) + { + IColorPalette? palette = CustomPalette; + + // Any custom palette change must be automatically synced with the + // bound properties controlling the palette grid + if (palette != null) + { + CustomPaletteColumnCount = palette.ColorCount; + CustomPaletteColors.Clear(); + + for (int shadeIndex = 0; shadeIndex < palette.ShadeCount; shadeIndex++) + { + for (int colorIndex = 0; colorIndex < palette.ColorCount; colorIndex++) + { + CustomPaletteColors.Add(palette.GetColor(colorIndex, shadeIndex)); + } + } + } + } + + base.OnPropertyChanged(change); + } + /// + /// Called before the event occurs. + /// + /// The defining old/new colors. + protected virtual void OnColorChanged(ColorChangedEventArgs e) + { + ColorChanged?.Invoke(this, e); + } } } diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs index d8c7d5163c..677cdb8674 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs @@ -6,17 +6,17 @@ public enum ColorViewTab { /// - /// The components view with sliders and numeric input boxes. + /// The components subview with sliders and numeric input boxes. /// Components, /// - /// The color palette view with a grid of colors and shades. + /// The color palette subview with a grid of selectable colors. /// Palette, /// - /// The color spectrum view with a box/ring spectrum and sliders. + /// The color spectrum subview with a box/ring spectrum and sliders. /// Spectrum, } diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml new file mode 100644 index 0000000000..9f4324594d --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml index c25d79727f..c55766e07c 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml @@ -25,4 +25,7 @@ + + + From 197ab047a510c58b30a32216fb96c8cfd2239c3a Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 27 May 2022 22:45:56 -0400 Subject: [PATCH 066/393] Add braces --- src/Avalonia.Controls/Primitives/TemplatedControl.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index db029d38c0..7c8c2f882f 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -291,7 +291,9 @@ namespace Avalonia.Controls.Primitives // Existing code kinda expect to see a NameScope even if it's empty if (nameScope == null) + { nameScope = new NameScope(); + } var e = new TemplateAppliedEventArgs(nameScope); OnApplyTemplate(e); From 5ed084123540fae249cc1881a21e67dad42ad0c1 Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 27 May 2022 22:46:12 -0400 Subject: [PATCH 067/393] Fix index clamping --- .../ColorPalette/FluentColorPalette.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs index 89400280a9..b6f9a244b1 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs @@ -135,8 +135,8 @@ namespace Avalonia.Controls public Color GetColor(int colorIndex, int shadeIndex) { return colorChart[ - MathUtilities.Clamp(colorIndex, 0, colorChart.GetLength(0)), - MathUtilities.Clamp(shadeIndex, 0, colorChart.GetLength(1))]; + MathUtilities.Clamp(colorIndex, 0, colorChart.GetLength(0) - 1), + MathUtilities.Clamp(shadeIndex, 0, colorChart.GetLength(1) - 1)]; } } } From e5b18d0b9c263b65b9121a25e19b6103e21d1d07 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 01:25:59 -0400 Subject: [PATCH 068/393] Further work on ColorView --- .../Converters/ContrastBrushConverter.cs | 84 +++++++++ .../Themes/Fluent/ColorView.xaml | 165 +++++++++++++++++- 2 files changed, 246 insertions(+), 3 deletions(-) create mode 100644 src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs diff --git a/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs b/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs new file mode 100644 index 0000000000..574f23dfae --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs @@ -0,0 +1,84 @@ +using System; +using System.Globalization; +using Avalonia.Controls.Converters; +using Avalonia.Data.Converters; +using Avalonia.Media; + +namespace Avalonia.Controls.Primitives.Converters +{ + /// + /// Gets a , either black or white, depending on the luminance of the supplied color. + /// A default color supplied in the converter parameter may be returned if alpha is below the set threshold. + /// + public class ContrastBrushConverter : IValueConverter + { + private ToColorConverter toColorConverter = new ToColorConverter(); + + /// + /// Gets or sets the alpha channel threshold below which a default color is used instead of black/white. + /// + public byte AlphaThreshold { get; set; } = 128; + + /// + public object? Convert( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) + { + Color comparisonColor; + Color? defaultColor = null; + + // Get the changing color to compare against + var convertedValue = toColorConverter.Convert(value, targetType, parameter, culture); + if (convertedValue is Color valueColor) + { + comparisonColor = valueColor; + } + else + { + // Invalid color value provided + return AvaloniaProperty.UnsetValue; + } + + // Get the default color when transparency is high + var convertedParameter = toColorConverter.Convert(parameter, targetType, parameter, culture); + if (convertedParameter is Color parameterColor) + { + defaultColor = parameterColor; + } + + if (comparisonColor.A < AlphaThreshold && + defaultColor.HasValue) + { + // If the transparency is less than the threshold, just use the default brush + // This can commonly be something like the TextControlForeground brush + return new SolidColorBrush(defaultColor.Value); + } + else + { + // Chose a white/black brush based on contrast to the base color + if (ColorHelper.GetRelativeLuminance(comparisonColor) <= 0.5) + { + // Dark color, return light for contrast + return new SolidColorBrush(Colors.White); + } + else + { + // Bright color, return dark for contrast + return new SolidColorBrush(Colors.Black); + } + } + } + + /// + public object? ConvertBack( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) + { + return AvaloniaProperty.UnsetValue; + } + } +} diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 9f4324594d..5d3642a3b1 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -3,12 +3,15 @@ xmlns:converters="using:Avalonia.Controls.Converters" xmlns:primitives="using:Avalonia.Controls.Primitives" xmlns:pc="clr-namespace:Avalonia.Controls.Primitives.Converters;assembly=Avalonia.Controls.ColorPicker" + xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" x:CompileBindings="False"> + + + + + + + @@ -195,11 +230,11 @@ - + + + + + + + + + + + + + + + + From 53a08f126382f9a7eae4d5eda331efd1a7080bd5 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 12:04:26 -0400 Subject: [PATCH 069/393] Add new EnumToBooleanConverter --- .../Converters/EnumToBooleanConverter.cs | 57 +++++++++++++++++++ .../Converters/EnumValueEqualsConverter.cs | 12 +++- 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 src/Avalonia.Controls/Converters/EnumToBooleanConverter.cs diff --git a/src/Avalonia.Controls/Converters/EnumToBooleanConverter.cs b/src/Avalonia.Controls/Converters/EnumToBooleanConverter.cs new file mode 100644 index 0000000000..ba1c4cab3e --- /dev/null +++ b/src/Avalonia.Controls/Converters/EnumToBooleanConverter.cs @@ -0,0 +1,57 @@ +using System; +using System.Globalization; +using Avalonia.Data; +using Avalonia.Data.Converters; + +namespace Avalonia.Controls.Converters +{ + /// + /// Converter to convert an enum value to bool by comparing to the given parameter. + /// Both value and parameter must be of the same enum type. + /// + /// + /// This converter is useful to enable binding of radio buttons with a selected enum value. + /// + public class EnumToBooleanConverter : IValueConverter + { + /// + public object? Convert( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) + { + if (value == null && + parameter == null) + { + return true; + } + else if (value == null || + parameter == null) + { + return false; + } + else + { + return value!.Equals(parameter); + } + } + + /// + public object? ConvertBack( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) + { + if (value is bool boolValue) + { + return boolValue ? parameter : BindingOperations.DoNothing; + } + else + { + return BindingOperations.DoNothing; + } + } + } +} diff --git a/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs b/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs index 1a33a82ca4..abd0fe1dfd 100644 --- a/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs +++ b/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs @@ -10,7 +10,11 @@ namespace Avalonia.Controls.Converters public class EnumValueEqualsConverter : IValueConverter { /// - public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + public object? Convert( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) { // Note: Unlike string comparisons, null/empty is not supported // Both 'value' and 'parameter' must exist and if both are missing they are not considered equal @@ -46,7 +50,11 @@ namespace Avalonia.Controls.Converters } /// - public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + public object? ConvertBack( + object? value, + Type targetType, + object? parameter, + CultureInfo culture) { throw new System.NotImplementedException(); } From 13b82a0d1d4f70eba999e6e29ae075aed3b6cd1b Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 12:08:16 -0400 Subject: [PATCH 070/393] Implement ColorModel switching in ColorView --- .../ColorSlider/ColorSlider.cs | 14 ++ .../ColorView/ColorView.Properties.cs | 20 +- .../Themes/Fluent/ColorView.xaml | 172 +++++++++++++----- 3 files changed, 163 insertions(+), 43 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs index 3c38c6ed1b..78a796e93a 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs @@ -332,6 +332,20 @@ namespace Avalonia.Controls.Primitives disableUpdates = false; } + else if (change.Property == ColorModelProperty) + { + disableUpdates = true; + + if (IsAutoUpdatingEnabled) + { + SetColorToSliderValues(); + UpdateBackground(); + } + + UpdatePseudoClasses(); + + disableUpdates = false; + } else if (change.Property == HsvColorProperty) { disableUpdates = true; diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index eddbeaf112..c56811b8a3 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -7,7 +7,6 @@ namespace Avalonia.Controls { public partial class ColorView { - // SelectedColorModel ActiveColorModel? // SelectedTab /// @@ -19,6 +18,14 @@ namespace Avalonia.Controls Colors.White, defaultBindingMode: BindingMode.TwoWay); + /// + /// Defines the property. + /// + public static readonly StyledProperty ColorModelProperty = + AvaloniaProperty.Register( + nameof(ColorModel), + ColorModel.Rgba); + /// /// Defines the property. /// @@ -203,6 +210,17 @@ namespace Avalonia.Controls set => SetValue(ColorProperty, value); } + /// + /// + /// This property is only applicable to the components tab. + /// The spectrum tab must always be in HSV and the palette tab is pre-defined colors. + /// + public ColorModel ColorModel + { + get => GetValue(ColorModelProperty); + set => SetValue(ColorModelProperty, value); + } + /// public ColorSpectrumComponents ColorSpectrumComponents { diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 5d3642a3b1..b037d14956 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -1,5 +1,6 @@  + @@ -156,6 +158,11 @@ + + + + + + + + + + + + + + + + + + + + Grid.Column="2"> @@ -260,12 +333,17 @@ BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" VerticalAlignment="Center"> - + + + + - + + + + - + + + + Date: Sat, 28 May 2022 12:08:28 -0400 Subject: [PATCH 071/393] Improve comments --- .../Converters/AccentColorConverter.cs | 4 +++- .../Converters/ContrastBrushConverter.cs | 3 +++ .../Converters/ThirdComponentConverter.cs | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Converters/AccentColorConverter.cs b/src/Avalonia.Controls.ColorPicker/Converters/AccentColorConverter.cs index 4d05222e31..2c8e09adc9 100644 --- a/src/Avalonia.Controls.ColorPicker/Converters/AccentColorConverter.cs +++ b/src/Avalonia.Controls.ColorPicker/Converters/AccentColorConverter.cs @@ -7,8 +7,10 @@ namespace Avalonia.Controls.Primitives.Converters { /// /// Creates an accent color for a given base color value and step parameter. - /// This is a highly-specialized converter for the color picker. /// + /// + /// This is a highly-specialized converter for the color picker. + /// public class AccentColorConverter : IValueConverter { /// diff --git a/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs b/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs index 574f23dfae..8b66b1a4e5 100644 --- a/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs +++ b/src/Avalonia.Controls.ColorPicker/Converters/ContrastBrushConverter.cs @@ -10,6 +10,9 @@ namespace Avalonia.Controls.Primitives.Converters /// Gets a , either black or white, depending on the luminance of the supplied color. /// A default color supplied in the converter parameter may be returned if alpha is below the set threshold. /// + /// + /// This is a highly-specialized converter for the color picker. + /// public class ContrastBrushConverter : IValueConverter { private ToColorConverter toColorConverter = new ToColorConverter(); diff --git a/src/Avalonia.Controls.ColorPicker/Converters/ThirdComponentConverter.cs b/src/Avalonia.Controls.ColorPicker/Converters/ThirdComponentConverter.cs index 220a993f99..11e33c74f0 100644 --- a/src/Avalonia.Controls.ColorPicker/Converters/ThirdComponentConverter.cs +++ b/src/Avalonia.Controls.ColorPicker/Converters/ThirdComponentConverter.cs @@ -7,8 +7,10 @@ namespace Avalonia.Controls.Primitives.Converters /// /// Gets the third corresponding with a given /// that represents the other two components. - /// This is a highly-specialized converter for the color picker. /// + /// + /// This is a highly-specialized converter for the color picker. + /// public class ThirdComponentConverter : IValueConverter { /// From 4a267b69d61dbe8d784a3c7046c3af652632b9c8 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 12:15:04 -0400 Subject: [PATCH 072/393] Set MaxHue of ColorSlider to the same value as ColorSpectrum --- .../ColorSlider/ColorSlider.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs index 78a796e93a..4c7df0fda7 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs @@ -20,7 +20,15 @@ namespace Avalonia.Controls.Primitives /// public event EventHandler? ColorChanged; - private const double MaxHue = 359.99999999999999999; // 17 decimal places + /// + /// Defines the maximum hue component value + /// (other components are always 0..100 or 0.255). + /// + /// + /// This should match the default property. + /// + private const double MaxHue = 359; + private bool disableUpdates = false; /// From 36f85325bc7242487f20eeb3fb2fe3142aa0872a Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 12:28:23 -0400 Subject: [PATCH 073/393] Remove EnumValueEqualsConverter replaced by EnumToBooleanConverter --- .../Themes/Default/ColorSpectrum.xaml | 15 ++--- .../Themes/Fluent/ColorSpectrum.xaml | 15 ++--- .../Converters/EnumValueEqualsConverter.cs | 62 ------------------- 3 files changed, 16 insertions(+), 76 deletions(-) delete mode 100644 src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml index 78e6da8aa3..891e040e9f 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml @@ -1,10 +1,11 @@  - + @@ -24,26 +25,26 @@ IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumValueEquals}, ConverterParameter='Box'}" + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" RadiusX="{TemplateBinding CornerRadius, Converter={StaticResource TopLeftCornerRadius}}" RadiusY="{TemplateBinding CornerRadius, Converter={StaticResource BottomRightCornerRadius}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml index ac8e2a9c06..779f228b97 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml @@ -1,10 +1,11 @@  - + @@ -24,26 +25,26 @@ IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumValueEquals}, ConverterParameter='Box'}" + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" RadiusX="{TemplateBinding CornerRadius, Converter={StaticResource TopLeftCornerRadius}}" RadiusY="{TemplateBinding CornerRadius, Converter={StaticResource BottomRightCornerRadius}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> diff --git a/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs b/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs deleted file mode 100644 index abd0fe1dfd..0000000000 --- a/src/Avalonia.Controls/Converters/EnumValueEqualsConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Globalization; -using Avalonia.Data.Converters; - -namespace Avalonia.Controls.Converters -{ - /// - /// Converter that checks if an enum value is equal to the given parameter enum value. - /// - public class EnumValueEqualsConverter : IValueConverter - { - /// - public object? Convert( - object? value, - Type targetType, - object? parameter, - CultureInfo culture) - { - // Note: Unlike string comparisons, null/empty is not supported - // Both 'value' and 'parameter' must exist and if both are missing they are not considered equal - if (value != null && - parameter != null) - { - Type type = value.GetType(); - - if (type.IsEnum) - { - var valueStr = value?.ToString(); - var paramStr = parameter?.ToString(); - - if (string.Equals(valueStr, paramStr, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - - /* - // TODO: When .net Standard 2.0 is no longer supported the code can be changed to below - // This is a little more type safe - if (type.IsEnum && - Enum.TryParse(type, value?.ToString(), true, out object? valueEnum) && - Enum.TryParse(type, parameter?.ToString(), true, out object? paramEnum)) - { - return valueEnum == paramEnum; - } - */ - } - - return false; - } - - /// - public object? ConvertBack( - object? value, - Type targetType, - object? parameter, - CultureInfo culture) - { - throw new System.NotImplementedException(); - } - } -} From 043b56c7da836dc6e8976c91957ce82626ca5b26 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 13:46:40 -0400 Subject: [PATCH 074/393] Remove IsAutoUpdatingEnabled property from ColorSlider This was unused and is an unnecessary complexity --- .../ColorSlider/ColorSlider.Properties.cs | 21 ------------- .../ColorSlider/ColorSlider.cs | 31 ++++++------------- 2 files changed, 9 insertions(+), 43 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs index 31bd296288..b1be794794 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs @@ -48,14 +48,6 @@ namespace Avalonia.Controls.Primitives nameof(IsAlphaMaxForced), true); - /// - /// Defines the property. - /// - public static readonly StyledProperty IsAutoUpdatingEnabledProperty = - AvaloniaProperty.Register( - nameof(IsAutoUpdatingEnabled), - true); - /// /// Defines the property. /// @@ -119,19 +111,6 @@ namespace Avalonia.Controls.Primitives set => SetValue(IsAlphaMaxForcedProperty, value); } - /// - /// Gets or sets a value indicating whether automatic background and foreground updates will be - /// calculated when the set color changes. - /// - /// - /// This can be disabled for performance reasons when working with multiple sliders. - /// - public bool IsAutoUpdatingEnabled - { - get => GetValue(IsAutoUpdatingEnabledProperty); - set => SetValue(IsAutoUpdatingEnabledProperty, value); - } - /// /// Gets or sets a value indicating whether the saturation and value components are always forced to maximum values /// when using the HSVA color model. Only component values other than will be changed. diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs index 4c7df0fda7..641516c474 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs @@ -327,13 +327,10 @@ namespace Avalonia.Controls.Primitives HsvColor = Color.ToHsv(); - if (IsAutoUpdatingEnabled) - { - SetColorToSliderValues(); - UpdateBackground(); - } - + SetColorToSliderValues(); + UpdateBackground(); UpdatePseudoClasses(); + OnColorChanged(new ColorChangedEventArgs( change.GetOldValue(), change.GetNewValue())); @@ -344,12 +341,8 @@ namespace Avalonia.Controls.Primitives { disableUpdates = true; - if (IsAutoUpdatingEnabled) - { - SetColorToSliderValues(); - UpdateBackground(); - } - + SetColorToSliderValues(); + UpdateBackground(); UpdatePseudoClasses(); disableUpdates = false; @@ -360,13 +353,10 @@ namespace Avalonia.Controls.Primitives Color = HsvColor.ToRgb(); - if (IsAutoUpdatingEnabled) - { - SetColorToSliderValues(); - UpdateBackground(); - } - + SetColorToSliderValues(); + UpdateBackground(); UpdatePseudoClasses(); + OnColorChanged(new ColorChangedEventArgs( change.GetOldValue().ToRgb(), change.GetNewValue().ToRgb())); @@ -375,10 +365,7 @@ namespace Avalonia.Controls.Primitives } else if (change.Property == BoundsProperty) { - if (IsAutoUpdatingEnabled) - { - UpdateBackground(); - } + UpdateBackground(); } else if (change.Property == ValueProperty || change.Property == MinimumProperty || From 8ef440ceda8237a746c409a3eaa9e230b820cdb9 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 14:24:00 -0400 Subject: [PATCH 075/393] Finish ColorView design/style --- .../Themes/Fluent/ColorView.xaml | 215 +++++++++++------- 1 file changed, 136 insertions(+), 79 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index b037d14956..09feeb38f9 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -14,35 +14,125 @@ + 48 + + + M3 2C3.27614 2 3.5 2.22386 3.5 2.5V5.5C3.5 5.77614 3.72386 6 4 6H16C16.2761 6 16.5 5.77614 + 16.5 5.5V2.5C16.5 2.22386 16.7239 2 17 2C17.2761 2 17.5 2.22386 17.5 2.5V5.5C17.5 6.32843 + 16.8284 7 16 7H15.809L12.2236 14.1708C12.0615 14.4951 11.7914 14.7431 11.4695 + 14.8802C11.4905 15.0808 11.5 15.2891 11.5 15.5C11.5 16.0818 11.4278 16.6623 11.2268 + 17.1165C11.019 17.5862 10.6266 18 10 18C9.37343 18 8.98105 17.5862 8.77323 17.1165C8.57222 + 16.6623 8.5 16.0818 8.5 15.5C8.5 15.2891 8.50952 15.0808 8.53051 14.8802C8.20863 14.7431 + 7.93851 14.4951 7.77639 14.1708L4.19098 7H4C3.17157 7 2.5 6.32843 2.5 5.5V2.5C2.5 2.22386 + 2.72386 2 3 2ZM9.11803 14H10.882C11.0714 14 11.2445 13.893 11.3292 13.7236L14.691 + 7H5.30902L8.67082 13.7236C8.75552 13.893 8.92865 14 9.11803 14ZM9.52346 15C9.50787 15.1549 + 9.5 15.3225 9.5 15.5C9.5 16.0228 9.56841 16.4423 9.6877 16.7119C9.8002 16.9661 9.90782 17 + 10 17C10.0922 17 10.1998 16.9661 10.3123 16.7119C10.4316 16.4423 10.5 16.0228 10.5 + 15.5C10.5 15.3225 10.4921 15.1549 10.4765 15H9.52346Z + + + + M9.75003 6.5C10.1642 6.5 10.5 6.16421 10.5 5.75C10.5 5.33579 10.1642 5 9.75003 5C9.33582 + 5 9.00003 5.33579 9.00003 5.75C9.00003 6.16421 9.33582 6.5 9.75003 6.5ZM12.75 7.5C13.1642 + 7.5 13.5 7.16421 13.5 6.75C13.5 6.33579 13.1642 6 12.75 6C12.3358 6 12 6.33579 12 6.75C12 + 7.16421 12.3358 7.5 12.75 7.5ZM15.25 9C15.25 9.41421 14.9142 9.75 14.5 9.75C14.0858 9.75 + 13.75 9.41421 13.75 9C13.75 8.58579 14.0858 8.25 14.5 8.25C14.9142 8.25 15.25 8.58579 + 15.25 9ZM14.5 12.75C14.9142 12.75 15.25 12.4142 15.25 12C15.25 11.5858 14.9142 11.25 14.5 + 11.25C14.0858 11.25 13.75 11.5858 13.75 12C13.75 12.4142 14.0858 12.75 14.5 12.75ZM13.25 + 14C13.25 14.4142 12.9142 14.75 12.5 14.75C12.0858 14.75 11.75 14.4142 11.75 14C11.75 + 13.5858 12.0858 13.25 12.5 13.25C12.9142 13.25 13.25 13.5858 13.25 14ZM13.6972 + 2.99169C10.9426 1.57663 8.1432 1.7124 5.77007 3.16636C4.55909 3.9083 3.25331 5.46925 + 2.51605 7.05899C2.14542 7.85816 1.89915 8.70492 1.90238 9.49318C1.90566 10.2941 2.16983 + 11.0587 2.84039 11.6053C3.45058 12.1026 3.98165 12.353 4.49574 12.3784C5.01375 12.404 + 5.41804 12.1942 5.73429 12.0076C5.80382 11.9666 5.86891 11.927 5.93113 11.8892C6.17332 + 11.7421 6.37205 11.6214 6.62049 11.5426C6.90191 11.4534 7.2582 11.4205 7.77579 + 11.5787C7.96661 11.637 8.08161 11.7235 8.16212 11.8229C8.24792 11.9289 8.31662 12.0774 + 8.36788 12.2886C8.41955 12.5016 8.44767 12.7527 8.46868 13.0491C8.47651 13.1594 8.48379 + 13.2855 8.49142 13.4176C8.50252 13.6098 8.51437 13.8149 8.52974 14.0037C8.58435 14.6744 + 8.69971 15.4401 9.10362 16.1357C9.51764 16.8488 10.2047 17.439 11.307 17.8158C12.9093 + 18.3636 14.3731 17.9191 15.5126 17.0169C16.6391 16.125 17.4691 14.7761 17.8842 + 13.4272C19.1991 9.15377 17.6728 5.03394 13.6972 2.99169ZM6.29249 4.01905C8.35686 2.75426 + 10.7844 2.61959 13.2403 3.88119C16.7473 5.68275 18.1135 9.28161 16.9284 13.1332C16.5624 + 14.3227 15.8338 15.4871 14.8919 16.2329C13.963 16.9684 12.8486 17.286 11.6305 + 16.8696C10.7269 16.5607 10.2467 16.1129 9.96842 15.6336C9.68001 15.1369 9.57799 14.5556 + 9.52644 13.9225C9.51101 13.733 9.50132 13.5621 9.49147 13.3884C9.48399 13.2564 9.47642 + 13.1229 9.46618 12.9783C9.44424 12.669 9.41175 12.3499 9.33968 12.0529C9.26719 11.7541 + 9.14902 11.4527 8.93935 11.1937C8.72439 10.9282 8.43532 10.7346 8.06801 10.6223C7.36648 + 10.408 6.80266 10.4359 6.31839 10.5893C5.94331 10.7082 5.62016 10.9061 5.37179 + 11.0582C5.31992 11.0899 5.2713 11.1197 5.22616 11.1463C4.94094 11.3146 4.75357 11.39 + 4.54514 11.3796C4.33279 11.3691 4.00262 11.2625 3.47218 10.8301C3.0866 10.5158 2.90473 + 10.0668 2.90237 9.48908C2.89995 8.89865 3.08843 8.20165 3.42324 7.47971C4.09686 6.0272 + 5.28471 4.63649 6.29249 4.01905Z + + + + M14.95 5C14.7184 3.85888 13.7095 3 12.5 3C11.2905 3 10.2816 3.85888 10.05 5H2.5C2.22386 + 5 2 5.22386 2 5.5C2 5.77614 2.22386 6 2.5 6H10.05C10.2816 7.14112 11.2905 8 12.5 8C13.7297 + 8 14.752 7.11217 14.961 5.94254C14.9575 5.96177 14.9539 5.98093 14.95 6H17.5C17.7761 6 18 + 5.77614 18 5.5C18 5.22386 17.7761 5 17.5 5H14.95ZM12.5 7C11.6716 7 11 6.32843 11 5.5C11 + 4.67157 11.6716 4 12.5 4C13.3284 4 14 4.67157 14 5.5C14 6.32843 13.3284 7 12.5 7ZM9.94999 + 14C9.71836 12.8589 8.70948 12 7.5 12C6.29052 12 5.28164 12.8589 5.05001 14H2.5C2.22386 + 14 2 14.2239 2 14.5C2 14.7761 2.22386 15 2.5 15H5.05001C5.28164 16.1411 6.29052 17 7.5 + 17C8.70948 17 9.71836 16.1411 9.94999 15H17.5C17.7761 15 18 14.7761 18 14.5C18 14.2239 + 17.7761 14 17.5 14H9.94999ZM7.5 16C6.67157 16 6 15.3284 6 14.5C6 13.6716 6.67157 13 7.5 + 13C8.32843 13 9 13.6716 9 14.5C9 15.3284 8.32843 16 7.5 16Z + + - - + + + + RowDefinitions="Auto,*" + Margin="12"> - - + + + + SelectedItem="{Binding Color, ElementName=ColorSpectrum}" + UseLayoutRounding="False" + Margin="12"> @@ -281,17 +343,11 @@ @@ -497,7 +553,8 @@ + HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" + Margin="12,0,12,12" /> From 12a8ecb9239f315767448bc5d434b7652b7987f8 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 15:17:40 -0400 Subject: [PATCH 076/393] Implement the hex input TextBox in ColorView --- .../ColorView/ColorView.cs | 85 +++++++++++++++++-- .../Themes/Fluent/ColorView.xaml | 19 ++--- 2 files changed, 88 insertions(+), 16 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 76e3cfe3e1..0363d9c182 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -1,9 +1,8 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Globalization; +using Avalonia.Controls.Converters; +using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Media; @@ -12,6 +11,7 @@ namespace Avalonia.Controls /// /// Presents a color for user editing using a spectrum, palette and component sliders. /// + [TemplatePart("PART_HexTextBox", typeof(TextBox))] public partial class ColorView : TemplatedControl { /// @@ -19,20 +19,70 @@ namespace Avalonia.Controls /// public event EventHandler? ColorChanged; - private bool disableUpdates = false; + // XAML template parts + private TextBox? _hexTextBox; private ObservableCollection _customPaletteColors = new ObservableCollection(); + private ColorToHexConverter colorToHexConverter = new ColorToHexConverter(); + private bool disableUpdates = false; /// /// Initializes a new instance of the class. /// public ColorView() : base() { + this.CustomPalette = new FluentColorPalette(); + } + + /// + /// Gets the value of the hex TextBox and sets it as the current . + /// If invalid, the TextBox hex text will revert back to the last valid color. + /// + private void GetColorFromHexTextBox() + { + if (_hexTextBox != null) + { + var convertedColor = colorToHexConverter.ConvertBack(_hexTextBox.Text, typeof(Color), null, CultureInfo.CurrentCulture); + + if (convertedColor is Color color) + { + Color = color; + } + + // Re-apply the hex value + // This ensure the hex color value is always valid and formatted correctly + _hexTextBox.Text = colorToHexConverter.Convert(Color, typeof(string), null, CultureInfo.CurrentCulture) as string; + } + } + + /// + /// Sets the current to the hex TextBox. + /// + private void SetColorToHexTextBox() + { + if (_hexTextBox != null) + { + _hexTextBox.Text = colorToHexConverter.Convert(Color, typeof(string), null, CultureInfo.CurrentCulture) as string; + } } + /// protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { - this.CustomPalette = new FluentColorPalette(); + if (_hexTextBox != null) + { + _hexTextBox.KeyDown -= HexTextBox_KeyDown; + _hexTextBox.LostFocus -= HexTextBox_LostFocus; + } + + _hexTextBox = e.NameScope.Find("PART_HexTextBox"); + SetColorToHexTextBox(); + + if (_hexTextBox != null) + { + _hexTextBox.KeyDown += HexTextBox_KeyDown; + _hexTextBox.LostFocus += HexTextBox_LostFocus; + } base.OnApplyTemplate(e); } @@ -52,6 +102,7 @@ namespace Avalonia.Controls disableUpdates = true; HsvColor = Color.ToHsv(); + SetColorToHexTextBox(); OnColorChanged(new ColorChangedEventArgs( change.GetOldValue(), @@ -64,6 +115,7 @@ namespace Avalonia.Controls disableUpdates = true; Color = HsvColor.ToRgb(); + SetColorToHexTextBox(); OnColorChanged(new ColorChangedEventArgs( change.GetOldValue().ToRgb(), @@ -103,5 +155,26 @@ namespace Avalonia.Controls { ColorChanged?.Invoke(this, e); } + + /// + /// Event handler for when a key is pressed within the Hex RGB value TextBox. + /// This is used to trigger re-evaluation of the color based on the TextBox value. + /// + private void HexTextBox_KeyDown(object? sender, Input.KeyEventArgs e) + { + if (e.Key == Input.Key.Enter) + { + GetColorFromHexTextBox(); + } + } + + /// + /// Event handler for when the Hex RGB value TextBox looses focus. + /// This is used to trigger re-evaluation of the color based on the TextBox value. + /// + private void HexTextBox_LostFocus(object? sender, Interactivity.RoutedEventArgs e) + { + GetColorFromHexTextBox(); + } } } diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 09feeb38f9..9800b1b3a5 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -152,8 +152,7 @@ Grid.Row="0" Grid.RowSpan="2" Components="{TemplateBinding ColorSpectrumComponents}" - Color="{TemplateBinding Color}" - HsvColor="{TemplateBinding HsvColor}" + HsvColor="{Binding $parent[ColorView].HsvColor}" MinHue="{TemplateBinding MinHue}" MaxHue="{TemplateBinding MaxHue}" MinSaturation="{TemplateBinding MinSaturation}" @@ -188,7 +187,7 @@ @@ -369,12 +368,12 @@ HorizontalAlignment="Center" VerticalAlignment="Center" /> - + @@ -419,7 +418,7 @@ Orientation="Horizontal" ColorComponent="Component1" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" - HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" + HsvColor="{Binding $parent[ColorView].HsvColor}" Margin="12,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> @@ -462,7 +461,7 @@ Orientation="Horizontal" ColorComponent="Component2" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" - HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" + HsvColor="{Binding $parent[ColorView].HsvColor}" Margin="12,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> @@ -505,7 +504,7 @@ Orientation="Horizontal" ColorComponent="Component3" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" - HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" + HsvColor="{Binding $parent[ColorView].HsvColor}" Margin="12,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> @@ -543,7 +542,7 @@ Orientation="Horizontal" ColorComponent="Alpha" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" - HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" + HsvColor="{Binding $parent[ColorView].HsvColor}" Margin="12,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> @@ -553,7 +552,7 @@ From a5b3bb9cb6c80b9d83c38ea372c9a64cc663acb6 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 15:58:48 -0400 Subject: [PATCH 077/393] Implement ColorSlider component value rounding --- .../ColorSlider/ColorSlider.Properties.cs | 21 +++++++++++ .../ColorSlider/ColorSlider.cs | 35 +++++++++++++++++-- .../Themes/Fluent/ColorView.xaml | 12 +++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs index b1be794794..e2a34a7f90 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.Properties.cs @@ -48,6 +48,14 @@ namespace Avalonia.Controls.Primitives nameof(IsAlphaMaxForced), true); + /// + /// Defines the property. + /// + public static readonly StyledProperty IsRoundingEnabledProperty = + AvaloniaProperty.Register( + nameof(IsRoundingEnabled), + false); + /// /// Defines the property. /// @@ -111,6 +119,19 @@ namespace Avalonia.Controls.Primitives set => SetValue(IsAlphaMaxForcedProperty, value); } + /// + /// Gets or sets a value indicating whether rounding of color component values is enabled. + /// + /// + /// This is applicable for the HSV color model only. The struct uses double + /// values while the struct uses byte. Only double types need rounding. + /// + public bool IsRoundingEnabled + { + get => GetValue(IsRoundingEnabledProperty); + set => SetValue(IsRoundingEnabledProperty, value); + } + /// /// Gets or sets a value indicating whether the saturation and value components are always forced to maximum values /// when using the HSVA color model. Only component values other than will be changed. diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs index 641516c474..957e5e7b77 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs @@ -115,6 +115,21 @@ namespace Avalonia.Controls.Primitives } } + /// + /// Rounds the component values of the given . + /// This is useful for user-display and to ensure a color matches user selection exactly. + /// + /// The to round component values for. + /// A new with rounded component values. + private HsvColor RoundComponentValues(HsvColor hsvColor) + { + return new HsvColor( + Math.Round(hsvColor.A, 2, MidpointRounding.AwayFromZero), + Math.Round(hsvColor.H, 0, MidpointRounding.AwayFromZero), + Math.Round(hsvColor.S, 2, MidpointRounding.AwayFromZero), + Math.Round(hsvColor.V, 2, MidpointRounding.AwayFromZero)); + } + /// /// Updates the slider property values by applying the current color. /// @@ -130,6 +145,11 @@ namespace Avalonia.Controls.Primitives if (ColorModel == ColorModel.Hsva) { + if (IsRoundingEnabled) + { + hsvColor = RoundComponentValues(hsvColor); + } + // Note: Components converted into a usable range for the user switch (component) { @@ -222,7 +242,7 @@ namespace Avalonia.Controls.Primitives } } - return (hsvColor.ToRgb(), hsvColor); + rgbColor = hsvColor.ToRgb(); } else { @@ -244,8 +264,15 @@ namespace Avalonia.Controls.Primitives break; } - return (rgbColor, rgbColor.ToHsv()); + hsvColor = rgbColor.ToHsv(); } + + if (IsRoundingEnabled) + { + hsvColor = RoundComponentValues(hsvColor); + } + + return (rgbColor, hsvColor); } /// @@ -363,6 +390,10 @@ namespace Avalonia.Controls.Primitives disableUpdates = false; } + else if (change.Property == IsRoundingEnabledProperty) + { + SetColorToSliderValues(); + } else if (change.Property == BoundsProperty) { UpdateBackground(); diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 9800b1b3a5..1edc2768a5 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -416,6 +416,9 @@ Grid.Column="2" Grid.Row="2" Orientation="Horizontal" + IsRoundingEnabled="True" + IsSnapToTickEnabled="True" + TickFrequency="1" ColorComponent="Component1" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" HsvColor="{Binding $parent[ColorView].HsvColor}" @@ -459,6 +462,9 @@ Grid.Column="2" Grid.Row="3" Orientation="Horizontal" + IsRoundingEnabled="True" + IsSnapToTickEnabled="True" + TickFrequency="1" ColorComponent="Component2" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" HsvColor="{Binding $parent[ColorView].HsvColor}" @@ -502,6 +508,9 @@ Grid.Column="2" Grid.Row="4" Orientation="Horizontal" + IsRoundingEnabled="True" + IsSnapToTickEnabled="True" + TickFrequency="1" ColorComponent="Component3" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" HsvColor="{Binding $parent[ColorView].HsvColor}" @@ -540,6 +549,9 @@ Grid.Column="2" Grid.Row="5" Orientation="Horizontal" + IsRoundingEnabled="True" + IsSnapToTickEnabled="True" + TickFrequency="1" ColorComponent="Alpha" ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" HsvColor="{Binding $parent[ColorView].HsvColor}" From 0824c874fc7c5bbc8b98f758e47f5e6194f7b595 Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 28 May 2022 16:42:58 -0400 Subject: [PATCH 078/393] Add initial ColorPicker control --- .../ControlCatalog/Pages/ColorPickerPage.xaml | 5 +- .../ColorPicker/ColorPicker.cs | 15 ++++ .../Themes/Fluent/ColorPicker.xaml | 71 +++++++++++++++++++ .../Themes/Fluent/Fluent.xaml | 1 + 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs create mode 100644 src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml diff --git a/samples/ControlCatalog/Pages/ColorPickerPage.xaml b/samples/ControlCatalog/Pages/ColorPickerPage.xaml index 47a407821c..eca52e796a 100644 --- a/samples/ControlCatalog/Pages/ColorPickerPage.xaml +++ b/samples/ControlCatalog/Pages/ColorPickerPage.xaml @@ -13,7 +13,10 @@ - + + diff --git a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs new file mode 100644 index 0000000000..cb84c77d20 --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Avalonia.Controls +{ + /// + /// + /// + public class ColorPicker : ColorView + { + } +} diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml new file mode 100644 index 0000000000..3fa3ab5ead --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml index c55766e07c..03e8238a44 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml @@ -26,6 +26,7 @@ + From f4cc30d4a10149d4a9d9f88578ee35b3ecfa0b0a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 29 May 2022 22:28:28 +0200 Subject: [PATCH 079/393] Add failing test for Window.Width/Height. --- .../WindowTests.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/Avalonia.Controls.UnitTests/WindowTests.cs b/tests/Avalonia.Controls.UnitTests/WindowTests.cs index 63ccf74c2b..a8c9b68d12 100644 --- a/tests/Avalonia.Controls.UnitTests/WindowTests.cs +++ b/tests/Avalonia.Controls.UnitTests/WindowTests.cs @@ -695,6 +695,31 @@ namespace Avalonia.Controls.UnitTests } } + [Fact] + public void Width_Height_Should_Not_Be_NaN_After_Show_With_SizeToContent_Manual() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var child = new Canvas + { + Width = 400, + Height = 800, + }; + + var target = new Window() + { + SizeToContent = SizeToContent.Manual, + Content = child + }; + + Show(target); + + // Values come from MockWindowingPlatform defaults. + Assert.Equal(800, target.Width); + Assert.Equal(600, target.Height); + } + } + [Fact] public void Width_Height_Should_Not_Be_NaN_After_Show_With_SizeToContent_WidthAndHeight() { @@ -712,6 +737,8 @@ namespace Avalonia.Controls.UnitTests Content = child }; + target.GetObservable(Window.WidthProperty).Subscribe(x => { }); + Show(target); Assert.Equal(400, target.Width); From d2af5dbcac4427c22830d0bb6a2764befa180a72 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 29 May 2022 22:59:50 -0400 Subject: [PATCH 080/393] Implicitly map x:DataType to a DataType on a DataTemplate. --- .../AvaloniaXamlIlCompiler.cs | 8 +- .../Transformers/XDataTypeTransformer.cs | 79 +++++++++++++++++++ .../Xaml/DataTemplateTests.cs | 58 ++++++++++++++ .../Xaml/TreeDataTemplateTests.cs | 17 ++++ 4 files changed, 158 insertions(+), 4 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs index 1ca7be67a7..7514b0e12e 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs @@ -31,10 +31,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions // Before everything else Transformers.Insert(0, new XNameTransformer()); - Transformers.Insert(1, new IgnoredDirectivesTransformer()); - Transformers.Insert(2, _designTransformer = new AvaloniaXamlIlDesignPropertiesTransformer()); - Transformers.Insert(3, _bindingTransformer = new AvaloniaBindingExtensionTransformer()); - + Transformers.Insert(1, new XDataTypeTransformer()); + Transformers.Insert(2, new IgnoredDirectivesTransformer()); + Transformers.Insert(3, _designTransformer = new AvaloniaXamlIlDesignPropertiesTransformer()); + Transformers.Insert(4, _bindingTransformer = new AvaloniaBindingExtensionTransformer()); // Targeted InsertBefore( diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs new file mode 100644 index 0000000000..7b90164974 --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using System.Linq; +using XamlX; +using XamlX.Ast; +using XamlX.Transform; +using XamlX.Transform.Transformers; +using XamlX.TypeSystem; + +namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers +{ + internal class XDataTypeTransformer : IXamlAstTransformer + { + private const string DataTypePropertyName = "DataType"; + + /// + /// Converts x:DataType directives to regular DataType assignments if property with Avalonia.Metadata.DataTypeAttribute exists. + /// + /// + public IXamlAstNode Transform(AstTransformationContext context, IXamlAstNode node) + { + if (node is XamlAstObjectNode on) + { + for (var c = 0; c < on.Children.Count; c++) + { + var ch = on.Children[c]; + if (ch is XamlAstXmlDirective { Namespace: XamlNamespaces.Xaml2006, Name: DataTypePropertyName } d) + { + if (on.Children.OfType() + .Any(p => ((XamlAstNamePropertyReference)p.Property)?.Name == DataTypePropertyName)) + { + // Break iteration if any DataType property was already set by user code. + break; + } + + var templateDataTypeAttribute = context.GetAvaloniaTypes().DataTypeAttribute; + + var clrType = on.Type switch + { + XamlAstClrTypeReference clrRef => clrRef.Type, + XamlAstXmlTypeReference xmlRef => TypeReferenceResolver.ResolveType(context, xmlRef.Name, + on.Type.IsMarkupExtension, on, strict: false).Type, + _ => null + }; + if (clrType is null) + { + break; + } + + // Technically it's possible to map "x:DataType" to a property with [DataType] attribute regardless of its name, + // but we go explicitly strict here and check the name as well. + var (declaringType, dataTypeProperty) = GetAllProperties(clrType) + .FirstOrDefault(t => t.property.Name == DataTypePropertyName && t.property.CustomAttributes + .Any(a => a.Type == templateDataTypeAttribute)); + + if (dataTypeProperty is not null) + { + on.Children[c] = new XamlAstXamlPropertyValueNode(d, + new XamlAstNamePropertyReference(d, + new XamlAstClrTypeReference(ch, declaringType, false), dataTypeProperty.Name, + on.Type), + d.Values); + } + } + } + } + + return node; + } + + private static IEnumerable<(IXamlType declaringType, IXamlProperty property)> GetAllProperties(IXamlType t) + { + foreach (var p in t.Properties) + yield return (t, p); + if(t.BaseType!=null) + foreach (var tuple in GetAllProperties(t.BaseType)) + yield return tuple; + } + } +} diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs index 53881467e7..f9e1ce3054 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs @@ -1,5 +1,7 @@ +using System.Linq; using Avalonia.Controls; using Avalonia.Controls.Presenters; +using Avalonia.Markup.Xaml.Templates; using Avalonia.UnitTests; using Xunit; @@ -89,6 +91,62 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml } } + [Fact] + public void XDataType_Should_Be_Assigned_To_Clr_Property() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var target = window.FindControl("target"); + var template = (DataTemplate)window.DataTemplates.First(); + + window.ApplyTemplate(); + target.ApplyTemplate(); + ((ContentPresenter)target.Presenter).UpdateChild(); + + Assert.Equal(typeof(string), template.DataType); + Assert.IsType(target.Presenter.Child); + } + } + + [Fact] + public void XDataType_Should_Be_Ignored_If_DataType_Already_Set() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var target = window.FindControl("target"); + + window.ApplyTemplate(); + target.ApplyTemplate(); + ((ContentPresenter)target.Presenter).UpdateChild(); + + Assert.IsType(target.Presenter.Child); + } + } + [Fact] public void Can_Set_DataContext_In_DataTemplate() { diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs index 3fdac49f31..d4ab473d67 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs @@ -21,5 +21,22 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml Assert.IsType(template.ItemsSource); } } + + [Fact] + public void XDataType_Should_Be_Assigned_To_Clr_Property() + { + using (UnitTestApplication.Start(TestServices.MockPlatformWrapper)) + { + var xaml = @" + + +"; + var templates = (DataTemplates)AvaloniaRuntimeXamlLoader.Load(xaml); + var template = (TreeDataTemplate)(templates.First()); + + Assert.Equal(typeof(string), template.DataType); + } + } } } From 1d9645f01fda85fcbc80e11090cd672b536a559b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 29 May 2022 23:38:20 -0400 Subject: [PATCH 081/393] Validate DataTemplates --- .../Templates/DataTemplates.cs | 17 +++++++++++++++ .../Templates/ITypedDataTemplate.cs | 10 +++++++++ .../Templates/DataTemplate.cs | 2 +- .../Templates/TreeDataTemplate.cs | 2 +- .../CompiledBindingExtensionTests.cs | 4 ++-- .../Xaml/ControlBindingTests.cs | 8 +++---- .../Xaml/DataTemplateTests.cs | 21 +++++++++++++++++++ .../Xaml/TreeDataTemplateTests.cs | 2 +- 8 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 src/Avalonia.Controls/Templates/ITypedDataTemplate.cs diff --git a/src/Avalonia.Controls/Templates/DataTemplates.cs b/src/Avalonia.Controls/Templates/DataTemplates.cs index f203539536..d4eeda7908 100644 --- a/src/Avalonia.Controls/Templates/DataTemplates.cs +++ b/src/Avalonia.Controls/Templates/DataTemplates.cs @@ -1,3 +1,4 @@ +using System; using Avalonia.Collections; namespace Avalonia.Controls.Templates @@ -13,6 +14,22 @@ namespace Avalonia.Controls.Templates public DataTemplates() { ResetBehavior = ResetBehavior.Remove; + + Validate += ValidateDataTemplate; + } + + private static void ValidateDataTemplate(IDataTemplate template) + { + var valid = template switch + { + ITypedDataTemplate typed => typed.DataType is not null, + _ => true + }; + + if (!valid) + { + throw new InvalidOperationException("DataTemplate inside of DataTemplates must have a DataType set. Set DataType property or use ItemTemplate with single template instead."); + } } } } \ No newline at end of file diff --git a/src/Avalonia.Controls/Templates/ITypedDataTemplate.cs b/src/Avalonia.Controls/Templates/ITypedDataTemplate.cs new file mode 100644 index 0000000000..239dbd79f4 --- /dev/null +++ b/src/Avalonia.Controls/Templates/ITypedDataTemplate.cs @@ -0,0 +1,10 @@ +using System; +using Avalonia.Metadata; + +namespace Avalonia.Controls.Templates; + +public interface ITypedDataTemplate : IDataTemplate +{ + [DataType] + Type? DataType { get; } +} diff --git a/src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs b/src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs index d2b24979cc..4da6b1b791 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs @@ -5,7 +5,7 @@ using Avalonia.Metadata; namespace Avalonia.Markup.Xaml.Templates { - public class DataTemplate : IRecyclingDataTemplate + public class DataTemplate : IRecyclingDataTemplate, ITypedDataTemplate { [DataType] public Type DataType { get; set; } diff --git a/src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs b/src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs index 10061c3d48..04e8b0a9c0 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs +++ b/src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs @@ -9,7 +9,7 @@ using Avalonia.Metadata; namespace Avalonia.Markup.Xaml.Templates { - public class TreeDataTemplate : ITreeDataTemplate + public class TreeDataTemplate : ITreeDataTemplate, ITypedDataTemplate { [DataType] public Type DataType { get; set; } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 7e721fd7b2..555a05638b 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -413,11 +413,11 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions;assembly=Avalonia.Markup.Xaml.UnitTests' x:DataType='local:TestDataContext'> - + - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs index 8188b212e1..affa292a7d 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs @@ -74,18 +74,18 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml - + - + - + - + "; diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs index 53881467e7..abbcf6c5a8 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs @@ -1,3 +1,4 @@ +using System; using Avalonia.Controls; using Avalonia.Controls.Presenters; using Avalonia.UnitTests; @@ -132,5 +133,25 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml Assert.Same(viewModel.Child.Child, canvas.DataContext); } } + + [Fact] + public void DataTemplates_Without_Type_Should_Throw() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + +"; + Assert.Throws(() => (Window)AvaloniaRuntimeXamlLoader.Load(xaml)); + } + } } } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs index 3fdac49f31..807b37517a 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/TreeDataTemplateTests.cs @@ -14,7 +14,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml { using (UnitTestApplication.Start(TestServices.MockPlatformWrapper)) { - var xaml = ""; + var xaml = ""; var templates = (DataTemplates)AvaloniaRuntimeXamlLoader.Load(xaml); var template = (TreeDataTemplate)(templates.First()); From 138be304a0d2c86c663846bfa7adfb1537058fd1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 30 May 2022 11:53:34 +0200 Subject: [PATCH 082/393] Ensure Window.Width/Height is initialized. - Run resize logic if `Width`/`Height` are still NaN (i.e. not set up) - Always call base class `WindowBase.HandleResize` - In `WindowBase.HandleResize` don't run a layout pass if client size unchanged Fixes `Width_Height_Should_Not_Be_NaN_After_Show_With_SizeToContent_Manual`. --- src/Avalonia.Controls/Window.cs | 40 ++++++++++++++--------------- src/Avalonia.Controls/WindowBase.cs | 12 ++++++--- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index a4f4534b88..9b49e866b8 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -991,28 +991,28 @@ namespace Avalonia.Controls /// protected sealed override void HandleResized(Size clientSize, PlatformResizeReason reason) { - if (ClientSize == clientSize) - return; - - var sizeToContent = SizeToContent; - - // If auto-sizing is enabled, and the resize came from a user resize (or the reason was - // unspecified) then turn off auto-resizing for any window dimension that is not equal - // to the requested size. - if (sizeToContent != SizeToContent.Manual && - CanResize && - reason == PlatformResizeReason.Unspecified || - reason == PlatformResizeReason.User) + if (ClientSize != clientSize || double.IsNaN(Width) || double.IsNaN(Height)) { - if (clientSize.Width != ClientSize.Width) - sizeToContent &= ~SizeToContent.Width; - if (clientSize.Height != ClientSize.Height) - sizeToContent &= ~SizeToContent.Height; - SizeToContent = sizeToContent; - } + var sizeToContent = SizeToContent; + + // If auto-sizing is enabled, and the resize came from a user resize (or the reason was + // unspecified) then turn off auto-resizing for any window dimension that is not equal + // to the requested size. + if (sizeToContent != SizeToContent.Manual && + CanResize && + reason == PlatformResizeReason.Unspecified || + reason == PlatformResizeReason.User) + { + if (clientSize.Width != ClientSize.Width) + sizeToContent &= ~SizeToContent.Width; + if (clientSize.Height != ClientSize.Height) + sizeToContent &= ~SizeToContent.Height; + SizeToContent = sizeToContent; + } - Width = clientSize.Width; - Height = clientSize.Height; + Width = clientSize.Width; + Height = clientSize.Height; + } base.HandleResized(clientSize, reason); } diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs index 12ba143c8a..d5e54a5c08 100644 --- a/src/Avalonia.Controls/WindowBase.cs +++ b/src/Avalonia.Controls/WindowBase.cs @@ -217,10 +217,16 @@ namespace Avalonia.Controls /// The reason for the resize. protected override void HandleResized(Size clientSize, PlatformResizeReason reason) { - ClientSize = clientSize; FrameSize = PlatformImpl?.FrameSize; - LayoutManager.ExecuteLayoutPass(); - Renderer?.Resized(clientSize); + + if (ClientSize != clientSize) + { + ClientSize = clientSize; + LayoutManager.ExecuteLayoutPass(); + Renderer?.Resized(clientSize); + } + + System.Diagnostics.Debug.WriteLine($"HandleResized: ClientSize {ClientSize} | FrameSize {FrameSize}"); } /// From 67e6c41abcbaed905bba22446ee54b995a29bed1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 30 May 2022 11:54:34 +0200 Subject: [PATCH 083/393] Use FrameSize for window startup location. ...if available. --- src/Avalonia.Controls/Window.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 9b49e866b8..92f74530e2 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -871,10 +871,10 @@ namespace Avalonia.Controls var scaling = owner?.DesktopScaling ?? PlatformImpl?.DesktopScaling ?? 1; - // TODO: We really need non-client size here. - var rect = new PixelRect( - PixelPoint.Origin, - PixelSize.FromSize(ClientSize, scaling)); + // Use frame size, falling back to client size if the platform can't give it to us. + var rect = FrameSize.HasValue ? + new PixelRect(PixelSize.FromSize(FrameSize.Value, scaling)) : + new PixelRect(PixelSize.FromSize(ClientSize, scaling)); if (startupLocation == WindowStartupLocation.CenterScreen) { From 4c8240b7bf349ca5bc7f74344ba45af73b77f57c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 30 May 2022 11:57:13 +0200 Subject: [PATCH 084/393] Added integration tests for WindowStartupLocation. --- samples/IntegrationTestApp/MainWindow.axaml | 17 ++ .../IntegrationTestApp/MainWindow.axaml.cs | 38 ++++ .../IntegrationTestApp/ShowWindowTest.axaml | 26 +++ .../ShowWindowTest.axaml.cs | 40 +++++ .../Avalonia.IntegrationTests.Appium.csproj | 4 + .../WindowTests.cs | 164 ++++++++++++++++++ 6 files changed, 289 insertions(+) create mode 100644 samples/IntegrationTestApp/ShowWindowTest.axaml create mode 100644 samples/IntegrationTestApp/ShowWindowTest.axaml.cs create mode 100644 tests/Avalonia.IntegrationTests.Appium/WindowTests.cs diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml index 19ac68b15b..5151d80932 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml +++ b/samples/IntegrationTestApp/MainWindow.axaml @@ -94,6 +94,23 @@ + + + + + + NonOwned + Owned + Modal + + + Manual + CenterScreen + CenterOwner + + + + diff --git a/samples/IntegrationTestApp/MainWindow.axaml.cs b/samples/IntegrationTestApp/MainWindow.axaml.cs index 9a612aa94d..580548a433 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml.cs +++ b/samples/IntegrationTestApp/MainWindow.axaml.cs @@ -5,6 +5,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; +using Avalonia.VisualTree; namespace IntegrationTestApp { @@ -46,6 +47,41 @@ namespace IntegrationTestApp } } + private void ShowWindow() + { + var sizeTextBox = this.GetControl("ShowWindowSize"); + var modeComboBox = this.GetControl("ShowWindowMode"); + var locationComboBox = this.GetControl("ShowWindowLocation"); + var size = !string.IsNullOrWhiteSpace(sizeTextBox.Text) ? Size.Parse(sizeTextBox.Text) : (Size?)null; + var owner = (Window)this.GetVisualRoot()!; + + var window = new ShowWindowTest + { + WindowStartupLocation = (WindowStartupLocation)locationComboBox.SelectedIndex, + }; + + if (size.HasValue) + { + window.Width = size.Value.Width; + window.Height = size.Value.Height; + } + + sizeTextBox.Text = string.Empty; + + switch (modeComboBox.SelectedIndex) + { + case 0: + window.Show(); + break; + case 1: + window.Show(owner); + break; + case 2: + window.ShowDialog(owner); + break; + } + } + private void MenuClicked(object? sender, RoutedEventArgs e) { var clickedMenuItemTextBlock = this.FindControl("ClickedMenuItem"); @@ -64,6 +100,8 @@ namespace IntegrationTestApp this.FindControl("BasicListBox").SelectedIndex = -1; if (source?.Name == "MenuClickedMenuItemReset") this.FindControl("ClickedMenuItem").Text = "None"; + if (source?.Name == "ShowWindow") + ShowWindow(); } } } diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml b/samples/IntegrationTestApp/ShowWindowTest.axaml new file mode 100644 index 0000000000..e87ae0f32c --- /dev/null +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs new file mode 100644 index 0000000000..9b55864caa --- /dev/null +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -0,0 +1,40 @@ +using System; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; +using Avalonia.Rendering; + +namespace IntegrationTestApp +{ + public class ShowWindowTest : Window + { + public ShowWindowTest() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + + protected override void OnOpened(EventArgs e) + { + base.OnOpened(e); + this.GetControl("ClientSize").Text = $"{Width}, {Height}"; + this.GetControl("FrameSize").Text = $"{FrameSize}"; + this.GetControl("Position").Text = $"{Position}"; + this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; + this.GetControl("Scaling").Text = $"{((IRenderRoot)this).RenderScaling}"; + + if (Owner is not null) + { + var ownerRect = this.GetControl("OwnerRect"); + var owner = (Window)Owner; + ownerRect.Text = $"{owner.Position}, {owner.FrameSize}"; + } + } + + private void CloseWindow_Click(object sender, RoutedEventArgs e) => Close(); + } +} diff --git a/tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj b/tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj index 095f0e63e0..03d9332051 100644 --- a/tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj +++ b/tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj @@ -5,6 +5,10 @@ enable + + + + diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs new file mode 100644 index 0000000000..771faa1925 --- /dev/null +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -0,0 +1,164 @@ +using System; +using System.Linq; +using System.Runtime.InteropServices; +using Avalonia.Controls; +using OpenQA.Selenium.Appium; +using Xunit; +using Xunit.Sdk; + +namespace Avalonia.IntegrationTests.Appium +{ + [Collection("Default")] + public class WindowTests + { + private readonly AppiumDriver _session; + + public WindowTests(TestAppFixture fixture) + { + _session = fixture.Session; + + var tabs = _session.FindElementByAccessibilityId("MainTabs"); + var tab = tabs.FindElementByName("Window"); + tab.Click(); + } + + [Theory] + [MemberData(nameof(StartupLocationData))] + public void StartupLocation(string? size, ShowWindowMode mode, WindowStartupLocation location) + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + try + { + var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); + var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); + var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); + var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + + if (size is not null) + sizeTextBox.SendKeys(size); + + modeComboBox.Click(); + _session.FindElementByName(mode.ToString()).SendClick(); + + locationComboBox.Click(); + _session.FindElementByName(location.ToString()).SendClick(); + + showButton.Click(); + SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); + + var clientSize = Size.Parse(_session.FindElementByAccessibilityId("ClientSize").Text); + var frameSize = Size.Parse(_session.FindElementByAccessibilityId("FrameSize").Text); + var position = PixelPoint.Parse(_session.FindElementByAccessibilityId("Position").Text); + var screenRect = PixelRect.Parse(_session.FindElementByAccessibilityId("ScreenRect").Text); + var scaling = double.Parse(_session.FindElementByAccessibilityId("Scaling").Text); + + Assert.True(frameSize.Width >= clientSize.Width, "Expected frame width >= client width."); + Assert.True(frameSize.Height > clientSize.Height, "Expected frame height > client height."); + + var frameRect = new PixelRect(position, PixelSize.FromSize(frameSize, scaling)); + + switch (location) + { + case WindowStartupLocation.CenterScreen: + { + var expected = screenRect.CenterRect(frameRect); + AssertCloseEnough(expected.Position, frameRect.Position); + break; + } + } + } + finally + { + try + { + var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); + closeButton.Click(); + SwitchToMainWindowHack(mainWindowHandle); + } + catch { } + } + } + + public static TheoryData StartupLocationData() + { + var sizes = new[] { null, "400,300" }; + var data = new TheoryData(); + + foreach (var size in sizes) + { + foreach (var mode in Enum.GetValues()) + { + foreach (var location in Enum.GetValues()) + { + if (!(location == WindowStartupLocation.CenterOwner && mode == ShowWindowMode.NonOwned)) + { + data.Add(size, mode, location); + } + } + } + } + + return data; + } + + private string? GetCurrentWindowHandleHack() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // HACK: WinAppDriver only seems to switch to a newly opened window if the window has an owner, + // otherwise the session remains targeting the previous window. Return the handle for the + // current window so we know which window to switch to when another is opened. + return _session.WindowHandles.Single(); + } + + return null; + } + + private void SwitchToNewWindowHack(string? oldWindowHandle) + { + if (oldWindowHandle is not null) + { + var newWindowHandle = _session.WindowHandles.FirstOrDefault(x => x != oldWindowHandle); + + // HACK: Looks like WinAppDriver only adds window handles for non-owned windows, but luckily + // non-owned windows is where we're having the problem, so if we find a window handle that + // isn't the main window handle then switch to it. + if (newWindowHandle is not null) + _session.SwitchTo().Window(newWindowHandle); + } + } + + private void SwitchToMainWindowHack(string? mainWindowHandle) + { + if (mainWindowHandle is not null) + _session.SwitchTo().Window(mainWindowHandle); + } + + private static void AssertCloseEnough(PixelPoint expected, PixelPoint actual) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // On win32, accurate frame information cannot be obtained until a window is shown but + // WindowStartupLocation needs to be calculated before the window is shown, meaning that + // the position of a centered window can be off by a bit. From initial testing, looks + // like this shouldn't be more than 10 pixels. + if (Math.Abs(expected.X - actual.X) > 10) + throw new EqualException(expected, actual); + if (Math.Abs(expected.Y - actual.Y) > 10) + throw new EqualException(expected, actual); + } + else + { + Assert.Equal(expected, actual); + } + } + + public enum ShowWindowMode + { + NonOwned, + Owned, + Modal + } + } +} From 03e01a6e554227613ce5579cf24884e8a94ad629 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Mon, 30 May 2022 13:04:46 +0300 Subject: [PATCH 085/393] initial working --- src/Avalonia.Controls/ComboBox.cs | 21 ++-- src/Avalonia.Controls/Control.cs | 7 +- .../Rendering/SceneGraph/SceneBuilderTests.cs | 33 +++++++ .../ComboBoxTests.cs | 99 +++++++++++++++++++ .../FlowDirectionTests.cs | 41 ++++++++ 5 files changed, 181 insertions(+), 20 deletions(-) create mode 100644 tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index cbf9b35a05..1f46a3b292 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -184,23 +184,10 @@ namespace Avalonia.Controls this.UpdateSelectionBoxItem(SelectedItem); } - // Because the SelectedItem isn't connected to the visual tree public override void InvalidateMirrorTransform() { base.InvalidateMirrorTransform(); - - if (SelectedItem is Control selectedControl) - { - selectedControl.InvalidateMirrorTransform(); - - foreach (var visual in selectedControl.GetVisualDescendants()) - { - if (visual is Control childControl) - { - childControl.InvalidateMirrorTransform(); - } - } - } + UpdateSelectionBoxItem(SelectedItem); } /// @@ -365,6 +352,8 @@ namespace Avalonia.Controls { parent.GetObservable(IsVisibleProperty).Subscribe(IsVisibleChanged).DisposeWith(_subscriptionsOnOpen); } + + UpdateSelectionBoxItem(SelectedItem); } private void IsVisibleChanged(bool isVisible) @@ -420,8 +409,12 @@ namespace Avalonia.Controls { control.Measure(Size.Infinity); + var flowDirection = control.IsAttachedToVisualTree ? + (control.VisualParent as Control)!.FlowDirection : FlowDirection.LeftToRight; + SelectionBoxItem = new Rectangle { + FlowDirection = flowDirection, Width = control.DesiredSize.Width, Height = control.DesiredSize.Height, Fill = new VisualBrush diff --git a/src/Avalonia.Controls/Control.cs b/src/Avalonia.Controls/Control.cs index d6a5fa0727..16d4ef5c15 100644 --- a/src/Avalonia.Controls/Control.cs +++ b/src/Avalonia.Controls/Control.cs @@ -378,17 +378,12 @@ namespace Avalonia.Controls bool bypassFlowDirectionPolicies = BypassFlowDirectionPolicies; bool parentBypassFlowDirectionPolicies = false; - var parent = this.FindAncestorOfType(); + var parent = ((IVisual)this).VisualParent as Control; if (parent != null) { parentFlowDirection = parent.FlowDirection; parentBypassFlowDirectionPolicies = parent.BypassFlowDirectionPolicies; } - else if (Parent is Control logicalParent) - { - parentFlowDirection = logicalParent.FlowDirection; - parentBypassFlowDirectionPolicies = logicalParent.BypassFlowDirectionPolicies; - } bool thisShouldBeMirrored = flowDirection == FlowDirection.RightToLeft && !bypassFlowDirectionPolicies; bool parentShouldBeMirrored = parentFlowDirection == FlowDirection.RightToLeft && !parentBypassFlowDirectionPolicies; diff --git a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs index 01afe85b8b..5cc9f57c8e 100644 --- a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs +++ b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs @@ -349,6 +349,39 @@ namespace Avalonia.Base.UnitTests.Rendering.SceneGraph } } + [Fact] + public void MirrorTransform_For_Control_With_RenderTransform_Should_Be_Correct() + { + using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) + { + Border border; + var tree = new TestRoot + { + Width = 400, + Height = 200, + Child = border = new Border + { + HorizontalAlignment = HorizontalAlignment.Left, + Background = Brushes.Red, + Width = 100, + RenderTransform = new ScaleTransform(0.5, 1), + FlowDirection = FlowDirection.RightToLeft + } + }; + + tree.Measure(Size.Infinity); + tree.Arrange(new Rect(tree.DesiredSize)); + + var scene = new Scene(tree); + var sceneBuilder = new SceneBuilder(); + sceneBuilder.UpdateAll(scene); + + var expectedTransform = new Matrix(-1, 0, 0, 1, 100, 0) * Matrix.CreateScale(0.5, 1) * Matrix.CreateTranslation(25, 0); + var borderNode = scene.FindNode(border); + Assert.Equal(expectedTransform, borderNode.Transform); + } + } + [Fact] public void Should_Update_Border_Background_Node() { diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 98695fe88e..0f1925f628 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -336,5 +336,104 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(1, count); } } + + [Fact] + public void FlowDirection_Of_RectangleContent_Shuold_Be_LeftToRight() + { + using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) + { + var items = new[] + { + new ComboBoxItem() + { + Content = new Control() + } + }; + var target = new ComboBox + { + Items = items, + Template = GetTemplate() + }; + + var root = new TestRoot(target); + target.ApplyTemplate(); + target.SelectedIndex = 0; + + var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + + Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); + } + } + + [Fact] + public void FlowDirection_Of_RectangleContent_Updated_After_Change_ComboBox() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var items = new[] + { + new ComboBoxItem() + { + Content = new Control() + } + }; + var target = new ComboBox + { + FlowDirection = FlowDirection.RightToLeft, + Items = items, + Template = GetTemplate() + }; + + var root = new TestRoot(target); + + target.ApplyTemplate(); + target.Presenter.ApplyTemplate(); + target.SelectedIndex = 0; + + var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + + // need help here, the 'rectangle' isn't connected to visual tree for some reason + + Assert.True(rectangle.HasMirrorTransform); + + target.FlowDirection = FlowDirection.LeftToRight; + + Assert.False(rectangle.HasMirrorTransform); + } + } + + [Fact] + public void FlowDirection_Of_RectangleContent_Updated_After_Content_In_VisualTree() + { + using (UnitTestApplication.Start(TestServices.RealFocus)) + { + Control content; + var items = new[] + { + new ComboBoxItem() + { + Content = content = new Control() + } + }; + var target = new ComboBox + { + FlowDirection = FlowDirection.RightToLeft, + Items = items, + Template = GetTemplate() + }; + + var root = new TestRoot(target); + target.ApplyTemplate(); + target.Presenter.ApplyTemplate(); + target.SelectedIndex = 0; + + // need help here how to connect 'content' tio visual tree, or how to + + + var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + + Assert.Equal(FlowDirection.RightToLeft, rectangle.FlowDirection); + } + } } } diff --git a/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs b/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs new file mode 100644 index 0000000000..6739eff638 --- /dev/null +++ b/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs @@ -0,0 +1,41 @@ +using Avalonia.Media; +using Xunit; + +namespace Avalonia.Controls.UnitTests +{ + public class FlowDirectionTests + { + [Fact] + public void HasMirrorTransform_Should_Be_True() + { + var target = new Control + { + FlowDirection = FlowDirection.RightToLeft, + }; + + Assert.True(target.HasMirrorTransform); + } + + [Fact] + public void HasMirrorTransform_Of_Children_Is_Updated_After_Change() + { + Control child; + var target = new Decorator + { + FlowDirection = FlowDirection.LeftToRight, + Child = child = new Control() + { + FlowDirection = FlowDirection.LeftToRight, + } + }; + + Assert.False(target.HasMirrorTransform); + Assert.False(child.HasMirrorTransform); + + target.FlowDirection = FlowDirection.RightToLeft; + + Assert.True(target.HasMirrorTransform); + Assert.True(child.HasMirrorTransform); + } + } +} From 05db047d2909b96b264ffded9e882bb62278ba25 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Mon, 30 May 2022 13:09:20 +0300 Subject: [PATCH 086/393] typo --- tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 0f1925f628..905ded193c 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -427,7 +427,7 @@ namespace Avalonia.Controls.UnitTests target.Presenter.ApplyTemplate(); target.SelectedIndex = 0; - // need help here how to connect 'content' tio visual tree, or how to + // need help here how to connect 'content' to visual tree, or how to open popup var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; From ee4c0f97e6e4000f01a46b591ed43afa4eba939b Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Mon, 30 May 2022 14:23:13 +0300 Subject: [PATCH 087/393] remove OnAttachedToVisualTree because bug --- src/Avalonia.Controls/ComboBox.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index 1f46a3b292..8a6fb361da 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -178,16 +178,10 @@ namespace Avalonia.Controls ComboBoxItem.ContentTemplateProperty); } - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - this.UpdateSelectionBoxItem(SelectedItem); - } - public override void InvalidateMirrorTransform() { base.InvalidateMirrorTransform(); - UpdateSelectionBoxItem(SelectedItem); + UpdateSelectionBoxItem(SelectedItem); } /// From 7e6edb0f32b753d226aba58889d56c2875b6f282 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Mon, 30 May 2022 23:42:05 +0300 Subject: [PATCH 088/393] fixes bugs --- src/Avalonia.Controls/ComboBox.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index 8a6fb361da..a3f87f7695 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -403,8 +403,8 @@ namespace Avalonia.Controls { control.Measure(Size.Infinity); - var flowDirection = control.IsAttachedToVisualTree ? - (control.VisualParent as Control)!.FlowDirection : FlowDirection.LeftToRight; + var flowDirection = + (control.VisualParent as Control)?.FlowDirection ?? FlowDirection.LeftToRight; SelectionBoxItem = new Rectangle { From 496b978cdbb830a0eb44d2b11915ff3c615c492a Mon Sep 17 00:00:00 2001 From: Max Katz Date: Mon, 30 May 2022 18:36:14 -0400 Subject: [PATCH 089/393] Run xDataType after TypeReferenceResolver --- .../CompilerExtensions/AvaloniaXamlIlCompiler.cs | 10 ++++++---- .../Transformers/XDataTypeTransformer.cs | 8 +------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs index 7514b0e12e..04a61e5f10 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs @@ -31,10 +31,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions // Before everything else Transformers.Insert(0, new XNameTransformer()); - Transformers.Insert(1, new XDataTypeTransformer()); - Transformers.Insert(2, new IgnoredDirectivesTransformer()); - Transformers.Insert(3, _designTransformer = new AvaloniaXamlIlDesignPropertiesTransformer()); - Transformers.Insert(4, _bindingTransformer = new AvaloniaBindingExtensionTransformer()); + Transformers.Insert(1, new IgnoredDirectivesTransformer()); + Transformers.Insert(2, _designTransformer = new AvaloniaXamlIlDesignPropertiesTransformer()); + Transformers.Insert(3, _bindingTransformer = new AvaloniaBindingExtensionTransformer()); // Targeted InsertBefore( @@ -57,6 +56,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions new AvaloniaXamlIlResolveByNameMarkupExtensionReplacer() ); + InsertAfter( + new XDataTypeTransformer()); + // After everything else InsertBefore( new AddNameScopeRegistration(), diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs index 7b90164974..845dc5f831 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/XDataTypeTransformer.cs @@ -34,13 +34,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers var templateDataTypeAttribute = context.GetAvaloniaTypes().DataTypeAttribute; - var clrType = on.Type switch - { - XamlAstClrTypeReference clrRef => clrRef.Type, - XamlAstXmlTypeReference xmlRef => TypeReferenceResolver.ResolveType(context, xmlRef.Name, - on.Type.IsMarkupExtension, on, strict: false).Type, - _ => null - }; + var clrType = (on.Type as XamlAstClrTypeReference)?.Type; if (clrType is null) { break; From bc2179b337e969838942fcfea868934536d9ef33 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Mon, 30 May 2022 18:49:21 -0400 Subject: [PATCH 090/393] Add XDataType_Should_Be_Ignored_If_DataType_Has_Non_Standard_Name test --- .../CompiledBindingExtensionTests.cs | 3 +- .../Xaml/DataTemplateTests.cs | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 7e721fd7b2..a8b95d3aaa 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -17,6 +17,7 @@ using Avalonia.Markup.Xaml.Templates; using Avalonia.Media; using Avalonia.Metadata; using Avalonia.UnitTests; +using JetBrains.Annotations; using XamlX; using Xunit; @@ -1527,7 +1528,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions [TemplateContent] public object Content { get; set; } - public bool Match(object data) => FancyDataType.IsInstanceOfType(data); + public bool Match(object data) => FancyDataType?.IsInstanceOfType(data) ?? true; public IControl Build(object data) => TemplateContent.Load(Content)?.Control; } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs index f9e1ce3054..6e99d9e3a6 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/DataTemplateTests.cs @@ -1,7 +1,11 @@ +using System; using System.Linq; using Avalonia.Controls; using Avalonia.Controls.Presenters; +using Avalonia.Controls.Templates; using Avalonia.Markup.Xaml.Templates; +using Avalonia.Markup.Xaml.UnitTests.MarkupExtensions; +using Avalonia.Metadata; using Avalonia.UnitTests; using Xunit; @@ -147,6 +151,37 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml } } + [Fact] + public void XDataType_Should_Be_Ignored_If_DataType_Has_Non_Standard_Name() + { + // We don't want DataType to be mapped to FancyDataType, avoid possible confusion. + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var target = window.FindControl("target"); + + window.ApplyTemplate(); + target.ApplyTemplate(); + ((ContentPresenter)target.Presenter).UpdateChild(); + + var dataTemplate = (CustomDataTemplate)target.ContentTemplate; + Assert.Null(dataTemplate.FancyDataType); + } + } + [Fact] public void Can_Set_DataContext_In_DataTemplate() { From 5cd0ea68053394bb85f7db96c65e7203448dd1cf Mon Sep 17 00:00:00 2001 From: robloo Date: Mon, 30 May 2022 20:39:17 -0400 Subject: [PATCH 091/393] Complete initial ColorPicker --- .../ColorPicker/ColorPicker.cs | 3 +- .../Themes/Fluent/ColorPicker.xaml | 31 +++++++++++++------ .../Themes/Fluent/ColorView.xaml | 16 +++++----- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs index cb84c77d20..140a24d6a1 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs @@ -7,7 +7,8 @@ using System.Threading.Tasks; namespace Avalonia.Controls { /// - /// + /// Presents a color for user editing using a spectrum, palette and component sliders within a drop down. + /// Editing is available when the drop down flyout is opened; otherwise, only the preview color is shown. /// public class ColorPicker : ColorView { diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index 3fa3ab5ead..a4f52f111c 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -2,10 +2,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Avalonia.Controls" xmlns:converters="using:Avalonia.Controls.Converters" - x:CompileBindings="True"> + x:CompileBindings="False"> + - + @@ -150,7 +150,8 @@ HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Margin="0,0,12,0" /> + Margin="0,0,12,0" + IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"/> - + @@ -254,7 +255,7 @@ - + @@ -590,7 +591,7 @@ From 402790ba86bfb6fc0f9de817cb3032b681175f38 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Tue, 31 May 2022 07:53:59 +0300 Subject: [PATCH 095/393] improve UpdateFlowDirection --- src/Avalonia.Controls/ComboBox.cs | 28 +++++++++++++++---- .../ComboBoxTests.cs | 5 ++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index a3f87f7695..fc7feca7f1 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -178,10 +178,16 @@ namespace Avalonia.Controls ComboBoxItem.ContentTemplateProperty); } + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + UpdateSelectionBoxItem(SelectedItem); + } + public override void InvalidateMirrorTransform() { base.InvalidateMirrorTransform(); - UpdateSelectionBoxItem(SelectedItem); + UpdateFlowDirection(); } /// @@ -347,7 +353,7 @@ namespace Avalonia.Controls parent.GetObservable(IsVisibleProperty).Subscribe(IsVisibleChanged).DisposeWith(_subscriptionsOnOpen); } - UpdateSelectionBoxItem(SelectedItem); + UpdateFlowDirection(); } private void IsVisibleChanged(bool isVisible) @@ -403,12 +409,8 @@ namespace Avalonia.Controls { control.Measure(Size.Infinity); - var flowDirection = - (control.VisualParent as Control)?.FlowDirection ?? FlowDirection.LeftToRight; - SelectionBoxItem = new Rectangle { - FlowDirection = flowDirection, Width = control.DesiredSize.Width, Height = control.DesiredSize.Height, Fill = new VisualBrush @@ -419,6 +421,8 @@ namespace Avalonia.Controls } }; } + + UpdateFlowDirection(); } else { @@ -426,6 +430,18 @@ namespace Avalonia.Controls } } + private void UpdateFlowDirection() + { + var rectangle = SelectionBoxItem as Rectangle; + if (rectangle != null) + { + var content = (rectangle.Fill as VisualBrush)!.Visual as Control; + var flowDirection = (((IVisual)content!).VisualParent as Control)?.FlowDirection ?? FlowDirection.LeftToRight; + + rectangle.FlowDirection = flowDirection; + } + } + private void SelectFocusedItem() { foreach (ItemContainerInfo dropdownItem in ItemContainerGenerator.Containers) diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 905ded193c..0804de3174 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -351,6 +351,7 @@ namespace Avalonia.Controls.UnitTests }; var target = new ComboBox { + FlowDirection = FlowDirection.RightToLeft, Items = items, Template = GetTemplate() }; @@ -368,7 +369,7 @@ namespace Avalonia.Controls.UnitTests [Fact] public void FlowDirection_Of_RectangleContent_Updated_After_Change_ComboBox() { - using (UnitTestApplication.Start(TestServices.StyledWindow)) + using (UnitTestApplication.Start(TestServices.RealStyler)) { var items = new[] { @@ -385,10 +386,10 @@ namespace Avalonia.Controls.UnitTests }; var root = new TestRoot(target); - target.ApplyTemplate(); target.Presenter.ApplyTemplate(); target.SelectedIndex = 0; + ((ContentPresenter)target.Presenter).UpdateChild(); var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; From c77c500bcd373fa3715cce5d5a851eaab89da408 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Tue, 31 May 2022 14:35:55 +0300 Subject: [PATCH 096/393] fixes tests --- src/Avalonia.Controls/ComboBox.cs | 6 +- .../ComboBoxTests.cs | 116 +++++++++--------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index fc7feca7f1..5ba1195159 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -432,11 +432,11 @@ namespace Avalonia.Controls private void UpdateFlowDirection() { - var rectangle = SelectionBoxItem as Rectangle; - if (rectangle != null) + if (SelectionBoxItem is Rectangle rectangle) { var content = (rectangle.Fill as VisualBrush)!.Visual as Control; - var flowDirection = (((IVisual)content!).VisualParent as Control)?.FlowDirection ?? FlowDirection.LeftToRight; + var flowDirection = (((IVisual)content!).VisualParent as Control)?.FlowDirection ?? + FlowDirection.LeftToRight; rectangle.FlowDirection = flowDirection; } diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 0804de3174..70b713d6d0 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -8,7 +8,7 @@ using Avalonia.Data; using Avalonia.Input; using Avalonia.LogicalTree; using Avalonia.Media; -using Avalonia.Threading; +using Avalonia.VisualTree; using Avalonia.UnitTests; using Xunit; @@ -340,80 +340,77 @@ namespace Avalonia.Controls.UnitTests [Fact] public void FlowDirection_Of_RectangleContent_Shuold_Be_LeftToRight() { - using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) + var items = new[] { - var items = new[] - { - new ComboBoxItem() - { - Content = new Control() - } - }; - var target = new ComboBox - { - FlowDirection = FlowDirection.RightToLeft, - Items = items, - Template = GetTemplate() - }; + new ComboBoxItem() + { + Content = new Control() + } + }; + var target = new ComboBox + { + FlowDirection = FlowDirection.RightToLeft, + Items = items, + Template = GetTemplate() + }; - var root = new TestRoot(target); - target.ApplyTemplate(); - target.SelectedIndex = 0; + var root = new TestRoot(target); + target.ApplyTemplate(); + target.SelectedIndex = 0; - var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; - Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); - } + Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); } [Fact] - public void FlowDirection_Of_RectangleContent_Updated_After_Change_ComboBox() + public void FlowDirection_Of_RectangleContent_Updated_After_InvalidateMirrorTransform() { - using (UnitTestApplication.Start(TestServices.RealStyler)) + var parentContent = new Decorator() { - var items = new[] - { - new ComboBoxItem() - { - Content = new Control() - } - }; - var target = new ComboBox + Child = new Control() + }; + var items = new[] + { + new ComboBoxItem() { - FlowDirection = FlowDirection.RightToLeft, - Items = items, - Template = GetTemplate() - }; - - var root = new TestRoot(target); - target.ApplyTemplate(); - target.Presenter.ApplyTemplate(); - target.SelectedIndex = 0; - ((ContentPresenter)target.Presenter).UpdateChild(); - - var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; - - // need help here, the 'rectangle' isn't connected to visual tree for some reason + Content = parentContent.Child + } + }; + var target = new ComboBox + { + FlowDirection = FlowDirection.RightToLeft, + Items = items, + Template = GetTemplate() + }; - Assert.True(rectangle.HasMirrorTransform); + var root = new TestRoot(target); + target.ApplyTemplate(); + target.SelectedIndex = 0; - target.FlowDirection = FlowDirection.LeftToRight; + var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); - Assert.False(rectangle.HasMirrorTransform); - } + parentContent.FlowDirection = FlowDirection.RightToLeft; + target.InvalidateMirrorTransform(); + + Assert.Equal(FlowDirection.RightToLeft, rectangle.FlowDirection); } [Fact] - public void FlowDirection_Of_RectangleContent_Updated_After_Content_In_VisualTree() + public void FlowDirection_Of_RectangleContent_Updated_After_OpenPopup() { - using (UnitTestApplication.Start(TestServices.RealFocus)) + using (UnitTestApplication.Start(TestServices.StyledWindow)) { - Control content; - var items = new[] + var parentContent = new Decorator() { + Child = new Control() + }; + var items = new[] + { new ComboBoxItem() { - Content = content = new Control() + Content = parentContent.Child } }; var target = new ComboBox @@ -425,14 +422,17 @@ namespace Avalonia.Controls.UnitTests var root = new TestRoot(target); target.ApplyTemplate(); - target.Presenter.ApplyTemplate(); target.SelectedIndex = 0; - // need help here how to connect 'content' to visual tree, or how to open popup - - var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; + Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); + parentContent.FlowDirection = FlowDirection.RightToLeft; + + var popup = target.GetVisualDescendants().OfType().First(); + popup.PlacementTarget = new Window(); + popup.Open(); + Assert.Equal(FlowDirection.RightToLeft, rectangle.FlowDirection); } } From a2d83e8fae5a559bca83d87db7f5a30d901618ed Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 13:11:07 +0100 Subject: [PATCH 097/393] [OSX] programatically implement child window relationship --- native/Avalonia.Native/src/OSX/AvnView.mm | 5 ++ native/Avalonia.Native/src/OSX/AvnWindow.mm | 38 +++++------ .../Avalonia.Native/src/OSX/WindowBaseImpl.h | 2 + .../Avalonia.Native/src/OSX/WindowBaseImpl.mm | 7 +- native/Avalonia.Native/src/OSX/WindowImpl.h | 8 ++- native/Avalonia.Native/src/OSX/WindowImpl.mm | 66 +++++++++++++------ .../Avalonia.Native/src/OSX/WindowProtocol.h | 1 - 7 files changed, 81 insertions(+), 46 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/AvnView.mm b/native/Avalonia.Native/src/OSX/AvnView.mm index 5436ad22f3..bbb4d59adb 100644 --- a/native/Avalonia.Native/src/OSX/AvnView.mm +++ b/native/Avalonia.Native/src/OSX/AvnView.mm @@ -300,6 +300,11 @@ - (void)mouseDown:(NSEvent *)event { + if(_parent != nullptr) + { + _parent->BringToFront(); + } + _isLeftPressed = true; _lastMouseDownEvent = event; [self mouseEvent:event withType:LeftButtonDown]; diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index 590dc5e7ac..1445227cf5 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -183,6 +183,11 @@ return self; } +- (void)mouseDown:(NSEvent *)event +{ + _parent->BringToFront(); +} + - (BOOL)windowShouldClose:(NSWindow *)sender { auto window = dynamic_cast(_parent.getRaw()); @@ -209,7 +214,14 @@ { ComPtr parent = _parent; _parent = NULL; - [self restoreParentWindow]; + + auto window = dynamic_cast(parent.getRaw()); + + if(window != nullptr) + { + window->SetParent(nullptr); + } + parent->BaseEvents->Closed(); [parent->View onClosed]; } @@ -220,17 +232,11 @@ if(_canBecomeKeyWindow) { // If the window has a child window being shown as a dialog then don't allow it to become the key window. - for(NSWindow* uch in [self childWindows]) + auto parent = dynamic_cast(_parent.getRaw()); + + if(parent != nullptr) { - if (![uch conformsToProtocol:@protocol(AvnWindowProtocol)]) - { - continue; - } - - id ch = (id ) uch; - - if(ch.isDialog) - return false; + return parent->CanBecomeKeyWindow(); } return true; @@ -273,16 +279,6 @@ [super becomeKeyWindow]; } --(void) restoreParentWindow; -{ - auto parent = [self parentWindow]; - - if(parent != nil) - { - [parent removeChildWindow:self]; - } -} - - (void)windowDidMiniaturize:(NSNotification *)notification { auto parent = dynamic_cast(_parent.operator->()); diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h index 83850e780c..62c0e2069d 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h @@ -99,6 +99,8 @@ BEGIN_INTERFACE_MAP() virtual bool IsDialog(); id GetWindowProtocol (); + + virtual void BringToFront (); protected: virtual NSWindowStyleMask GetStyle(); diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm index 121679b942..77f0f47934 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm @@ -143,8 +143,6 @@ HRESULT WindowBaseImpl::Hide() { @autoreleasepool { if (Window != nullptr) { [Window orderOut:Window]; - - [GetWindowProtocol() restoreParentWindow]; } return S_OK; @@ -610,6 +608,11 @@ id WindowBaseImpl::GetWindowProtocol() { return (id ) Window; } +void WindowBaseImpl::BringToFront() +{ + // do nothing. +} + extern IAvnWindow* CreateAvnWindow(IAvnWindowEvents*events, IAvnGlContext* gl) { @autoreleasepool diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.h b/native/Avalonia.Native/src/OSX/WindowImpl.h index 35627685a2..76d5cbf6ea 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.h +++ b/native/Avalonia.Native/src/OSX/WindowImpl.h @@ -8,6 +8,7 @@ #import "WindowBaseImpl.h" #include "IWindowStateChanged.h" +#include class WindowImpl : public virtual WindowBaseImpl, public virtual IAvnWindow, public IWindowStateChanged { @@ -22,7 +23,8 @@ private: bool _transitioningWindowState; bool _isClientAreaExtended; bool _isDialog; - WindowImpl* _lastParent; + WindowImpl* _parent; + std::list _children; AvnExtendClientAreaChromeHints _extendClientHints; FORWARD_IUNKNOWN() @@ -91,6 +93,10 @@ BEGIN_INTERFACE_MAP() virtual bool IsDialog() override; virtual void OnInitialiseNSWindow() override; + + virtual void BringToFront () override; + + bool CanBecomeKeyWindow (); protected: virtual NSWindowStyleMask GetStyle() override; diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index ad804eb280..5333cb23c8 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -10,6 +10,7 @@ #include "WindowProtocol.h" WindowImpl::WindowImpl(IAvnWindowEvents *events, IAvnGlContext *gl) : WindowBaseImpl(events, gl) { + _children = std::list(); _isClientAreaExtended = false; _extendClientHints = AvnDefaultChrome; _fullScreenActive = false; @@ -20,7 +21,7 @@ WindowImpl::WindowImpl(IAvnWindowEvents *events, IAvnGlContext *gl) : WindowBase _lastWindowState = Normal; _actualWindowState = Normal; _lastTitle = @""; - _lastParent = nullptr; + _parent = nullptr; WindowEvents = events; } @@ -63,9 +64,9 @@ void WindowImpl::OnInitialiseNSWindow(){ SetExtendClientArea(true); } - if(_lastParent != nullptr) + if(_parent != nullptr) { - SetParent(_lastParent); + SetParent(_parent); } } @@ -96,33 +97,56 @@ HRESULT WindowImpl::SetParent(IAvnWindow *parent) { START_COM_CALL; @autoreleasepool { - if (parent == nullptr) - return E_POINTER; + if(_parent != nullptr) + { + _parent->_children.remove(this); + } auto cparent = dynamic_cast(parent); - if (cparent == nullptr) - return E_INVALIDARG; - - _lastParent = cparent; + _parent = cparent; - if(Window != nullptr){ - // If one tries to show a child window with a minimized parent window, then the parent window will be - // restored but macOS isn't kind enough to *tell* us that, so the window will be left in a non-interactive - // state. Detect this and explicitly restore the parent window ourselves to avoid this situation. - if (cparent->WindowState() == Minimized) - cparent->SetWindowState(Normal); - - [Window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; - [cparent->Window addChildWindow:Window ordered:NSWindowAbove]; - - UpdateStyle(); + if(_parent != nullptr && Window != nullptr){ + // If one tries to show a child window with a minimized parent window, then the parent window will be + // restored but macOS isn't kind enough to *tell* us that, so the window will be left in a non-interactive + // state. Detect this and explicitly restore the parent window ourselves to avoid this situation. + if (cparent->WindowState() == Minimized) + cparent->SetWindowState(Normal); + + [Window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + + cparent->_children.push_back(this); + + UpdateStyle(); } return S_OK; } } +void WindowImpl::BringToFront() +{ + Activate(); + + for(auto iterator = _children.begin(); iterator != _children.end(); iterator++) + { + (*iterator)->BringToFront(); + } +} + +bool WindowImpl::CanBecomeKeyWindow() +{ + for(auto iterator = _children.begin(); iterator != _children.end(); iterator++) + { + if((*iterator)->IsDialog()) + { + return false; + } + } + + return true; +} + void WindowImpl::StartStateTransition() { _transitioningWindowState = true; } @@ -534,7 +558,7 @@ bool WindowImpl::IsDialog() { } NSWindowStyleMask WindowImpl::GetStyle() { - unsigned long s = this->_isDialog ? NSWindowStyleMaskDocModalWindow : NSWindowStyleMaskBorderless; + unsigned long s = NSWindowStyleMaskBorderless; switch (_decorations) { case SystemDecorationsNone: diff --git a/native/Avalonia.Native/src/OSX/WindowProtocol.h b/native/Avalonia.Native/src/OSX/WindowProtocol.h index 0e5c5869e7..cb5f86bdb9 100644 --- a/native/Avalonia.Native/src/OSX/WindowProtocol.h +++ b/native/Avalonia.Native/src/OSX/WindowProtocol.h @@ -11,7 +11,6 @@ @protocol AvnWindowProtocol -(void) pollModalSession: (NSModalSession _Nonnull) session; --(void) restoreParentWindow; -(bool) shouldTryToHandleEvents; -(void) setEnabled: (bool) enable; -(void) showAppMenuOnly; From dc1b6a669b8a90bc71344ea6b6df28e2b489e7a0 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 13:50:01 +0100 Subject: [PATCH 098/393] [osx] make bringtofront work correctly for owned and modal windows. --- native/Avalonia.Native/src/OSX/AvnView.mm | 5 ----- native/Avalonia.Native/src/OSX/AvnWindow.mm | 9 +++------ native/Avalonia.Native/src/OSX/WindowImpl.mm | 9 ++++++++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/AvnView.mm b/native/Avalonia.Native/src/OSX/AvnView.mm index bbb4d59adb..5436ad22f3 100644 --- a/native/Avalonia.Native/src/OSX/AvnView.mm +++ b/native/Avalonia.Native/src/OSX/AvnView.mm @@ -300,11 +300,6 @@ - (void)mouseDown:(NSEvent *)event { - if(_parent != nullptr) - { - _parent->BringToFront(); - } - _isLeftPressed = true; _lastMouseDownEvent = event; [self mouseEvent:event withType:LeftButtonDown]; diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index 1445227cf5..60fdb26121 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -183,11 +183,6 @@ return self; } -- (void)mouseDown:(NSEvent *)event -{ - _parent->BringToFront(); -} - - (BOOL)windowShouldClose:(NSWindow *)sender { auto window = dynamic_cast(_parent.getRaw()); @@ -435,8 +430,10 @@ _parent->BaseEvents->RawMouseEvent(NonClientLeftButtonDown, static_cast([event timestamp] * 1000), AvnInputModifiersNone, point, delta); } + + _parent->BringToFront(); } - break; + break; case NSEventTypeMouseEntered: { diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 5333cb23c8..8330f4ed86 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -126,7 +126,14 @@ HRESULT WindowImpl::SetParent(IAvnWindow *parent) { void WindowImpl::BringToFront() { - Activate(); + if(IsDialog()) + { + Activate(); + } + else + { + [Window orderFront:nullptr]; + } for(auto iterator = _children.begin(); iterator != _children.end(); iterator++) { From f7daa81fbe8d684c13d0d10c8fb2727734e2e480 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 14:10:33 +0100 Subject: [PATCH 099/393] dont create nspanel / nswindow at show. --- native/Avalonia.Native/src/OSX/WindowBaseImpl.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm index 77f0f47934..d105f4cf38 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm @@ -36,8 +36,10 @@ WindowBaseImpl::WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl) lastMaxSize = NSSize { CGFLOAT_MAX, CGFLOAT_MAX}; lastMinSize = NSSize { 0, 0 }; - Window = nullptr; lastMenu = nullptr; + + CreateNSWindow(false); + InitialiseNSWindow(); } HRESULT WindowBaseImpl::ObtainNSViewHandle(void **ret) { @@ -88,7 +90,6 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) { START_COM_CALL; @autoreleasepool { - CreateNSWindow(isDialog); InitialiseNSWindow(); if(hasPosition) @@ -585,6 +586,7 @@ void WindowBaseImpl::InitialiseNSWindow() { [Window setOpaque:false]; + [Window setHasShadow:true]; [Window invalidateShadow]; if (lastMenu != nullptr) { From 041fdb6bc9bcb06711c7715692e2d5771ad6a2eb Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 14:11:19 +0100 Subject: [PATCH 100/393] call bring to front when window is made key. --- native/Avalonia.Native/src/OSX/AvnWindow.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index 60fdb26121..52ee48317c 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -274,6 +274,11 @@ [super becomeKeyWindow]; } +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + _parent->BringToFront(); +} + - (void)windowDidMiniaturize:(NSNotification *)notification { auto parent = dynamic_cast(_parent.operator->()); From 2ea49defb60cf0a8412dabde876a2d8c27e1d8c5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 14:28:44 +0100 Subject: [PATCH 101/393] [osx] easily support using nspanel from windowbaseimpl. --- native/Avalonia.Native/src/OSX/WindowBaseImpl.h | 2 +- native/Avalonia.Native/src/OSX/WindowBaseImpl.mm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h index 62c0e2069d..4220811fc7 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.h +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.h @@ -26,7 +26,7 @@ BEGIN_INTERFACE_MAP() virtual ~WindowBaseImpl(); - WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl); + WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl, bool usePanel = false); virtual HRESULT ObtainNSWindowHandle(void **ret) override; diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm index d105f4cf38..e88c7f208c 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm @@ -21,7 +21,7 @@ WindowBaseImpl::~WindowBaseImpl() { Window = nullptr; } -WindowBaseImpl::WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl) { +WindowBaseImpl::WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl, bool usePanel) { _shown = false; _inResize = false; BaseEvents = events; @@ -38,7 +38,7 @@ WindowBaseImpl::WindowBaseImpl(IAvnWindowBaseEvents *events, IAvnGlContext *gl) lastMenu = nullptr; - CreateNSWindow(false); + CreateNSWindow(usePanel); InitialiseNSWindow(); } From 76abbc8fbef53c161763e0387d46ace4b22819e0 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 16:34:22 +0100 Subject: [PATCH 102/393] ensure frameSize is refreshed when window is show. --- src/Avalonia.Controls/TopLevel.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index 57fb82485c..f2e8cdb1cf 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -484,7 +484,11 @@ namespace Avalonia.Controls /// Raises the event. /// /// The event args. - protected virtual void OnOpened(EventArgs e) => Opened?.Invoke(this, e); + protected virtual void OnOpened(EventArgs e) + { + FrameSize = PlatformImpl?.FrameSize; + Opened?.Invoke(this, e); + } /// /// Raises the event. From 67b6811ca8d18ed7e4063cb712577a260a0de232 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 31 May 2022 16:34:33 +0100 Subject: [PATCH 103/393] add comment to show why test isnt working. --- samples/IntegrationTestApp/ShowWindowTest.axaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 9b55864caa..f5f87c5c1c 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -25,7 +25,7 @@ namespace IntegrationTestApp this.GetControl("FrameSize").Text = $"{FrameSize}"; this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; - this.GetControl("Scaling").Text = $"{((IRenderRoot)this).RenderScaling}"; + this.GetControl("Scaling").Text = $"{((IRenderRoot)this).RenderScaling}"; // TODO Use DesktopScaling from WindowImpl. if (Owner is not null) { From 5bf28b671d42b5682930e27014d5897fe90bda73 Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Tue, 31 May 2022 20:42:16 +0300 Subject: [PATCH 104/393] some fixes --- tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 70b713d6d0..aa32af7e51 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -379,7 +379,6 @@ namespace Avalonia.Controls.UnitTests }; var target = new ComboBox { - FlowDirection = FlowDirection.RightToLeft, Items = items, Template = GetTemplate() }; @@ -392,7 +391,7 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(FlowDirection.LeftToRight, rectangle.FlowDirection); parentContent.FlowDirection = FlowDirection.RightToLeft; - target.InvalidateMirrorTransform(); + target.FlowDirection = FlowDirection.RightToLeft; Assert.Equal(FlowDirection.RightToLeft, rectangle.FlowDirection); } From cef238d1950e7ec195f4d8f201181bde29b7f207 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 10:10:43 +0100 Subject: [PATCH 105/393] dispatch bring to front parent when removing a child window. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 8330f4ed86..7776b2912d 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -100,6 +100,11 @@ HRESULT WindowImpl::SetParent(IAvnWindow *parent) { if(_parent != nullptr) { _parent->_children.remove(this); + auto parent = _parent; + + dispatch_async(dispatch_get_main_queue(), ^{ + parent->BringToFront(); + }); } auto cparent = dynamic_cast(parent); From f017acae5685fe8b7c5f9fdf9cbd4308dea08c2e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 10:15:54 +0100 Subject: [PATCH 106/393] dialogs should not be minimizable. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 7776b2912d..8520e3e470 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -590,7 +590,7 @@ NSWindowStyleMask WindowImpl::GetStyle() { break; } - if ([Window parentWindow] == nullptr) { + if (!IsDialog()) { s |= NSWindowStyleMaskMiniaturizable; } From b6e66047f21cec797302c305b487b93881b7fa1c Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Wed, 1 Jun 2022 13:54:50 +0300 Subject: [PATCH 107/393] add fixes --- src/Avalonia.Controls/ComboBox.cs | 11 ++++++----- .../FlowDirectionTests.cs | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index 5ba1195159..05be5ad00d 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -434,11 +434,12 @@ namespace Avalonia.Controls { if (SelectionBoxItem is Rectangle rectangle) { - var content = (rectangle.Fill as VisualBrush)!.Visual as Control; - var flowDirection = (((IVisual)content!).VisualParent as Control)?.FlowDirection ?? - FlowDirection.LeftToRight; - - rectangle.FlowDirection = flowDirection; + if ((rectangle.Fill as VisualBrush)?.Visual is Control content) + { + var flowDirection = (((IVisual)content!).VisualParent as Control)?.FlowDirection ?? + FlowDirection.LeftToRight; + rectangle.FlowDirection = flowDirection; + } } } diff --git a/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs b/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs index 6739eff638..6c43103ecb 100644 --- a/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs +++ b/tests/Avalonia.Controls.UnitTests/FlowDirectionTests.cs @@ -17,7 +17,23 @@ namespace Avalonia.Controls.UnitTests } [Fact] - public void HasMirrorTransform_Of_Children_Is_Updated_After_Change() + public void HasMirrorTransform_Of_LTR_Children_Should_Be_True_For_RTL_Parent() + { + Control child; + var target = new Decorator + { + FlowDirection = FlowDirection.RightToLeft, + Child = child = new Control() + }; + + child.FlowDirection = FlowDirection.LeftToRight; + + Assert.True(target.HasMirrorTransform); + Assert.True(child.HasMirrorTransform); + } + + [Fact] + public void HasMirrorTransform_Of_Children_Is_Updated_After_Parent_Changeed() { Control child; var target = new Decorator From 0d6e3a55f016bf521263735eac066d26bab37d47 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 17:07:02 +0100 Subject: [PATCH 108/393] add test to show that osx chrome buttons are disabled when modal dialog is opened. --- .../WindowTests.cs | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 771faa1925..a82c46b927 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -22,6 +22,63 @@ namespace Avalonia.IntegrationTests.Appium tab.Click(); } + [PlatformFact(SkipOnWindows = true)] + public void OSX_Parent_Window_Has_Disabled_ChromeButtons_When_Modal_Dialog_Shown() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + try + { + var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); + var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); + var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); + var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + + var closeButton = + _session.FindElementByXPath( + "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[1]"); + + var zoomButton = + _session.FindElementByXPath( + "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[2]"); + + var miniturizeButton = + _session.FindElementByXPath( + "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[3]"); + + + Assert.True(closeButton.Enabled); + Assert.True(zoomButton.Enabled); + Assert.True(miniturizeButton.Enabled); + + sizeTextBox.SendKeys("400, 400"); + + modeComboBox.Click(); + _session.FindElementByName(ShowWindowMode.Modal.ToString()).SendClick(); + + locationComboBox.Click(); + _session.FindElementByName(WindowStartupLocation.CenterOwner.ToString()).SendClick(); + + showButton.Click(); + + SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); + + Assert.False(closeButton.Enabled); + Assert.False(zoomButton.Enabled); + Assert.False(miniturizeButton.Enabled); + } + finally + { + try + { + var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); + closeButton.Click(); + SwitchToMainWindowHack(mainWindowHandle); + } + catch { } + } + } + [Theory] [MemberData(nameof(StartupLocationData))] public void StartupLocation(string? size, ShowWindowMode mode, WindowStartupLocation location) @@ -52,7 +109,7 @@ namespace Avalonia.IntegrationTests.Appium var position = PixelPoint.Parse(_session.FindElementByAccessibilityId("Position").Text); var screenRect = PixelRect.Parse(_session.FindElementByAccessibilityId("ScreenRect").Text); var scaling = double.Parse(_session.FindElementByAccessibilityId("Scaling").Text); - + Assert.True(frameSize.Width >= clientSize.Width, "Expected frame width >= client width."); Assert.True(frameSize.Height > clientSize.Height, "Expected frame height > client height."); From b7397a7cdf710fe17d49ee3993196fefd734d74b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 17:56:36 +0100 Subject: [PATCH 109/393] add a11y identifiers for windows. --- samples/IntegrationTestApp/MainWindow.axaml | 1 + samples/IntegrationTestApp/ShowWindowTest.axaml | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml index 5151d80932..82348691e9 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml +++ b/samples/IntegrationTestApp/MainWindow.axaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="IntegrationTestApp.MainWindow" + Name="MainWindow" Title="IntegrationTestApp"> diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml b/samples/IntegrationTestApp/ShowWindowTest.axaml index e87ae0f32c..2525bfc866 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml @@ -1,6 +1,7 @@ From a7713dcda9d0b40d9f1dbcbd21ce2d4cea94f9ef Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 17:56:52 +0100 Subject: [PATCH 110/393] add a unit test for child window order osx. --- .../WindowTests.cs | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index a82c46b927..1f5ac052ec 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -2,7 +2,9 @@ using System.Linq; using System.Runtime.InteropServices; using Avalonia.Controls; +using OpenQA.Selenium; using OpenQA.Selenium.Appium; +using SeleniumExtras.PageObjects; using Xunit; using Xunit.Sdk; @@ -21,6 +23,79 @@ namespace Avalonia.IntegrationTests.Appium var tab = tabs.FindElementByName("Window"); tab.Click(); } + + [PlatformFact(SkipOnWindows = true)] + public void OSX_WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + try + { + var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); + var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); + var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); + var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + + var mainWindow = + _session.FindElementByAccessibilityId("MainWindow"); + + + + sizeTextBox.SendKeys("200, 100"); + + modeComboBox.Click(); + _session.FindElementByName(ShowWindowMode.Modal.ToString()).SendClick(); + + locationComboBox.Click(); + _session.FindElementByName(WindowStartupLocation.CenterOwner.ToString()).SendClick(); + + showButton.Click(); + + var secondaryWindow = _session.FindElementByAccessibilityId("SecondaryWindow"); + + mainWindow.Click(); + + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); + + int i = 0; + int mainWindowIndex = 0; + int secondaryWindowIndex = 0; + + foreach (var window in windows) + { + i++; + + var child = window.FindElementByXPath("XCUIElementTypeWindow"); + + switch (child.GetAttribute("identifier")) + { + case "MainWindow": + mainWindowIndex = i; + break; + + case "SecondaryWindow": + secondaryWindowIndex = i; + break; + } + + } + + Assert.Equal(1, secondaryWindowIndex); + Assert.Equal(2, mainWindowIndex); + + SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); + } + finally + { + try + { + var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); + closeButton.Click(); + SwitchToMainWindowHack(mainWindowHandle); + } + catch { } + } + } [PlatformFact(SkipOnWindows = true)] public void OSX_Parent_Window_Has_Disabled_ChromeButtons_When_Modal_Dialog_Shown() From a70dadea18bd0ff1fb9e0b1a6fa657659eb608a4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 1 Jun 2022 18:17:15 +0100 Subject: [PATCH 111/393] simplify test. --- .../WindowTests.cs | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 1f5ac052ec..8d6be4d199 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using Avalonia.Controls; @@ -39,8 +40,6 @@ namespace Avalonia.IntegrationTests.Appium var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - - sizeTextBox.SendKeys("200, 100"); modeComboBox.Click(); @@ -51,37 +50,15 @@ namespace Avalonia.IntegrationTests.Appium showButton.Click(); - var secondaryWindow = _session.FindElementByAccessibilityId("SecondaryWindow"); - mainWindow.Click(); var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); - int i = 0; - int mainWindowIndex = 0; - int secondaryWindowIndex = 0; + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); - foreach (var window in windows) - { - i++; - - var child = window.FindElementByXPath("XCUIElementTypeWindow"); - - switch (child.GetAttribute("identifier")) - { - case "MainWindow": - mainWindowIndex = i; - break; - - case "SecondaryWindow": - secondaryWindowIndex = i; - break; - } - - } - - Assert.Equal(1, secondaryWindowIndex); - Assert.Equal(2, mainWindowIndex); + Assert.Equal(0, secondaryWindowIndex); + Assert.Equal(1, mainWindowIndex); SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); } @@ -293,4 +270,13 @@ namespace Avalonia.IntegrationTests.Appium Modal } } + + static class Extensions + { + public static int GetWindowOrder(this IReadOnlyCollection elements, string identifier) + { + return elements.TakeWhile(x => + x.FindElementByXPath("XCUIElementTypeWindow")?.GetAttribute("identifier") != identifier).Count(); + } + } } From adfac7b69dbcdc79a676b04aaebe1db4d4d63b40 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 01:22:39 -0400 Subject: [PATCH 112/393] Implement tab selection validation and automatic width --- .../ColorView/ColorView.cs | 93 ++++++++++++++++++- .../Themes/Fluent/ColorView.xaml | 23 +++-- 2 files changed, 105 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 0363d9c182..96de734cc7 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -5,6 +5,7 @@ using Avalonia.Controls.Converters; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Media; +using Avalonia.Threading; namespace Avalonia.Controls { @@ -12,6 +13,7 @@ namespace Avalonia.Controls /// Presents a color for user editing using a spectrum, palette and component sliders. /// [TemplatePart("PART_HexTextBox", typeof(TextBox))] + [TemplatePart("PART_TabControl", typeof(TabControl))] public partial class ColorView : TemplatedControl { /// @@ -20,7 +22,8 @@ namespace Avalonia.Controls public event EventHandler? ColorChanged; // XAML template parts - private TextBox? _hexTextBox; + private TextBox? _hexTextBox; + private TabControl? _tabControl; private ObservableCollection _customPaletteColors = new ObservableCollection(); private ColorToHexConverter colorToHexConverter = new ColorToHexConverter(); @@ -31,7 +34,7 @@ namespace Avalonia.Controls /// public ColorView() : base() { - this.CustomPalette = new FluentColorPalette(); + CustomPalette = new FluentColorPalette(); } /// @@ -66,6 +69,77 @@ namespace Avalonia.Controls } } + /// + /// Validates the selected subview/tab taking into account the visibility of each subview/tab + /// as well as the current selection. + /// + private void ValidateSelectedTab() + { + if (_tabControl != null && + _tabControl.Items != null) + { + // Determine if any item is visible + bool isAnyItemVisible = false; + foreach (var item in _tabControl.Items) + { + if (item is Control control && + control.IsVisible) + { + isAnyItemVisible = true; + break; + } + } + + if (isAnyItemVisible) + { + object? selectedItem = null; + + if (_tabControl.SelectedItem == null && + _tabControl.ItemCount > 0) + { + // As a failsafe, forcefully select the first item + foreach (var item in _tabControl.Items) + { + selectedItem = item; + break; + } + } + else + { + selectedItem = _tabControl.SelectedItem; + } + + if (selectedItem is Control selectedControl && + selectedControl.IsVisible == false) + { + // Select the first visible item instead + foreach (var item in _tabControl.Items) + { + if (item is Control control && + control.IsVisible) + { + selectedItem = item; + break; + } + } + } + + _tabControl.SelectedItem = selectedItem; + _tabControl.IsVisible = true; + } + else + { + // Special case when all items are hidden + // If TabControl ever properly supports no selected item / + // all items hidden this can be removed + _tabControl.SelectedItem = null; + _tabControl.IsVisible = false; + } + } + + return; + } + /// protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { @@ -76,6 +150,8 @@ namespace Avalonia.Controls } _hexTextBox = e.NameScope.Find("PART_HexTextBox"); + _tabControl = e.NameScope.Find("PART_TabControl"); + SetColorToHexTextBox(); if (_hexTextBox != null) @@ -85,6 +161,7 @@ namespace Avalonia.Controls } base.OnApplyTemplate(e); + ValidateSelectedTab(); } /// @@ -143,6 +220,18 @@ namespace Avalonia.Controls } } } + else if (change.Property == IsColorComponentsVisibleProperty || + change.Property == IsColorPaletteVisibleProperty || + change.Property == IsColorSpectrumVisibleProperty) + { + // When the property changed notification is received here the visibility + // of individual tab items has not yet been updated though the bindings. + // Therefore, the validation is delayed until after bindings update. + Dispatcher.UIThread.Post(() => + { + ValidateSelectedTab(); + }, DispatcherPriority.Background); + } base.OnPropertyChanged(change); } diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index afc8682a66..420e3b2ae9 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -109,22 +109,29 @@ BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}" BorderThickness="0,1,0,0" />--> - 0,0,0,0 - - + @@ -181,8 +188,7 @@ - + @@ -257,8 +263,7 @@ - + From 1917def95927cb95d55a1d08ea14943cd5e03849 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 2 Jun 2022 14:15:02 +0100 Subject: [PATCH 113/393] full set of window tests for osx. --- .../ShowWindowTest.axaml.cs | 2 +- .../WindowTests.cs | 226 +++++++++++++----- 2 files changed, 165 insertions(+), 63 deletions(-) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index f5f87c5c1c..3f45f1c5ad 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -25,7 +25,7 @@ namespace IntegrationTestApp this.GetControl("FrameSize").Text = $"{FrameSize}"; this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; - this.GetControl("Scaling").Text = $"{((IRenderRoot)this).RenderScaling}"; // TODO Use DesktopScaling from WindowImpl. + this.GetControl("Scaling").Text = $"{PlatformImpl?.DesktopScaling}"; if (Owner is not null) { diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 8d6be4d199..b027c17ff3 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using System.Runtime.InteropServices; using Avalonia.Controls; using OpenQA.Selenium; @@ -24,53 +25,117 @@ namespace Avalonia.IntegrationTests.Appium var tab = tabs.FindElementByName("Window"); tab.Click(); } + + private IDisposable OpenWindow(ShowWindowMode mode, WindowStartupLocation location, int width = 200, int height = 100) + { + var mainWindow = GetCurrentWindowHandleHack(); + var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); + var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); + var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); + var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + + sizeTextBox.SendKeys($"{width}, {height}"); + + modeComboBox.Click(); + _session.FindElementByName(mode.ToString()).SendClick(); + + locationComboBox.Click(); + _session.FindElementByName(location.ToString()).SendClick(); + + showButton.Click(); + + return Disposable.Create(() => + { + try + { + SwitchToNewWindowHack(mainWindow); + var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); + closeButton.SendClick(); + } + catch { } + }); + } [PlatformFact(SkipOnWindows = true)] public void OSX_WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent() { var mainWindowHandle = GetCurrentWindowHandleHack(); + var mainWindow = + _session.FindElementByAccessibilityId("MainWindow"); + try { - var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); - var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); - var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); - var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + using (OpenWindow(ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + { + mainWindow.Click(); - var mainWindow = - _session.FindElementByAccessibilityId("MainWindow"); - - sizeTextBox.SendKeys("200, 100"); + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); - modeComboBox.Click(); - _session.FindElementByName(ShowWindowMode.Modal.ToString()).SendClick(); + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); - locationComboBox.Click(); - _session.FindElementByName(WindowStartupLocation.CenterOwner.ToString()).SendClick(); + Assert.Equal(0, secondaryWindowIndex); + Assert.Equal(1, mainWindowIndex); + } + } + finally + { + SwitchToMainWindowHack(mainWindowHandle); + } + } + + [PlatformFact(SkipOnWindows = true)] + public void OSX_WindowOrder_Owned_Dialog_Stays_InFront_Of_Parent() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + var mainWindow = + _session.FindElementByAccessibilityId("MainWindow"); - showButton.Click(); + try + { + using (OpenWindow(ShowWindowMode.Owned, WindowStartupLocation.CenterOwner)) + { + mainWindow.Click(); + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); + + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); + + Assert.Equal(0, secondaryWindowIndex); + Assert.Equal(1, mainWindowIndex); + } + } + finally + { + SwitchToMainWindowHack(mainWindowHandle); + } + } + + [PlatformFact(SkipOnWindows = true)] + public void OSX_WindowOrder_NonOwned_Window_Does_Not_Stay_InFront_Of_Parent() + { + var mainWindow = + _session.FindElementByAccessibilityId("MainWindow"); + + using (OpenWindow(ShowWindowMode.NonOwned, WindowStartupLocation.CenterOwner, 1400)) + { mainWindow.Click(); + var secondaryWindow = + _session.FindElementByAccessibilityId("SecondaryWindow"); + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); int mainWindowIndex = windows.GetWindowOrder("MainWindow"); int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); - - Assert.Equal(0, secondaryWindowIndex); - Assert.Equal(1, mainWindowIndex); - SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); - } - finally - { - try - { - var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); - closeButton.Click(); - SwitchToMainWindowHack(mainWindowHandle); - } - catch { } + Assert.Equal(1, secondaryWindowIndex); + Assert.Equal(0, mainWindowIndex); + + secondaryWindow.SendClick(); } } @@ -81,53 +146,54 @@ namespace Avalonia.IntegrationTests.Appium try { - var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); - var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); - var locationComboBox = _session.FindElementByAccessibilityId("ShowWindowLocation"); - var showButton = _session.FindElementByAccessibilityId("ShowWindow"); + var window = _session.FindWindowOuter("MainWindow"); - var closeButton = - _session.FindElementByXPath( - "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[1]"); - - var zoomButton = - _session.FindElementByXPath( - "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[2]"); - - var miniturizeButton = - _session.FindElementByXPath( - "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeButton[3]"); - + var (closeButton, zoomButton, miniturizeButton) + = window.GetChromeButtons(); Assert.True(closeButton.Enabled); Assert.True(zoomButton.Enabled); Assert.True(miniturizeButton.Enabled); - - sizeTextBox.SendKeys("400, 400"); - modeComboBox.Click(); - _session.FindElementByName(ShowWindowMode.Modal.ToString()).SendClick(); - - locationComboBox.Click(); - _session.FindElementByName(WindowStartupLocation.CenterOwner.ToString()).SendClick(); + using (OpenWindow(ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + { + SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); - showButton.Click(); - - SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); - - Assert.False(closeButton.Enabled); - Assert.False(zoomButton.Enabled); - Assert.False(miniturizeButton.Enabled); + Assert.False(closeButton.Enabled); + Assert.False(zoomButton.Enabled); + Assert.False(miniturizeButton.Enabled); + } } finally { - try + SwitchToMainWindowHack(mainWindowHandle); + } + } + + [PlatformFact(SkipOnWindows = true)] + public void OSX_Minimize_Button_Disabled_Modal_Dialog() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + try + { + using (OpenWindow(ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) { - var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); - closeButton.Click(); - SwitchToMainWindowHack(mainWindowHandle); + var secondaryWindow = _session.FindWindowOuter("SecondaryWindow"); + + var (closeButton, zoomButton, miniturizeButton) + = secondaryWindow.GetChromeButtons(); + + Assert.True(closeButton.Enabled); + Assert.True(zoomButton.Enabled); + Assert.False(miniturizeButton.Enabled); + + SwitchToNewWindowHack(oldWindowHandle: mainWindowHandle); } - catch { } + } + finally + { + SwitchToMainWindowHack(mainWindowHandle); } } @@ -257,6 +323,13 @@ namespace Avalonia.IntegrationTests.Appium if (Math.Abs(expected.Y - actual.Y) > 10) throw new EqualException(expected, actual); } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + if (Math.Abs(expected.X - actual.X) > 15) + throw new EqualException(expected, actual); + if (Math.Abs(expected.Y - actual.Y) > 15) + throw new EqualException(expected, actual); + } else { Assert.Equal(expected, actual); @@ -278,5 +351,34 @@ namespace Avalonia.IntegrationTests.Appium return elements.TakeWhile(x => x.FindElementByXPath("XCUIElementTypeWindow")?.GetAttribute("identifier") != identifier).Count(); } + + public static AppiumWebElement? FindWindowInner(this AppiumDriver session, string identifier) + { + return session.FindElementsByXPath("XCUIElementTypeWindow") + .FirstOrDefault(x => x.GetAttribute("identifier") == identifier); + } + + public static AppiumWebElement? FindWindowOuter(this AppiumDriver session, string identifier) + { + var windows = session.FindElementsByXPath("XCUIElementTypeWindow"); + + var window = windows.FirstOrDefault(x=>x.FindElementsByXPath("XCUIElementTypeWindow").Any(x => x.GetAttribute("identifier") == identifier)); + + return window; + } + + public static (AppiumWebElement? closeButton, AppiumWebElement? zoomButton, AppiumWebElement? miniturizeButton) GetChromeButtons (this AppiumWebElement outerWindow) + { + var closeButton = + outerWindow.FindElementByXPath("XCUIElementTypeButton[1]"); + + var zoomButton = + outerWindow.FindElementByXPath("XCUIElementTypeButton[2]"); + + var miniturizeButton = + outerWindow.FindElementByXPath("XCUIElementTypeButton[3]"); + + return (closeButton, zoomButton, miniturizeButton); + } } } From 827692fa272aaa841d352d5aef3d5b5f9c5614dd Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 2 Jun 2022 22:36:22 +0100 Subject: [PATCH 114/393] add test for osx modal dialog window order when clicking resize grip of parent. --- .../WindowTests.cs | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index b027c17ff3..59e705bd9b 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -3,9 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Reactive.Disposables; using System.Runtime.InteropServices; +using System.Threading.Tasks; using Avalonia.Controls; using OpenQA.Selenium; using OpenQA.Selenium.Appium; +using OpenQA.Selenium.Interactions; using SeleniumExtras.PageObjects; using Xunit; using Xunit.Sdk; @@ -50,7 +52,7 @@ namespace Avalonia.IntegrationTests.Appium { SwitchToNewWindowHack(mainWindow); var closeButton = _session.FindElementByAccessibilityId("CloseWindow"); - closeButton.SendClick(); + closeButton.Click(); } catch { } }); @@ -85,6 +87,43 @@ namespace Avalonia.IntegrationTests.Appium } } + [PlatformFact(SkipOnWindows = true)] + public void OSX_WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_Clicking_Resize_Grip() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + var mainWindow = + _session.FindWindowOuter("MainWindow"); + + try + { + using (OpenWindow(ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + { + new Actions(_session) + .MoveToElement(mainWindow, 100, 1) + .ClickAndHold() + .Perform(); + + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); + + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); + + new Actions(_session) + .MoveToElement(mainWindow, 100, 1) + .Release() + .Perform(); + + Assert.Equal(0, secondaryWindowIndex); + Assert.Equal(1, mainWindowIndex); + } + } + finally + { + SwitchToMainWindowHack(mainWindowHandle); + } + } + [PlatformFact(SkipOnWindows = true)] public void OSX_WindowOrder_Owned_Dialog_Stays_InFront_Of_Parent() { From a0af269d36b6300e941b1d9196746c08668528ec Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 2 Jun 2022 23:02:37 +0100 Subject: [PATCH 115/393] reset app after most tests, add test for fullscreen mode with modal osx. --- .../WindowTests.cs | 72 +++++++++++++++---- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 59e705bd9b..8bf429c2ed 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -84,6 +84,7 @@ namespace Avalonia.IntegrationTests.Appium finally { SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); } } @@ -121,6 +122,41 @@ namespace Avalonia.IntegrationTests.Appium finally { SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); + } + } + + [PlatformFact(SkipOnWindows = true)] + public void OSX_WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_In_Fullscreen() + { + var mainWindowHandle = GetCurrentWindowHandleHack(); + + var mainWindow = + _session.FindWindowOuter("MainWindow"); + + var buttons = mainWindow.GetChromeButtons(); + + buttons.zoomButton.Click(); + + Task.Delay(500).Wait(); + + try + { + using (OpenWindow(ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + { + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); + + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); + + Assert.Equal(0, secondaryWindowIndex); + Assert.Equal(1, mainWindowIndex); + } + } + finally + { + SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); } } @@ -150,31 +186,39 @@ namespace Avalonia.IntegrationTests.Appium finally { SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); } } - + [PlatformFact(SkipOnWindows = true)] public void OSX_WindowOrder_NonOwned_Window_Does_Not_Stay_InFront_Of_Parent() { var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - using (OpenWindow(ShowWindowMode.NonOwned, WindowStartupLocation.CenterOwner, 1400)) + try { - mainWindow.Click(); - - var secondaryWindow = - _session.FindElementByAccessibilityId("SecondaryWindow"); + using (OpenWindow(ShowWindowMode.NonOwned, WindowStartupLocation.CenterOwner, 1400)) + { + mainWindow.Click(); - var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); + var secondaryWindow = + _session.FindElementByAccessibilityId("SecondaryWindow"); - int mainWindowIndex = windows.GetWindowOrder("MainWindow"); - int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); + var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); - Assert.Equal(1, secondaryWindowIndex); - Assert.Equal(0, mainWindowIndex); - - secondaryWindow.SendClick(); + int mainWindowIndex = windows.GetWindowOrder("MainWindow"); + int secondaryWindowIndex = windows.GetWindowOrder("SecondaryWindow"); + + Assert.Equal(1, secondaryWindowIndex); + Assert.Equal(0, mainWindowIndex); + + secondaryWindow.SendClick(); + } + } + finally + { + _session.ResetApp(); } } @@ -206,6 +250,7 @@ namespace Avalonia.IntegrationTests.Appium finally { SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); } } @@ -233,6 +278,7 @@ namespace Avalonia.IntegrationTests.Appium finally { SwitchToMainWindowHack(mainWindowHandle); + _session.ResetApp(); } } From 55de1523c42ae438ef8997c0a72cc89b338ff2db Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 20:20:43 -0400 Subject: [PATCH 116/393] Support ignoring property changes in derived Color controls --- .../ColorPicker/ColorPicker.cs | 9 ++++++++ .../ColorSlider/ColorSlider.cs | 22 +++++++++---------- .../ColorView/ColorView.cs | 12 +++++----- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs index 140a24d6a1..d34a91d1bb 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs @@ -12,5 +12,14 @@ namespace Avalonia.Controls /// public class ColorPicker : ColorView { + /// + /// Initializes a new instance of the class. + /// + public ColorPicker() : base() + { + // Completely ignore property changes here + // The ColorView in the control template is responsible to manage this + base.ignorePropertyChanged = true; + } } } diff --git a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs index 957e5e7b77..a9ba5a20fa 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorSlider/ColorSlider.cs @@ -29,7 +29,7 @@ namespace Avalonia.Controls.Primitives /// private const double MaxHue = 359; - private bool disableUpdates = false; + protected bool ignorePropertyChanged = false; /// /// Initializes a new instance of the class. @@ -135,7 +135,7 @@ namespace Avalonia.Controls.Primitives /// /// /// Warning: This will trigger property changed updates. - /// Consider using externally. + /// Consider using externally. /// private void SetColorToSliderValues() { @@ -341,7 +341,7 @@ namespace Avalonia.Controls.Primitives /// protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { - if (disableUpdates) + if (ignorePropertyChanged) { base.OnPropertyChanged(change); return; @@ -350,7 +350,7 @@ namespace Avalonia.Controls.Primitives // Always keep the two color properties in sync if (change.Property == ColorProperty) { - disableUpdates = true; + ignorePropertyChanged = true; HsvColor = Color.ToHsv(); @@ -362,21 +362,21 @@ namespace Avalonia.Controls.Primitives change.GetOldValue(), change.GetNewValue())); - disableUpdates = false; + ignorePropertyChanged = false; } else if (change.Property == ColorModelProperty) { - disableUpdates = true; + ignorePropertyChanged = true; SetColorToSliderValues(); UpdateBackground(); UpdatePseudoClasses(); - disableUpdates = false; + ignorePropertyChanged = false; } else if (change.Property == HsvColorProperty) { - disableUpdates = true; + ignorePropertyChanged = true; Color = HsvColor.ToRgb(); @@ -388,7 +388,7 @@ namespace Avalonia.Controls.Primitives change.GetOldValue().ToRgb(), change.GetNewValue().ToRgb())); - disableUpdates = false; + ignorePropertyChanged = false; } else if (change.Property == IsRoundingEnabledProperty) { @@ -402,7 +402,7 @@ namespace Avalonia.Controls.Primitives change.Property == MinimumProperty || change.Property == MaximumProperty) { - disableUpdates = true; + ignorePropertyChanged = true; Color oldColor = Color; (var color, var hsvColor) = GetColorFromSliderValues(); @@ -421,7 +421,7 @@ namespace Avalonia.Controls.Primitives UpdatePseudoClasses(); OnColorChanged(new ColorChangedEventArgs(oldColor, Color)); - disableUpdates = false; + ignorePropertyChanged = false; } base.OnPropertyChanged(change); diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 96de734cc7..c19daf5f40 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -27,7 +27,7 @@ namespace Avalonia.Controls private ObservableCollection _customPaletteColors = new ObservableCollection(); private ColorToHexConverter colorToHexConverter = new ColorToHexConverter(); - private bool disableUpdates = false; + protected bool ignorePropertyChanged = false; /// /// Initializes a new instance of the class. @@ -167,7 +167,7 @@ namespace Avalonia.Controls /// protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { - if (disableUpdates) + if (ignorePropertyChanged) { base.OnPropertyChanged(change); return; @@ -176,7 +176,7 @@ namespace Avalonia.Controls // Always keep the two color properties in sync if (change.Property == ColorProperty) { - disableUpdates = true; + ignorePropertyChanged = true; HsvColor = Color.ToHsv(); SetColorToHexTextBox(); @@ -185,11 +185,11 @@ namespace Avalonia.Controls change.GetOldValue(), change.GetNewValue())); - disableUpdates = false; + ignorePropertyChanged = false; } else if (change.Property == HsvColorProperty) { - disableUpdates = true; + ignorePropertyChanged = true; Color = HsvColor.ToRgb(); SetColorToHexTextBox(); @@ -198,7 +198,7 @@ namespace Avalonia.Controls change.GetOldValue().ToRgb(), change.GetNewValue().ToRgb())); - disableUpdates = false; + ignorePropertyChanged = false; } else if (change.Property == CustomPaletteProperty) { From 36225e9132719d209d727cd4a6f7ef42c5b7f054 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 20:21:06 -0400 Subject: [PATCH 117/393] Use more standard binding in ColorPicker This doesn't currently work for some reason --- .../Themes/Fluent/ColorPicker.xaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index b3424d2cc1..6e5228039d 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -36,7 +36,7 @@ HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,1,0,1" /> - Date: Thu, 2 Jun 2022 20:21:16 -0400 Subject: [PATCH 118/393] Small improvements --- src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index c19daf5f40..d0ee5f9acd 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -54,7 +54,7 @@ namespace Avalonia.Controls // Re-apply the hex value // This ensure the hex color value is always valid and formatted correctly - _hexTextBox.Text = colorToHexConverter.Convert(Color, typeof(string), null, CultureInfo.CurrentCulture) as string; + SetColorToHexTextBox(); } } @@ -225,7 +225,7 @@ namespace Avalonia.Controls change.Property == IsColorSpectrumVisibleProperty) { // When the property changed notification is received here the visibility - // of individual tab items has not yet been updated though the bindings. + // of individual tab items has not yet been updated through the bindings. // Therefore, the validation is delayed until after bindings update. Dispatcher.UIThread.Post(() => { From b8be7ba4cb59eb1c406d794d76a6ad74d1d21a3a Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 21:05:47 -0400 Subject: [PATCH 119/393] Implement SelectedTabIndex in ColorView --- .../ColorView/ColorView.Properties.cs | 18 +++++++++++++++++- .../ColorView/ColorView.cs | 16 +++++++++++++++- .../ColorView/ColorViewTab.cs | 15 +++++++++------ .../Themes/Fluent/ColorView.xaml | 3 ++- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index a3267d88f2..a4897c99a2 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -8,7 +8,6 @@ namespace Avalonia.Controls /// public partial class ColorView { - // SelectedTabIndex // IsColorModelSelectorVisible // IsComponentSliderVisible @@ -198,6 +197,14 @@ namespace Avalonia.Controls nameof(MinValue), 0); + /// + /// Defines the property. + /// + public static readonly StyledProperty SelectedTabIndexProperty = + AvaloniaProperty.Register( + nameof(SelectedTabIndex), + (int)ColorViewTab.Spectrum); + /// /// Defines the property. /// @@ -413,6 +420,15 @@ namespace Avalonia.Controls set => SetValue(MinValueProperty, value); } + /// + /// Gets or sets the index of the selected subview/tab. + /// + public int SelectedTabIndex + { + get => GetValue(SelectedTabIndexProperty); + set => SetValue(SelectedTabIndexProperty, value); + } + /// public bool ShowAccentColors { diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index d0ee5f9acd..9809f1312b 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -73,7 +73,10 @@ namespace Avalonia.Controls /// Validates the selected subview/tab taking into account the visibility of each subview/tab /// as well as the current selection. /// - private void ValidateSelectedTab() + /// + /// Derived controls may re-implement this based on their default style / control template. + /// + protected virtual void ValidateSelectedTab() { if (_tabControl != null && _tabControl.Items != null) @@ -135,6 +138,8 @@ namespace Avalonia.Controls _tabControl.SelectedItem = null; _tabControl.IsVisible = false; } + + SelectedTabIndex = _tabControl.SelectedIndex; } return; @@ -232,6 +237,15 @@ namespace Avalonia.Controls ValidateSelectedTab(); }, DispatcherPriority.Background); } + else if (change.Property == SelectedTabIndexProperty) + { + // Again, it is necessary to wait for the SelectedTabIndex value to + // be applied to the TabControl through binding before validation occurs. + Dispatcher.UIThread.Post(() => + { + ValidateSelectedTab(); + }, DispatcherPriority.Background); + } base.OnPropertyChanged(change); } diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs index 534e833631..8e3433d819 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs @@ -1,23 +1,26 @@ namespace Avalonia.Controls { /// - /// Defines a specific subview (tab) within the . + /// Defines a specific subview/tab within the . /// + /// + /// This is indexed to match the default control template ordering. + /// public enum ColorViewTab { /// - /// The components subview with sliders and numeric input boxes. + /// The color spectrum subview with a box/ring spectrum and sliders. /// - Components, + Spectrum = 0, /// /// The color palette subview with a grid of selectable colors. /// - Palette, + Palette = 1, /// - /// The color spectrum subview with a box/ring spectrum and sliders. + /// The components subview with sliders and numeric input boxes. /// - Spectrum, + Components = 2, } } diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 420e3b2ae9..d6bf83ff44 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -112,7 +112,8 @@ + Width="350" + SelectedIndex="{Binding SelectedTabIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"> 0,0,0,0 From 10bc7b38cbb4795ef4d7a2ad8a32e13e4194d125 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 22:20:44 -0400 Subject: [PATCH 120/393] Rename 'EnumToBooleanConverter' to 'EnumToBoolConverter' Bool is shorter and is also slightly more commonly used in other converters. Bool matches the type as written in C# as well. --- .../Themes/Default/ColorSpectrum.xaml | 14 +++++++------- .../Themes/Fluent/ColorSpectrum.xaml | 14 +++++++------- .../Themes/Fluent/ColorView.xaml | 18 +++++++++--------- ...leanConverter.cs => EnumToBoolConverter.cs} | 13 ++++++------- 4 files changed, 29 insertions(+), 30 deletions(-) rename src/Avalonia.Controls/Converters/{EnumToBooleanConverter.cs => EnumToBoolConverter.cs} (82%) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml index 891e040e9f..c29f8f51e5 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml @@ -5,7 +5,7 @@ x:CompileBindings="True"> - + @@ -25,26 +25,26 @@ IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" RadiusX="{TemplateBinding CornerRadius, Converter={StaticResource TopLeftCornerRadius}}" RadiusY="{TemplateBinding CornerRadius, Converter={StaticResource BottomRightCornerRadius}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml index 779f228b97..6dd7ddd373 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSpectrum.xaml @@ -5,7 +5,7 @@ x:CompileBindings="True"> - + @@ -25,26 +25,26 @@ IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Box}}" RadiusX="{TemplateBinding CornerRadius, Converter={StaticResource TopLeftCornerRadius}}" RadiusY="{TemplateBinding CornerRadius, Converter={StaticResource BottomRightCornerRadius}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> + IsVisible="{TemplateBinding Shape, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static controls:ColorSpectrumShape.Ring}}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index d6bf83ff44..4b01de15a0 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -12,7 +12,7 @@ - + 48 @@ -351,12 +351,12 @@ Grid.Column="0" Content="RGB" CornerRadius="4,0,0,4" - IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolean}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=TwoWay}" /> + IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=TwoWay}" /> + IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Hsva}, Mode=TwoWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=OneWay}"/> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Hsva}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Hsva}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Hsva}, Mode=OneWay}" /> /// This converter is useful to enable binding of radio buttons with a selected enum value. /// - public class EnumToBooleanConverter : IValueConverter + public class EnumToBoolConverter : IValueConverter { /// public object? Convert( @@ -44,14 +44,13 @@ namespace Avalonia.Controls.Converters object? parameter, CultureInfo culture) { - if (value is bool boolValue) + if (value is bool boolValue && + boolValue == true) { - return boolValue ? parameter : BindingOperations.DoNothing; - } - else - { - return BindingOperations.DoNothing; + return parameter; } + + return BindingOperations.DoNothing; } } } From e0c936dbb4e2d48bc3367e0f13e3e2ac1d15002e Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 22:37:54 -0400 Subject: [PATCH 121/393] Add FlatColorPalette --- .../ColorPalette/FlatColorPalette.cs | 284 ++++++++++++++++++ .../ColorPalette/FluentColorPalette.cs | 6 - 2 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs new file mode 100644 index 0000000000..130d7e0edd --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs @@ -0,0 +1,284 @@ +using Avalonia.Media; +using Avalonia.Utilities; + +namespace Avalonia.Controls +{ + /// + /// Implements a reduced flat design or flat UI color palette. + /// + /// + /// See: + /// - https://htmlcolorcodes.com/color-chart/ + /// - https://htmlcolorcodes.com/color-chart/flat-design-color-chart/ + /// - http://designmodo.github.io/Flat-UI/ + /// + /// The GitHub project is licensed as MIT: https://github.com/designmodo/Flat-UI. + /// + /// + public class FlatColorPalette : IColorPalette + { + // The full Flat UI color chart has 10 rows and 20 columns + // See: https://htmlcolorcodes.com/assets/downloads/flat-design-colors/flat-design-color-chart.png + // This is a reduced palette for usability + private static Color[,] colorChart = new Color[,] + { + // Pomegranate + { + Color.FromArgb(0xFF, 0xF9, 0xEB, 0xEA), + Color.FromArgb(0xFF, 0xE6, 0xB0, 0xAA), + Color.FromArgb(0xFF, 0xCD, 0x61, 0x55), + Color.FromArgb(0xFF, 0xA9, 0x32, 0x26), + Color.FromArgb(0xFF, 0x7B, 0x24, 0x1C), + }, + + // Amethyst + { + Color.FromArgb(0xFF, 0xF5, 0xEE, 0xF8), + Color.FromArgb(0xFF, 0xD7, 0xBD, 0xE2), + Color.FromArgb(0xFF, 0xAF, 0x7A, 0xC5), + Color.FromArgb(0xFF, 0x88, 0x4E, 0xA0), + Color.FromArgb(0xFF, 0x63, 0x39, 0x74), + }, + + // Belize Hole + { + Color.FromArgb(0xFF, 0xEA, 0xF2, 0xF8), + Color.FromArgb(0xFF, 0xA9, 0xCC, 0xE3), + Color.FromArgb(0xFF, 0x54, 0x99, 0xC7), + Color.FromArgb(0xFF, 0x24, 0x71, 0xA3), + Color.FromArgb(0xFF, 0x1A, 0x52, 0x76), + }, + + // Turquoise + { + Color.FromArgb(0xFF, 0xE8, 0xF8, 0xF5), + Color.FromArgb(0xFF, 0xA3, 0xE4, 0xD7), + Color.FromArgb(0xFF, 0x48, 0xC9, 0xB0), + Color.FromArgb(0xFF, 0x17, 0xA5, 0x89), + Color.FromArgb(0xFF, 0x11, 0x78, 0x64), + }, + + // Nephritis + { + Color.FromArgb(0xFF, 0xE9, 0xF7, 0xEF), + Color.FromArgb(0xFF, 0xA9, 0xDF, 0xBF), + Color.FromArgb(0xFF, 0x52, 0xBE, 0x80), + Color.FromArgb(0xFF, 0x22, 0x99, 0x54), + Color.FromArgb(0xFF, 0x19, 0x6F, 0x3D), + }, + + // Sunflower + { + Color.FromArgb(0xFF, 0xFE, 0xF9, 0xE7), + Color.FromArgb(0xFF, 0xF9, 0xE7, 0x9F), + Color.FromArgb(0xFF, 0xF4, 0xD0, 0x3F), + Color.FromArgb(0xFF, 0xD4, 0xAC, 0x0D), + Color.FromArgb(0xFF, 0x9A, 0x7D, 0x0A), + }, + + // Carrot + { + Color.FromArgb(0xFF, 0xFD, 0xF2, 0xE9), + Color.FromArgb(0xFF, 0xF5, 0xCB, 0xA7), + Color.FromArgb(0xFF, 0xEB, 0x98, 0x4E), + Color.FromArgb(0xFF, 0xCA, 0x6F, 0x1E), + Color.FromArgb(0xFF, 0x93, 0x51, 0x16), + }, + + // Clouds + { + Color.FromArgb(0xFF, 0xFD, 0xFE, 0xFE), + Color.FromArgb(0xFF, 0xF7, 0xF9, 0xF9), + Color.FromArgb(0xFF, 0xF0, 0xF3, 0xF4), + Color.FromArgb(0xFF, 0xD0, 0xD3, 0xD4), + Color.FromArgb(0xFF, 0x97, 0x9A, 0x9A), + }, + + // Concrete + { + Color.FromArgb(0xFF, 0xF4, 0xF6, 0xF6), + Color.FromArgb(0xFF, 0xD5, 0xDB, 0xDB), + Color.FromArgb(0xFF, 0xAA, 0xB7, 0xB8), + Color.FromArgb(0xFF, 0x83, 0x91, 0x92), + Color.FromArgb(0xFF, 0x5F, 0x6A, 0x6A), + }, + + // Wet Asphalt + { + Color.FromArgb(0xFF, 0xEB, 0xED, 0xEF), + Color.FromArgb(0xFF, 0xAE, 0xB6, 0xBF), + Color.FromArgb(0xFF, 0x5D, 0x6D, 0x7E), + Color.FromArgb(0xFF, 0x2E, 0x40, 0x53), + Color.FromArgb(0xFF, 0x21, 0x2F, 0x3C), + }, + }; + + /// + /// Gets the index of the default shade of colors in this palette. + /// + public const int DefaultShadeIndex = 2; + + /// + /// The index in the color palette of the 'Pomegranate' color. + /// This index can correspond to multiple color shades. + /// + public const int PomegranateIndex = 0; + + /// + /// The index in the color palette of the 'Amethyst' color. + /// This index can correspond to multiple color shades. + /// + public const int AmethystIndex = 1; + + /// + /// The index in the color palette of the 'BelizeHole' color. + /// This index can correspond to multiple color shades. + /// + public const int BelizeHoleIndex = 2; + + /// + /// The index in the color palette of the 'Turquoise' color. + /// This index can correspond to multiple color shades. + /// + public const int TurquoiseIndex = 3; + + /// + /// The index in the color palette of the 'Nephritis' color. + /// This index can correspond to multiple color shades. + /// + public const int NephritisIndex = 4; + + /// + /// The index in the color palette of the 'Sunflower' color. + /// This index can correspond to multiple color shades. + /// + public const int SunflowerIndex = 5; + + /// + /// The index in the color palette of the 'Carrot' color. + /// This index can correspond to multiple color shades. + /// + public const int CarrotIndex = 6; + + /// + /// The index in the color palette of the 'Clouds' color. + /// This index can correspond to multiple color shades. + /// + public const int CloudsIndex = 7; + + /// + /// The index in the color palette of the 'Concrete' color. + /// This index can correspond to multiple color shades. + /// + public const int ConcreteIndex = 8; + + /// + /// The index in the color palette of the 'WetAsphalt' color. + /// This index can correspond to multiple color shades. + /// + public const int WetAsphaltIndex = 9; + + /// + public int ColorCount + { + // Table is transposed compared to the reference chart + get => colorChart.GetLength(0); + } + + /// + public int ShadeCount + { + // Table is transposed compared to the reference chart + get => colorChart.GetLength(1); + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFC0392B. + /// + public static Color Pomegranate + { + get => colorChart[PomegranateIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF9B59B6. + /// + public static Color Amethyst + { + get => colorChart[AmethystIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF2980B9. + /// + public static Color BelizeHole + { + get => colorChart[BelizeHoleIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF1ABC9C. + /// + public static Color Turquoise + { + get => colorChart[TurquoiseIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF27AE60. + /// + public static Color Nephritis + { + get => colorChart[NephritisIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFF1C40F. + /// + public static Color Sunflower + { + get => colorChart[SunflowerIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFE67E22. + /// + public static Color Carrot + { + get => colorChart[CarrotIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFECF0F1. + /// + public static Color Clouds + { + get => colorChart[CloudsIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF95A5A6. + /// + public static Color Concrete + { + get => colorChart[ConcreteIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF34495E. + /// + public static Color WetAsphalt + { + get => colorChart[WetAsphaltIndex, DefaultShadeIndex]; + } + + /// + public Color GetColor(int colorIndex, int shadeIndex) + { + // Table is transposed compared to the reference chart + return colorChart[ + MathUtilities.Clamp(colorIndex, 0, colorChart.GetLength(0) - 1), + MathUtilities.Clamp(shadeIndex, 0, colorChart.GetLength(1) - 1)]; + } + } +} diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs index b6f9a244b1..013e69ce20 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs @@ -103,12 +103,6 @@ namespace Avalonia.Controls } }; - /// - /// Gets the index of the default shade of colors in this palette. - /// This has little meaning in this palette as colors are not strictly separated by shade. - /// - public const int DefaultShadeIndex = 0; - /// /// Gets the total number of colors in this palette. /// A color is not necessarily a single value and may be composed of several shades. From fe2d51b111696298e35c3db629751006f8e5ceec Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 22:42:56 -0400 Subject: [PATCH 122/393] Add SixteenColorPalette --- .../ColorPalette/SixteenColorPalette.cs | 302 ++++++++++++++++++ 1 file changed, 302 insertions(+) create mode 100644 src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs new file mode 100644 index 0000000000..f3abfdfd7f --- /dev/null +++ b/src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs @@ -0,0 +1,302 @@ +using Avalonia.Media; +using Avalonia.Utilities; + +namespace Avalonia.Controls +{ + /// + /// Implements the standard sixteen color palette from the HTML 4.01 specification. + /// + /// + /// See https://en.wikipedia.org/wiki/Web_colors#HTML_color_names. + /// + public class SixteenColorPalette : IColorPalette + { + // The 16 standard colors from HTML and early Windows computers + // https://en.wikipedia.org/wiki/List_of_software_palettes + // https://en.wikipedia.org/wiki/Web_colors#HTML_color_names + private static Color[,] colorChart = new Color[,] + { + { + Colors.White, + Colors.Silver + }, + { + Colors.Gray, + Colors.Black + }, + { + Colors.Red, + Colors.Maroon + }, + { + Colors.Yellow, + Colors.Olive + }, + { + Colors.Lime, + Colors.Green + }, + { + Colors.Aqua, + Colors.Teal + }, + { + Colors.Blue, + Colors.Navy + }, + { + Colors.Fuchsia, + Colors.Purple + } + }; + + /// + /// Gets the index of the default shade of colors in this palette. + /// + public const int DefaultShadeIndex = 0; + + /// + /// The index in the color palette of the 'White' color. + /// This index can correspond to multiple color shades. + /// + public const int WhiteIndex = 0; + + /// + /// The index in the color palette of the 'Silver' color. + /// This index can correspond to multiple color shades. + /// + public const int SilverIndex = 1; + + /// + /// The index in the color palette of the 'Gray' color. + /// This index can correspond to multiple color shades. + /// + public const int GrayIndex = 2; + + /// + /// The index in the color palette of the 'Black' color. + /// This index can correspond to multiple color shades. + /// + public const int BlackIndex = 3; + + /// + /// The index in the color palette of the 'Red' color. + /// This index can correspond to multiple color shades. + /// + public const int RedIndex = 4; + + /// + /// The index in the color palette of the 'Maroon' color. + /// This index can correspond to multiple color shades. + /// + public const int MaroonIndex = 5; + + /// + /// The index in the color palette of the 'Yellow' color. + /// This index can correspond to multiple color shades. + /// + public const int YellowIndex = 6; + + /// + /// The index in the color palette of the 'Olive' color. + /// This index can correspond to multiple color shades. + /// + public const int OliveIndex = 7; + + /// + /// The index in the color palette of the 'Lime' color. + /// This index can correspond to multiple color shades. + /// + public const int LimeIndex = 8; + + /// + /// The index in the color palette of the 'Green' color. + /// This index can correspond to multiple color shades. + /// + public const int GreenIndex = 9; + + /// + /// The index in the color palette of the 'Aqua' color. + /// This index can correspond to multiple color shades. + /// + public const int AquaIndex = 10; + + /// + /// The index in the color palette of the 'Teal' color. + /// This index can correspond to multiple color shades. + /// + public const int TealIndex = 11; + + /// + /// The index in the color palette of the 'Blue' color. + /// This index can correspond to multiple color shades. + /// + public const int BlueIndex = 12; + + /// + /// The index in the color palette of the 'Navy' color. + /// This index can correspond to multiple color shades. + /// + public const int NavyIndex = 13; + + /// + /// The index in the color palette of the 'Fuchsia' color. + /// This index can correspond to multiple color shades. + /// + public const int FuchsiaIndex = 14; + + /// + /// The index in the color palette of the 'Purple' color. + /// This index can correspond to multiple color shades. + /// + public const int PurpleIndex = 15; + + /// + public int ColorCount + { + get => colorChart.GetLength(0); + } + + /// + public int ShadeCount + { + get => colorChart.GetLength(1); + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFFFFFFF. + /// + public static Color White + { + get => colorChart[WhiteIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFC0C0C0. + /// + public static Color Silver + { + get => colorChart[SilverIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF808080. + /// + public static Color Gray + { + get => colorChart[GrayIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF000000. + /// + public static Color Black + { + get => colorChart[BlackIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFFF0000. + /// + public static Color Red + { + get => colorChart[RedIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF800000. + /// + public static Color Maroon + { + get => colorChart[MaroonIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFFFFF00. + /// + public static Color Yellow + { + get => colorChart[YellowIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF808000. + /// + public static Color Olive + { + get => colorChart[OliveIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF00FF00. + /// + public static Color Lime + { + get => colorChart[LimeIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF008000. + /// + public static Color Green + { + get => colorChart[GreenIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF00FFFF. + /// + public static Color Aqua + { + get => colorChart[AquaIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF008080. + /// + public static Color Teal + { + get => colorChart[TealIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF0000FF. + /// + public static Color Blue + { + get => colorChart[BlueIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF000080. + /// + public static Color Navy + { + get => colorChart[NavyIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FFFF00FF. + /// + public static Color Fuchsia + { + get => colorChart[FuchsiaIndex, DefaultShadeIndex]; + } + + /// + /// Gets the palette defined color that has an ARGB value of #FF800080. + /// + public static Color Purple + { + get => colorChart[PurpleIndex, DefaultShadeIndex]; + } + + /// + public Color GetColor(int colorIndex, int shadeIndex) + { + return colorChart[ + MathUtilities.Clamp(colorIndex, 0, colorChart.GetLength(0) - 1), + MathUtilities.Clamp(shadeIndex, 0, colorChart.GetLength(1) - 1)]; + } + } +} From 5e8f0fb70119e88335a555c80082311c9ef26664 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 23:00:08 -0400 Subject: [PATCH 123/393] Add comment explaining rounding value selection --- src/Avalonia.Controls.ColorPicker/Helpers/ColorHelper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Avalonia.Controls.ColorPicker/Helpers/ColorHelper.cs b/src/Avalonia.Controls.ColorPicker/Helpers/ColorHelper.cs index 32a898ee71..7dc340ea16 100644 --- a/src/Avalonia.Controls.ColorPicker/Helpers/ColorHelper.cs +++ b/src/Avalonia.Controls.ColorPicker/Helpers/ColorHelper.cs @@ -64,6 +64,10 @@ namespace Avalonia.Controls.Primitives // It is also needlessly large as there are only ~140 known/named colors. // Therefore, rounding of the input color's component values is done to // reduce the color space into something more useful. + // + // The rounding value of 5 is specially chosen. + // It is a factor of 255 and therefore evenly divisible which improves + // the quality of the calculations. double rounding = 5; var roundedColor = new Color( 0xFF, From 4dcf13623d7e78698141f5f64742ec949e62afbb Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 23:02:18 -0400 Subject: [PATCH 124/393] Make ColorPalettes directory plural --- .../{ColorPalette => ColorPalettes}/FlatColorPalette.cs | 0 .../{ColorPalette => ColorPalettes}/FluentColorPalette.cs | 0 .../{ColorPalette => ColorPalettes}/IColorPalette.cs | 0 .../{ColorPalette => ColorPalettes}/SixteenColorPalette.cs | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/Avalonia.Controls.ColorPicker/{ColorPalette => ColorPalettes}/FlatColorPalette.cs (100%) rename src/Avalonia.Controls.ColorPicker/{ColorPalette => ColorPalettes}/FluentColorPalette.cs (100%) rename src/Avalonia.Controls.ColorPicker/{ColorPalette => ColorPalettes}/IColorPalette.cs (100%) rename src/Avalonia.Controls.ColorPicker/{ColorPalette => ColorPalettes}/SixteenColorPalette.cs (100%) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs similarity index 100% rename from src/Avalonia.Controls.ColorPicker/ColorPalette/FlatColorPalette.cs rename to src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FluentColorPalette.cs similarity index 100% rename from src/Avalonia.Controls.ColorPicker/ColorPalette/FluentColorPalette.cs rename to src/Avalonia.Controls.ColorPicker/ColorPalettes/FluentColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/IColorPalette.cs similarity index 100% rename from src/Avalonia.Controls.ColorPicker/ColorPalette/IColorPalette.cs rename to src/Avalonia.Controls.ColorPicker/ColorPalettes/IColorPalette.cs diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/SixteenColorPalette.cs similarity index 100% rename from src/Avalonia.Controls.ColorPicker/ColorPalette/SixteenColorPalette.cs rename to src/Avalonia.Controls.ColorPicker/ColorPalettes/SixteenColorPalette.cs From 63d1bdec3c3b05964b4b3f158d3dfde6ddbc4bcf Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 2 Jun 2022 23:08:24 -0400 Subject: [PATCH 125/393] Add resources to control accent color section size in ColorPreviewer --- .../Themes/Default/ColorPreviewer.xaml | 10 ++++++---- .../Themes/Fluent/ColorPreviewer.xaml | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml index 15e5ca1655..ac1531fe7a 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml @@ -9,6 +9,8 @@ + 80 + 40 - + - + - + + @@ -316,40 +316,40 @@ VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> - - + - + - + - + - + - From 58f9b443d9a40aff415d1021835794f003b5c025 Mon Sep 17 00:00:00 2001 From: robloo Date: Mon, 27 Jun 2022 00:45:54 -0400 Subject: [PATCH 248/393] Implement IsAlphaEnabled using coercion --- .../ColorView/ColorView.Properties.cs | 16 +++-- .../ColorView/ColorView.cs | 66 +++++++++++++++++++ .../Themes/Fluent/ColorView.xaml | 18 ++++- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index c7652833bf..e1da427542 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -15,7 +15,8 @@ namespace Avalonia.Controls AvaloniaProperty.Register( nameof(Color), Colors.White, - defaultBindingMode: BindingMode.TwoWay); + defaultBindingMode: BindingMode.TwoWay, + coerce: CoerceColor) ; /// /// Defines the property. @@ -48,7 +49,8 @@ namespace Avalonia.Controls AvaloniaProperty.Register( nameof(HsvColor), Colors.White.ToHsv(), - defaultBindingMode: BindingMode.TwoWay); + defaultBindingMode: BindingMode.TwoWay, + coerce: CoerceHsvColor); /// /// Defines the property. @@ -267,7 +269,8 @@ namespace Avalonia.Controls /// /// Gets or sets a value indicating whether the alpha component is enabled. - /// When disabled (set to false) the alpha component will be fixed to maximum. + /// When disabled (set to false) the alpha component will be fixed to maximum and + /// editing controls hidden. /// public bool IsAlphaEnabled { @@ -277,7 +280,8 @@ namespace Avalonia.Controls /// /// Gets or sets a value indicating whether the alpha component editing controls - /// (both Slider and TextBox) are visible. + /// (Slider(s) and TextBox) are visible. When hidden, the existing alpha component + /// value is maintained. /// /// /// Note that also controls the alpha @@ -353,7 +357,7 @@ namespace Avalonia.Controls /// /// /// All color components are controlled by this property but alpha can also be - /// controlled with . + /// controlled with and . /// public bool IsComponentSliderVisible { @@ -366,7 +370,7 @@ namespace Avalonia.Controls /// /// /// All color components are controlled by this property but alpha can also be - /// controlled with . + /// controlled with and . /// public bool IsComponentTextInputVisible { diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 4f95b4acfe..8fb80980d5 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -237,6 +237,12 @@ namespace Avalonia.Controls PaletteColors = newPaletteColors; } } + else if (change.Property == IsAlphaEnabledProperty) + { + // Manually coerce the HsvColor value + // (Color will be coerced automatically if HsvColor changes) + HsvColor = OnCoerceHsvColor(HsvColor); + } else if (change.Property == IsColorComponentsVisibleProperty || change.Property == IsColorPaletteVisibleProperty || change.Property == IsColorSpectrumVisibleProperty) @@ -271,6 +277,66 @@ namespace Avalonia.Controls ColorChanged?.Invoke(this, e); } + /// + /// Called when the property has to be coerced. + /// + /// The value to coerce. + protected virtual Color OnCoerceColor(Color value) + { + if (IsAlphaEnabled == false) + { + return new Color(255, value.R, value.G, value.B); + } + + return value; + } + + /// + /// Called when the property has to be coerced. + /// + /// The value to coerce. + protected virtual HsvColor OnCoerceHsvColor(HsvColor value) + { + if (IsAlphaEnabled == false) + { + return new HsvColor(1.0, value.H, value.S, value.V); + } + + return value; + } + + /// + /// Coerces/validates the property value. + /// + /// The instance. + /// The value to coerce. + /// The coerced/validated value. + private static Color CoerceColor(IAvaloniaObject instance, Color value) + { + if (instance is ColorView colorView) + { + return colorView.OnCoerceColor(value); + } + + return value; + } + + /// + /// Coerces/validates the property value. + /// + /// The instance. + /// The value to coerce. + /// The coerced/validated value. + private static HsvColor CoerceHsvColor(IAvaloniaObject instance, HsvColor value) + { + if (instance is ColorView colorView) + { + return colorView.OnCoerceHsvColor(value); + } + + return value; + } + /// /// Event handler for when a key is pressed within the Hex RGB value TextBox. /// This is used to trigger re-evaluation of the color based on the TextBox value. diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index af2c8e061f..97760ba94a 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -187,8 +187,16 @@ HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Margin="12,0,0,0" - IsVisible="{TemplateBinding IsAlphaVisible}" /> + Margin="12,0,0,0"> + + + + + + + @@ -565,6 +573,8 @@ VerticalAlignment="Center" /> + + + Date: Mon, 27 Jun 2022 00:49:59 -0400 Subject: [PATCH 249/393] Only set slider IsVisible once --- src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 97760ba94a..d43bc7e004 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -618,8 +618,7 @@ ColorModel="{TemplateBinding ColorModel, Mode=OneWay}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" HorizontalAlignment="Stretch" - VerticalAlignment="Center" - IsVisible="{TemplateBinding IsAlphaVisible}"> + VerticalAlignment="Center"> Date: Mon, 27 Jun 2022 00:53:49 -0400 Subject: [PATCH 250/393] Only disable alpha editing controls when IsAlphaEnabled is false Rely on IsAlphaVisible for visibility --- .../ColorView/ColorView.Properties.cs | 6 +++--- .../Themes/Fluent/ColorView.xaml | 20 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index e1da427542..d59c4d544a 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -270,7 +270,7 @@ namespace Avalonia.Controls /// /// Gets or sets a value indicating whether the alpha component is enabled. /// When disabled (set to false) the alpha component will be fixed to maximum and - /// editing controls hidden. + /// editing controls disabled. /// public bool IsAlphaEnabled { @@ -357,7 +357,7 @@ namespace Avalonia.Controls /// /// /// All color components are controlled by this property but alpha can also be - /// controlled with and . + /// controlled with . /// public bool IsComponentSliderVisible { @@ -370,7 +370,7 @@ namespace Avalonia.Controls /// /// /// All color components are controlled by this property but alpha can also be - /// controlled with and . + /// controlled with . /// public bool IsComponentTextInputVisible { diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index d43bc7e004..563f230cc9 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -187,11 +187,10 @@ HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Margin="12,0,0,0"> + Margin="12,0,0,0" + IsEnabled="{TemplateBinding IsAlphaEnabled}"> - @@ -564,7 +563,8 @@ BorderBrush="{DynamicResource TextControlBorderBrush}" BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" - VerticalAlignment="Center"> + VerticalAlignment="Center" + IsEnabled="{TemplateBinding IsAlphaEnabled}"> - + Value="{Binding Value, ElementName=AlphaComponentSlider}" + IsEnabled="{TemplateBinding IsAlphaEnabled}"> - + VerticalAlignment="Center" + IsEnabled="{TemplateBinding IsAlphaEnabled}"> - Date: Mon, 27 Jun 2022 00:56:56 -0400 Subject: [PATCH 251/393] Remove unused ValueConverterGroup --- .../Converters/ValueConverterGroup.cs | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/Avalonia.Controls.ColorPicker/Converters/ValueConverterGroup.cs diff --git a/src/Avalonia.Controls.ColorPicker/Converters/ValueConverterGroup.cs b/src/Avalonia.Controls.ColorPicker/Converters/ValueConverterGroup.cs deleted file mode 100644 index 2710c220f4..0000000000 --- a/src/Avalonia.Controls.ColorPicker/Converters/ValueConverterGroup.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using Avalonia.Data.Converters; - -namespace Avalonia.Controls.Primitives.Converters -{ - /// - /// Converter to chain together multiple converters. - /// - public class ValueConverterGroup : List, IValueConverter - { - /// - /// - public object? Convert( - object? value, - Type targetType, - object? parameter, - CultureInfo culture) - { - object? curValue; - - curValue = value; - for (int i = 0; i < Count; i++) - { - curValue = this[i].Convert(curValue, targetType, parameter, culture); - } - - return curValue; - } - - /// - public object? ConvertBack( - object? value, - Type targetType, - object? parameter, - CultureInfo culture) - { - object? curValue; - - curValue = value; - for (int i = (Count - 1); i >= 0; i--) - { - curValue = this[i].ConvertBack(curValue, targetType, parameter, culture); - } - - return curValue; - } - } -} From f4a38437314b00f99122c2b36d14a016c26a8c52 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Mon, 27 Jun 2022 09:49:21 +0200 Subject: [PATCH 252/393] Fix unit test --- tests/Avalonia.Controls.UnitTests/TextBlockTests.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/TextBlockTests.cs b/tests/Avalonia.Controls.UnitTests/TextBlockTests.cs index 6da011f062..37dde9fbac 100644 --- a/tests/Avalonia.Controls.UnitTests/TextBlockTests.cs +++ b/tests/Avalonia.Controls.UnitTests/TextBlockTests.cs @@ -20,13 +20,11 @@ namespace Avalonia.Controls.UnitTests } [Fact] - public void Default_Text_Value_Should_Be_EmptyString() + public void Default_Text_Value_Should_Be_Null() { var textBlock = new TextBlock(); - Assert.Equal( - "", - textBlock.Text); + Assert.Equal(null, textBlock.Text); } [Fact] From dfa0c44269a05206bcbb288ea575ad4bc44c3ffa Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 10:16:37 +0200 Subject: [PATCH 253/393] Set actualWindowState earlier. Previously, `_actualWindowState` was being set after the window state had finished changing, but `ExitFullScreenMode` calls `UpdateStyle` which expects `_actualWindowState` to be up-to-date, meaning that previously we ended up with an invalid size when exiting full screen mode programatically. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 6db586f3ca..5b0c7813f7 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -488,6 +488,8 @@ HRESULT WindowImpl::SetWindowState(AvnWindowState state) { } if (_shown) { + _actualWindowState = _lastWindowState; + switch (state) { case Maximized: if (currentState == FullScreen) { @@ -545,7 +547,6 @@ HRESULT WindowImpl::SetWindowState(AvnWindowState state) { break; } - _actualWindowState = _lastWindowState; WindowEvents->WindowStateChanged(_actualWindowState); } From 519e850bf838a42dbc8243c37ecf0348175424ed Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 12:49:08 +0200 Subject: [PATCH 254/393] Correctly update position. `Window.Position` isn't an Avalonia property so doesn't auto-update, we need to listen for `PositionChanged`. --- samples/IntegrationTestApp/ShowWindowTest.axaml | 3 +-- samples/IntegrationTestApp/ShowWindowTest.axaml.cs | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml b/samples/IntegrationTestApp/ShowWindowTest.axaml index a861130cd0..40c1642e91 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml @@ -13,8 +13,7 @@ Text="{Binding FrameSize, Mode=OneWay}"/> - + diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 69b6d64557..42df0b704f 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -12,6 +12,7 @@ namespace IntegrationTestApp { InitializeComponent(); DataContext = this; + PositionChanged += (s, e) => this.GetControl("Position").Text = $"{Position}"; } private void InitializeComponent() @@ -22,6 +23,7 @@ namespace IntegrationTestApp protected override void OnOpened(EventArgs e) { base.OnOpened(e); + this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; this.GetControl("Scaling").Text = $"{PlatformImpl?.DesktopScaling}"; From 267710787e933c3719e20b3337b3f5e504f24edd Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 12:51:36 +0200 Subject: [PATCH 255/393] Tweak tests. - Add a retry to `GetWindowInfo` - Owned windows can't go fullscreen on macOS. --- .../WindowTests.cs | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 727a0b5406..d763848899 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.InteropServices; +using System.Threading; using Avalonia.Controls; using OpenQA.Selenium.Appium; using Xunit; @@ -68,16 +69,24 @@ namespace Avalonia.IntegrationTests.Appium Assert.Equal(original.Position, current.Position); Assert.Equal(original.FrameSize, current.FrameSize); - windowState.Click(); - _session.FindElementByName("Fullscreen").SendClick(); - Assert.Equal("Fullscreen", windowState.GetComboBoxValue()); + // On macOS, only non-owned windows can go fullscreen. + if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || mode == ShowWindowMode.NonOwned) + { + windowState.Click(); + _session.FindElementByName("Fullscreen").SendClick(); + Assert.Equal("Fullscreen", windowState.GetComboBoxValue()); - windowState.Click(); - _session.FindElementByName("Normal").SendClick(); + current = GetWindowInfo(); + Assert.True(current.ClientSize.Width >= current.ScreenRect.Width); + Assert.True(current.ClientSize.Height >= current.ScreenRect.Height); - current = GetWindowInfo(); - Assert.Equal(original.Position, current.Position); - Assert.Equal(original.FrameSize, current.FrameSize); + windowState.Click(); + _session.FindElementByName("Normal").SendClick(); + + current = GetWindowInfo(); + Assert.Equal(original.Position, current.Position); + Assert.Equal(original.FrameSize, current.FrameSize); + } } public static TheoryData StartupLocationData() @@ -149,13 +158,26 @@ namespace Avalonia.IntegrationTests.Appium private WindowInfo GetWindowInfo() { - return new( - Size.Parse(_session.FindElementByAccessibilityId("ClientSize").Text), - Size.Parse(_session.FindElementByAccessibilityId("FrameSize").Text), - PixelPoint.Parse(_session.FindElementByAccessibilityId("Position").Text), - PixelRect.Parse(_session.FindElementByAccessibilityId("ScreenRect").Text), - double.Parse(_session.FindElementByAccessibilityId("Scaling").Text)); + var retry = 0; + for (;;) + { + try + { + return new( + Size.Parse(_session.FindElementByAccessibilityId("ClientSize").Text), + Size.Parse(_session.FindElementByAccessibilityId("FrameSize").Text), + PixelPoint.Parse(_session.FindElementByAccessibilityId("Position").Text), + PixelRect.Parse(_session.FindElementByAccessibilityId("ScreenRect").Text), + double.Parse(_session.FindElementByAccessibilityId("Scaling").Text)); + } + catch (OpenQA.Selenium.NoSuchElementException e) when (retry++ < 3) + { + // MacOS sometimes seems to need a bit of time to get itself back in order after switching out + // of fullscreen. + Thread.Sleep(1000); + } + } } public enum ShowWindowMode From 4b08e659f69a3133a22653d4a73c9a5c320bf3b7 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 13:48:22 +0200 Subject: [PATCH 256/393] Revert "Fix window minimization." This reverts commit 20ddbad2adf97e93765cbe89f6532a9b945242e2. It didn't work with owned windows, there's something else going on here. --- native/Avalonia.Native/src/OSX/AvnWindow.mm | 3 --- 1 file changed, 3 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/AvnWindow.mm b/native/Avalonia.Native/src/OSX/AvnWindow.mm index 9569ea1cbe..ebd9f39d30 100644 --- a/native/Avalonia.Native/src/OSX/AvnWindow.mm +++ b/native/Avalonia.Native/src/OSX/AvnWindow.mm @@ -440,9 +440,6 @@ { case NSEventTypeLeftMouseDown: { - if ([self isMiniaturized]) - break; - AvnView* view = _parent->View; NSPoint windowPoint = [event locationInWindow]; NSPoint viewPoint = [view convertPoint:windowPoint fromView:nil]; From 2822f5bfcb35344eabea8efbdaae526b32b2512c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 14:02:25 +0200 Subject: [PATCH 257/393] Fix window minimization attempt 2. The previous solution didn't work for owned windows. Hopefully this fixes the problem at its root: that `BringToFront` activates a window even if it's miniaturized. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 5b0c7813f7..85a89955f4 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -119,13 +119,16 @@ void WindowImpl::BringToFront() { if(Window != nullptr) { - if(IsDialog()) + if (![Window isMiniaturized]) { - Activate(); - } - else - { - [Window orderFront:nullptr]; + if(IsDialog()) + { + Activate(); + } + else + { + [Window orderFront:nullptr]; + } } [Window invalidateShadow]; From cd04964c850545cafd54e42cbfc1cd64de145d86 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 17:37:44 +0200 Subject: [PATCH 258/393] Added a retry to macOS window tests. MacOS sometimes seems to need a bit of time to get itself back in order after switching out of fullscreen. --- .../WindowTests_MacOS.cs | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs index a460dc1d68..57c1476d95 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs @@ -17,11 +17,27 @@ namespace Avalonia.IntegrationTests.Appium public WindowTests_MacOS(TestAppFixture fixture) { + var retry = 0; + _session = fixture.Session; - var tabs = _session.FindElementByAccessibilityId("MainTabs"); - var tab = tabs.FindElementByName("Window"); - tab.Click(); + for (;;) + { + try + { + var tabs = _session.FindElementByAccessibilityId("MainTabs"); + var tab = tabs.FindElementByName("Window"); + tab.Click(); + return; + } + catch (WebDriverException e) when (retry++ < 3) + { + // MacOS sometimes seems to need a bit of time to get itself back in order after switching out + // of fullscreen. + Thread.Sleep(1000); + } + } + } [PlatformFact(TestPlatforms.MacOS)] @@ -41,7 +57,7 @@ namespace Avalonia.IntegrationTests.Appium Assert.Equal(1, mainWindowIndex); } } - + [PlatformFact(TestPlatforms.MacOS)] public void WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_Clicking_Resize_Grip() { @@ -57,7 +73,7 @@ namespace Avalonia.IntegrationTests.Appium var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); var mainWindowIndex = GetWindowOrder(windows, "MainWindow"); var secondaryWindowIndex = GetWindowOrder(windows, "SecondaryWindow"); - + new Actions(_session) .MoveToElement(mainWindow, 100, 1) .Release() @@ -67,13 +83,13 @@ namespace Avalonia.IntegrationTests.Appium Assert.Equal(1, mainWindowIndex); } } - + [PlatformFact(TestPlatforms.MacOS)] public void WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_In_Fullscreen() { var mainWindow = FindWindow(_session, "MainWindow"); var buttons = mainWindow.GetChromeButtons(); - + buttons.maximize.Click(); Thread.Sleep(500); @@ -88,6 +104,8 @@ namespace Avalonia.IntegrationTests.Appium Assert.Equal(0, secondaryWindowIndex); Assert.Equal(1, mainWindowIndex); + + Thread.Sleep(5000); } } finally @@ -95,7 +113,7 @@ namespace Avalonia.IntegrationTests.Appium _session.FindElementByAccessibilityId("ExitFullscreen").Click(); } } - + [PlatformFact(TestPlatforms.MacOS)] public void WindowOrder_Owned_Dialog_Stays_InFront_Of_Parent() { @@ -140,7 +158,7 @@ namespace Avalonia.IntegrationTests.Appium { var window = FindWindow(_session, "MainWindow"); var (closeButton, miniaturizeButton, zoomButton) = window.GetChromeButtons(); - + Assert.True(closeButton.Enabled); Assert.True(zoomButton.Enabled); Assert.True(miniaturizeButton.Enabled); @@ -152,7 +170,7 @@ namespace Avalonia.IntegrationTests.Appium Assert.False(miniaturizeButton.Enabled); } } - + [PlatformFact(TestPlatforms.MacOS)] public void Minimize_Button_Is_Disabled_On_Modal_Dialog() { @@ -160,7 +178,7 @@ namespace Avalonia.IntegrationTests.Appium { var secondaryWindow = FindWindow(_session, "SecondaryWindow"); var (closeButton, miniaturizeButton, zoomButton) = secondaryWindow.GetChromeButtons(); - + Assert.True(closeButton.Enabled); Assert.True(zoomButton.Enabled); Assert.False(miniaturizeButton.Enabled); @@ -195,7 +213,7 @@ namespace Avalonia.IntegrationTests.Appium private static AppiumWebElement FindWindow(AppiumDriver session, string identifier) { var windows = session.FindElementsByXPath("XCUIElementTypeWindow"); - return windows.First(x => + return windows.First(x => x.FindElementsByXPath("XCUIElementTypeWindow") .Any(y => y.GetAttribute("identifier") == identifier)); } From 2ab262136c33b4bfa448fa54553ddfb55c4094f6 Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Mon, 27 Jun 2022 18:56:01 +0300 Subject: [PATCH 259/393] Removed duplicate concatination The type system concatenates the target to references internally. --- src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs index fa437de186..b39ceab1b6 100644 --- a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs +++ b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs @@ -49,9 +49,9 @@ namespace Avalonia.Build.Tasks string projectDirectory, string output, bool verifyIl, MessageImportance logImportance, string strongNameKey, bool patchCom, bool skipXamlCompilation, bool debuggerLaunch) { - var typeSystem = new CecilTypeSystem(references - .Where(r => !r.ToLowerInvariant().EndsWith("avalonia.build.tasks.dll")) - .Concat(new[] { input }), input); + var typeSystem = new CecilTypeSystem( + references.Where(r => !r.ToLowerInvariant().EndsWith("avalonia.build.tasks.dll")), + input); var asm = typeSystem.TargetAssemblyDefinition; From 19c55102e5667f1bed4715f96b01a4f0a0abf81d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 18:52:45 +0200 Subject: [PATCH 260/393] Use manual window startup location in macOS tests. Seems to cause less flaky tests; `mainWindow.Click()` clicks the main window in the middle, where the secondary window is shown, so don't go out of our way to put the secondary window in front of where we're clicking. --- .../WindowTests_MacOS.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs index 57c1476d95..c88f87562d 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs @@ -45,7 +45,7 @@ namespace Avalonia.IntegrationTests.Appium { var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.Manual)) { mainWindow.Click(); @@ -63,7 +63,7 @@ namespace Avalonia.IntegrationTests.Appium { var mainWindow = FindWindow(_session, "MainWindow"); - using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.Manual)) { new Actions(_session) .MoveToElement(mainWindow, 100, 1) @@ -96,7 +96,7 @@ namespace Avalonia.IntegrationTests.Appium try { - using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.CenterOwner)) + using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Modal, WindowStartupLocation.Manual)) { var windows = _session.FindElements(By.XPath("XCUIElementTypeWindow")); var mainWindowIndex = GetWindowOrder(windows, "MainWindow"); @@ -119,7 +119,7 @@ namespace Avalonia.IntegrationTests.Appium { var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Owned, WindowStartupLocation.CenterOwner)) + using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Owned, WindowStartupLocation.Manual)) { mainWindow.Click(); @@ -137,7 +137,7 @@ namespace Avalonia.IntegrationTests.Appium { var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - using (OpenWindow(new PixelSize(1400, 100), ShowWindowMode.NonOwned, WindowStartupLocation.CenterOwner)) + using (OpenWindow(new PixelSize(1400, 100), ShowWindowMode.NonOwned, WindowStartupLocation.Manual)) { mainWindow.Click(); From 4f84950c41d00f97ecf0be91802b24c3800f4fc2 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 21:33:26 +0200 Subject: [PATCH 261/393] Added tests for #8335. --- samples/IntegrationTestApp/MainWindow.axaml | 1 + .../IntegrationTestApp/MainWindow.axaml.cs | 17 +++++++++-- .../PlatformTheoryAttribute.cs | 29 +++++++++++++++++++ .../WindowTests_MacOS.cs | 26 +++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml index aa2191c26b..3377979199 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml +++ b/samples/IntegrationTestApp/MainWindow.axaml @@ -112,6 +112,7 @@ + diff --git a/samples/IntegrationTestApp/MainWindow.axaml.cs b/samples/IntegrationTestApp/MainWindow.axaml.cs index 1aba10ec30..9e180b12c5 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml.cs +++ b/samples/IntegrationTestApp/MainWindow.axaml.cs @@ -82,7 +82,7 @@ namespace IntegrationTestApp break; } } - + private void SendToBack() { var lifetime = (ClassicDesktopStyleApplicationLifetime)Application.Current!.ApplicationLifetime!; @@ -92,7 +92,18 @@ namespace IntegrationTestApp window.Activate(); } } - + + private void RestoreAll() + { + var lifetime = (ClassicDesktopStyleApplicationLifetime)Application.Current!.ApplicationLifetime!; + + foreach (var window in lifetime.Windows) + { + if (window.WindowState == WindowState.Minimized) + window.WindowState = WindowState.Normal; + } + } + private void MenuClicked(object? sender, RoutedEventArgs e) { var clickedMenuItemTextBlock = this.FindControl("ClickedMenuItem"); @@ -117,6 +128,8 @@ namespace IntegrationTestApp SendToBack(); if (source?.Name == "ExitFullscreen") WindowState = WindowState.Normal; + if (source?.Name == "RestoreAll") + RestoreAll(); } } } diff --git a/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs b/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs new file mode 100644 index 0000000000..7ac30ee11b --- /dev/null +++ b/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs @@ -0,0 +1,29 @@ +using System; +using System.Linq; +using System.Runtime.InteropServices; +using Xunit; + +namespace Avalonia.IntegrationTests.Appium +{ + internal class PlatformTheoryAttribute : TheoryAttribute + { + public PlatformTheoryAttribute(TestPlatforms platforms = TestPlatforms.All) => Platforms = platforms; + + public TestPlatforms Platforms { get; } + + public override string? Skip + { + get => IsSupported() ? null : $"Ignored on {RuntimeInformation.OSDescription}"; + set => throw new NotSupportedException(); + } + + private bool IsSupported() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + return Platforms.HasAnyFlag(TestPlatforms.Windows); + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + return Platforms.HasAnyFlag(TestPlatforms.MacOS); + return false; + } + } +} diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs index c88f87562d..15ca78fdac 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs @@ -185,6 +185,32 @@ namespace Avalonia.IntegrationTests.Appium } } + [PlatformTheory(TestPlatforms.MacOS)] + [InlineData(ShowWindowMode.NonOwned)] + [InlineData(ShowWindowMode.Owned)] + public void Minimize_Button_Minimizes_Window(ShowWindowMode mode) + { + using (OpenWindow(new PixelSize(200, 100), mode, WindowStartupLocation.Manual)) + { + var secondaryWindow = FindWindow(_session, "SecondaryWindow"); + var (_, miniaturizeButton, _) = secondaryWindow.GetChromeButtons(); + + miniaturizeButton.Click(); + Thread.Sleep(1000); + + var hittable = _session.FindElementsByXPath("/XCUIElementTypeApplication/XCUIElementTypeWindow") + .Select(x => x.GetAttribute("hittable")).ToList(); + Assert.Equal(new[] { "true", "false" }, hittable); + + _session.FindElementByAccessibilityId("RestoreAll").Click(); + Thread.Sleep(1000); + + hittable = _session.FindElementsByXPath("/XCUIElementTypeApplication/XCUIElementTypeWindow") + .Select(x => x.GetAttribute("hittable")).ToList(); + Assert.Equal(new[] { "true", "true" }, hittable); + } + } + private IDisposable OpenWindow(PixelSize? size, ShowWindowMode mode, WindowStartupLocation location) { var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); From 715633930496163c094e0fdaa34aea9dbc5c12ed Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 22:25:27 +0200 Subject: [PATCH 262/393] Test CenterOwner window position. --- .../ShowWindowTest.axaml.cs | 6 ++- .../WindowTests.cs | 38 ++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 42df0b704f..001f186761 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -1,4 +1,5 @@ using System; +using Avalonia; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; @@ -23,15 +24,16 @@ namespace IntegrationTestApp protected override void OnOpened(EventArgs e) { base.OnOpened(e); + var scaling = PlatformImpl!.DesktopScaling; this.GetControl("Position").Text = $"{Position}"; this.GetControl("ScreenRect").Text = $"{Screens.ScreenFromVisual(this)?.WorkingArea}"; - this.GetControl("Scaling").Text = $"{PlatformImpl?.DesktopScaling}"; + this.GetControl("Scaling").Text = $"{scaling}"; if (Owner is not null) { var ownerRect = this.GetControl("OwnerRect"); var owner = (Window)Owner; - ownerRect.Text = $"{owner.Position}, {owner.FrameSize}"; + ownerRect.Text = $"{owner.Position}, {PixelSize.FromSize(owner.FrameSize!.Value, scaling)}"; } } } diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index d763848899..6a364e5fc0 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -24,11 +24,14 @@ namespace Avalonia.IntegrationTests.Appium [Theory] [MemberData(nameof(StartupLocationData))] - public void StartupLocation(PixelSize? size, ShowWindowMode mode, WindowStartupLocation location) + public void StartupLocation(Size? size, ShowWindowMode mode, WindowStartupLocation location) { using var window = OpenWindow(size, mode, location); var info = GetWindowInfo(); + if (size.HasValue) + Assert.Equal(size.Value, info.ClientSize); + Assert.True(info.FrameSize.Width >= info.ClientSize.Width, "Expected frame width >= client width."); Assert.True(info.FrameSize.Height > info.ClientSize.Height, "Expected frame height > client height."); @@ -37,11 +40,18 @@ namespace Avalonia.IntegrationTests.Appium switch (location) { case WindowStartupLocation.CenterScreen: - { - var expected = info.ScreenRect.CenterRect(frameRect); - AssertCloseEnough(expected.Position, frameRect.Position); - break; - } + { + var expected = info.ScreenRect.CenterRect(frameRect); + AssertCloseEnough(expected.Position, frameRect.Position); + break; + } + case WindowStartupLocation.CenterOwner: + { + Assert.NotNull(info.OwnerRect); + var expected = info.OwnerRect!.Value.CenterRect(frameRect); + AssertCloseEnough(expected.Position, frameRect.Position); + break; + } } } @@ -89,10 +99,10 @@ namespace Avalonia.IntegrationTests.Appium } } - public static TheoryData StartupLocationData() + public static TheoryData StartupLocationData() { - var sizes = new PixelSize?[] { null, new PixelSize(400, 300) }; - var data = new TheoryData(); + var sizes = new Size?[] { null, new Size(400, 300) }; + var data = new TheoryData(); foreach (var size in sizes) { @@ -137,7 +147,7 @@ namespace Avalonia.IntegrationTests.Appium } } - private IDisposable OpenWindow(PixelSize? size, ShowWindowMode mode, WindowStartupLocation location) + private IDisposable OpenWindow(Size? size, ShowWindowMode mode, WindowStartupLocation location) { var sizeTextBox = _session.FindElementByAccessibilityId("ShowWindowSize"); var modeComboBox = _session.FindElementByAccessibilityId("ShowWindowMode"); @@ -158,6 +168,12 @@ namespace Avalonia.IntegrationTests.Appium private WindowInfo GetWindowInfo() { + PixelRect? ReadOwnerRect() + { + var text = _session.FindElementByAccessibilityId("OwnerRect").Text; + return !string.IsNullOrWhiteSpace(text) ? PixelRect.Parse(text) : null; + } + var retry = 0; for (;;) @@ -168,6 +184,7 @@ namespace Avalonia.IntegrationTests.Appium Size.Parse(_session.FindElementByAccessibilityId("ClientSize").Text), Size.Parse(_session.FindElementByAccessibilityId("FrameSize").Text), PixelPoint.Parse(_session.FindElementByAccessibilityId("Position").Text), + ReadOwnerRect(), PixelRect.Parse(_session.FindElementByAccessibilityId("ScreenRect").Text), double.Parse(_session.FindElementByAccessibilityId("Scaling").Text)); } @@ -191,6 +208,7 @@ namespace Avalonia.IntegrationTests.Appium Size ClientSize, Size FrameSize, PixelPoint Position, + PixelRect? OwnerRect, PixelRect ScreenRect, double Scaling); } From 91fc1335a0bd0d97ddf3286eb912ef58462c0193 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 23:00:52 +0200 Subject: [PATCH 263/393] Sigh, winappdriver. --- .../ElementExtensions.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs b/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs index 16d37e4beb..4b361c6716 100644 --- a/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs +++ b/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs @@ -130,17 +130,10 @@ namespace Avalonia.IntegrationTests.Appium public static void SendClick(this AppiumWebElement element) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - element.Click(); - } - else - { - // The Click() method seems to correspond to accessibilityPerformPress on macOS but certain controls - // such as list items don't support this action, so instead simulate a physical click as VoiceOver - // does. - new Actions(element.WrappedDriver).MoveToElement(element).Click().Perform(); - } + // The Click() method seems to correspond to accessibilityPerformPress on macOS but certain controls + // such as list items don't support this action, so instead simulate a physical click as VoiceOver + // does. On Windows, Click() seems to fail with the WindowState checkbox for some reason. + new Actions(element.WrappedDriver).MoveToElement(element).Click().Perform(); } public static void MovePointerOver(this AppiumWebElement element) From 4e63f19a0b24b699370b0bb78d7162d371d8f70f Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 27 Jun 2022 23:01:01 +0200 Subject: [PATCH 264/393] Account for scaling. --- tests/Avalonia.IntegrationTests.Appium/WindowTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs index 6a364e5fc0..2b10c302bc 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; using System.Threading; using Avalonia.Controls; using OpenQA.Selenium.Appium; +using OpenQA.Selenium.Interactions; using Xunit; using Xunit.Sdk; @@ -87,8 +88,9 @@ namespace Avalonia.IntegrationTests.Appium Assert.Equal("Fullscreen", windowState.GetComboBoxValue()); current = GetWindowInfo(); - Assert.True(current.ClientSize.Width >= current.ScreenRect.Width); - Assert.True(current.ClientSize.Height >= current.ScreenRect.Height); + var clientSize = PixelSize.FromSize(current.ClientSize, current.Scaling); + Assert.True(clientSize.Width >= current.ScreenRect.Width); + Assert.True(clientSize.Height >= current.ScreenRect.Height); windowState.Click(); _session.FindElementByName("Normal").SendClick(); From 77e32f4bbeb80c0db97419aa848f63e053d5e588 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Tue, 28 Jun 2022 09:00:21 +0200 Subject: [PATCH 265/393] Update to Unicode 14 --- .../Media/TextFormatting/TextFormatterImpl.cs | 8 +- .../Media/TextFormatting/Unicode/BiDi.trie.cs | 498 ++++++- .../TextFormatting/Unicode/BiDiAlgorithm.cs | 28 +- .../Media/TextFormatting/Unicode/BiDiData.cs | 25 +- .../Media/TextFormatting/Unicode/Codepoint.cs | 44 +- .../TextFormatting/Unicode/GraphemeBreak.cs | 7 + .../Unicode/GraphemeBreak.trie.cs | 422 +++++- .../TextFormatting/Unicode/LineBreakClass.cs | 1 - .../Unicode/LineBreakEnumerator.cs | 14 + .../Media/TextFormatting/Unicode/Script.cs | 5 + .../TextFormatting/Unicode/UnicodeData.cs | 42 +- .../Unicode/UnicodeData.trie.cs | 1192 +++++++++++++++-- .../TextFormatting/Unicode/UnicodeTrie.cs | 156 ++- .../Unicode/UnicodeTrieBuilder.cs | 14 +- src/Avalonia.Base/Utilities/ArrayBuilder.cs | 2 +- src/Avalonia.Base/Utilities/ArraySlice.cs | 2 +- src/Avalonia.Base/Utilities/BidiDictionary.cs | 40 + src/Skia/Avalonia.Skia/TextShaperImpl.cs | 2 +- .../Media/TextShaperImpl.cs | 2 +- .../TextFormatting/BiDiAlgorithmTests.cs | 2 +- .../Media/TextFormatting/BiDiClassTests.cs | 9 +- .../TextFormatting/BiDiTestDataGenerator.cs | 2 + .../GraphemeBreakClassTrieGenerator.cs | 9 +- .../GraphemeBreakClassTrieGeneratorTests.cs | 84 +- .../GraphemeBreakTestDataGenerator.cs | 108 ++ .../LineBreakEnumuratorTests.cs | 2 +- .../Media/TextFormatting/TestDataGenerator.cs | 85 -- .../TextFormatting/UnicodeDataGenerator.cs | 58 +- .../UnicodeDataGeneratorTests.cs | 4 +- .../TextFormatting/UnicodeEnumsGenerator.cs | 10 +- .../HarfBuzzTextShaperImpl.cs | 2 +- 31 files changed, 2417 insertions(+), 462 deletions(-) create mode 100644 src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.cs create mode 100644 src/Avalonia.Base/Utilities/BidiDictionary.cs create mode 100644 tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs delete mode 100644 tests/Avalonia.Base.UnitTests/Media/TextFormatting/TestDataGenerator.cs diff --git a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs index 16caadb0dd..73dd3366aa 100644 --- a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs +++ b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs @@ -159,7 +159,6 @@ namespace Avalonia.Media.TextFormatting { var flowDirection = paragraphProperties.FlowDirection; var drawableTextRuns = new List(); - var biDiData = new BidiData((sbyte)flowDirection); foreach (var textRun in textRuns) @@ -174,10 +173,9 @@ namespace Avalonia.Media.TextFormatting { biDiData.Append(textRun.Text); } - } - var biDi = BidiAlgorithm.Instance.Value!; + var biDi = new BidiAlgorithm(); biDi.Process(biDiData); @@ -290,9 +288,7 @@ namespace Avalonia.Media.TextFormatting /// The text characters to form from. /// The bidi levels. /// - private static IEnumerable> CoalesceLevels( - IReadOnlyList textCharacters, - ReadOnlySlice levels) + private static IEnumerable> CoalesceLevels(IReadOnlyList textCharacters, ArraySlice levels) { if (levels.Length == 0) { diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDi.trie.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDi.trie.cs index 7ce5453ec4..d489ad4106 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDi.trie.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDi.trie.cs @@ -1,42 +1,472 @@ using System; - namespace Avalonia.Media.TextFormatting.Unicode { - internal static class BiDiTrie + internal static class BidiTrie { public static ReadOnlySpan Data => new byte[] { - 0,16,0,0,0,0,0,0,0,0,174,224,0,68,12,187,243,236,157,11,176,85,85,25,199,151,115,207,189,247,156,203,227,94,244,132,151,128,58,122,53,184,10,74,112,26,206,61,64,105,130,89,22,163,121,85,12,17,38,26,7,197,72,37,152,166,59,56,142,132,236,64,144,16,196,212,6,26,167,98,34,197,158,71,83,10,134,116,116,236,161,165,4,50,38,61,40,64,137,178, - 28,109,6,164,255,102,175,205,93,44,246,99,61,247,62,192,254,102,126,243,173,189,246,218,235,251,214,183,190,253,60,251,156,51,171,129,144,91,193,87,192,157,224,1,176,14,172,7,143,3,7,172,144,208,63,3,191,0,207,130,223,130,109,224,79,224,85,240,23,176,15,188,5,246,131,183,3,182,63,4,26,115,225,253,247,193,186,51,192,96,208,1,206,7,99,64,23,184,24,92, - 10,38,131,43,193,117,96,6,152,5,230,128,249,96,30,88,0,22,129,101,224,223,121,66,222,5,7,65,174,64,200,80,212,141,6,99,193,90,44,175,134,94,227,150,115,132,124,15,108,4,143,131,39,192,102,240,28,93,126,17,188,194,44,191,6,118,211,246,251,193,219,116,251,67,57,111,44,141,141,132,20,192,0,112,6,24,12,58,26,123,251,63,191,209,107,127,24,109,47,108, - 244,236,249,246,29,212,141,109,244,180,203,4,148,39,49,203,159,68,249,74,186,124,53,244,245,180,252,5,232,91,192,92,112,144,246,227,128,30,44,47,4,75,193,125,76,63,142,65,30,162,253,62,194,245,191,193,176,189,31,115,253,61,133,229,167,192,211,24,239,211,116,204,91,176,252,124,163,231,203,75,92,251,237,88,126,148,137,141,3,118,161,110,15,215,110,31,150,107,200,143, - 183,104,253,255,160,79,107,242,202,5,232,211,105,253,155,232,107,64,147,55,239,131,154,188,249,60,139,182,27,78,245,72,170,29,134,49,168,27,23,80,239,80,182,129,223,180,168,197,232,227,232,247,83,96,50,184,6,244,96,28,27,193,13,40,223,8,22,162,188,24,204,199,24,230,96,121,62,184,131,250,114,119,147,55,110,159,217,76,185,22,192,38,112,15,221,118,37,244,55,185, - 237,107,224,48,234,182,210,242,90,102,204,223,13,104,91,19,96,67,200,118,47,48,229,223,131,29,133,248,88,241,125,252,153,234,61,224,128,164,95,239,128,67,92,157,19,149,203,77,92,46,55,29,159,3,110,31,141,200,131,45,180,175,124,75,111,223,173,76,185,198,113,38,214,13,5,91,209,231,11,76,191,127,104,234,221,39,55,198,196,229,231,104,187,137,46,239,68,249,175,180, - 159,55,160,255,195,249,234,128,119,154,142,221,127,30,51,184,223,59,25,36,139,1,57,101,98,80,19,56,126,56,25,36,139,1,201,98,208,144,197,32,139,1,201,98,208,144,197,32,139,1,201,98,208,144,197,160,94,99,176,179,201,187,174,117,159,9,56,2,237,115,205,189,229,66,179,247,44,205,95,190,150,62,163,217,203,212,13,96,218,59,96,16,150,75,180,110,24,179,110,36, - 182,185,144,46,143,133,254,40,45,175,198,115,156,75,104,249,49,250,156,232,114,44,95,213,236,61,183,115,151,175,109,246,158,211,77,231,108,29,224,158,33,221,200,173,119,50,72,22,3,146,197,160,33,139,65,22,3,146,197,160,33,139,65,22,3,146,197,160,225,196,141,193,205,184,198,107,193,53,104,255,130,247,185,178,10,231,182,28,95,247,29,212,141,4,31,1,75,209,247,189, - 96,46,103,227,81,172,187,28,117,183,195,135,175,130,187,184,235,205,53,117,240,252,184,212,223,99,6,88,71,203,165,0,182,131,246,86,66,166,128,89,96,61,248,73,107,239,250,255,50,229,18,24,209,134,207,186,193,15,192,223,64,251,0,66,38,130,59,193,19,224,101,80,60,29,109,17,163,85,125,97,31,122,45,88,119,90,60,175,11,182,251,96,159,222,114,55,202,171,192,203, - 224,69,216,43,130,182,126,98,253,216,162,27,62,172,203,236,147,180,98,208,157,197,159,100,249,71,82,139,65,119,150,127,36,237,252,187,2,231,128,25,253,78,221,249,143,187,62,88,210,124,236,231,221,43,155,123,223,79,89,207,189,167,229,112,92,197,93,223,60,88,135,207,219,54,98,12,223,134,95,235,221,103,134,205,222,251,97,63,106,238,93,239,62,111,124,146,46,255,146,174, - 255,21,244,175,153,54,47,49,101,135,121,87,104,71,115,239,251,131,238,251,104,187,2,218,57,13,158,253,61,204,186,127,161,252,110,72,91,7,28,196,186,92,222,43,187,244,205,123,253,223,79,183,41,230,143,125,239,111,8,179,236,112,156,21,177,206,1,195,177,126,20,215,102,12,181,55,14,250,99,224,19,116,253,228,152,190,156,0,174,102,182,153,134,242,76,174,143,155,176,124, - 27,173,155,39,209,255,135,35,222,107,236,65,63,11,21,124,117,100,200,123,122,57,213,78,138,108,166,121,177,138,241,229,225,58,240,203,225,120,30,251,218,79,21,223,169,116,20,120,4,49,216,0,126,200,196,162,70,143,115,19,66,252,168,209,245,155,19,190,119,219,72,245,34,58,151,223,247,215,53,123,250,73,140,97,170,1,159,182,129,45,121,79,63,7,253,59,240,74,130,115, - 226,104,242,26,124,221,29,227,239,114,197,220,255,99,29,238,51,14,71,13,57,240,25,238,29,212,207,130,107,90,188,119,78,95,207,247,230,206,110,58,158,197,52,135,28,142,21,1,159,1,214,20,222,7,174,25,96,106,139,119,237,193,214,181,50,227,156,137,242,46,193,207,44,157,147,148,189,121,239,251,19,81,12,44,68,175,255,0,214,159,29,210,230,60,90,63,34,166,143,161, - 17,140,118,191,71,81,16,107,91,166,237,198,115,237,251,23,188,239,144,248,223,23,25,26,192,69,220,186,75,4,109,14,213,160,127,193,27,223,104,166,110,52,37,23,98,127,116,4,147,90,226,109,250,251,250,108,170,167,67,207,101,142,127,53,212,213,40,61,45,225,239,232,187,251,210,93,96,9,88,1,86,211,62,106,76,155,26,248,22,237,99,43,152,89,72,63,223,55,193,159, - 77,17,108,67,187,109,33,60,19,179,237,166,83,0,66,240,112,54,150,110,128,155,197,35,122,10,45,183,41,210,151,161,155,246,87,161,148,24,42,71,232,36,85,50,156,116,209,229,33,160,200,232,34,104,23,164,200,216,169,112,36,35,211,48,22,2,123,83,143,142,167,66,73,70,22,80,251,61,71,237,183,37,99,184,174,165,45,128,190,33,245,109,22,40,6,228,126,137,214,85, - 24,92,241,203,238,118,126,217,109,235,226,231,57,223,214,197,173,231,235,216,126,109,137,237,254,235,221,126,82,34,50,151,65,115,47,130,169,237,101,125,209,177,201,82,62,197,9,139,125,156,196,205,93,84,155,147,81,84,198,42,51,47,39,155,4,29,59,220,243,212,196,58,216,39,202,10,76,228,116,57,164,60,241,36,39,31,66,133,146,163,243,92,162,229,34,213,21,74,89,130, - 92,157,83,182,64,94,144,18,83,206,113,62,229,50,8,31,131,184,152,71,229,38,223,71,80,91,191,141,232,253,168,201,57,74,115,206,77,230,254,201,156,183,73,197,33,237,243,131,12,34,177,240,219,250,231,15,31,190,159,160,62,211,20,223,126,144,31,113,99,14,235,75,100,123,25,255,210,138,81,154,115,35,50,31,42,125,232,138,238,124,184,215,3,46,113,109,88,123,166,108, - 235,74,84,222,7,249,25,180,63,216,244,69,182,255,176,253,82,116,255,54,33,58,115,26,151,71,108,255,170,199,31,83,194,231,135,175,77,238,207,42,99,59,145,142,173,182,124,229,207,217,62,110,126,185,90,196,151,180,207,227,190,196,229,83,216,190,46,146,59,170,249,101,35,54,97,115,22,54,95,113,146,246,117,134,170,109,209,57,139,186,206,83,149,176,115,94,92,78,197,29, - 183,101,175,59,85,69,212,127,157,188,79,235,188,147,132,61,62,167,202,100,92,107,149,84,91,187,200,4,232,241,208,230,237,149,21,8,219,150,173,15,18,19,54,146,68,87,100,198,196,174,227,183,79,66,194,108,217,142,135,74,31,124,127,34,109,117,109,165,33,38,99,31,117,126,23,57,215,171,94,7,152,18,247,125,161,100,228,225,129,85,242,208,64,211,199,90,95,76,206,169, - 136,29,222,166,236,62,24,180,191,233,30,59,253,235,21,182,157,104,126,242,207,224,221,119,98,76,73,26,199,219,168,99,174,104,63,42,54,248,253,89,231,90,223,164,36,225,71,208,121,214,166,45,214,102,212,185,159,247,69,117,31,147,221,71,109,156,219,147,190,214,10,242,39,204,47,118,189,106,223,182,198,19,53,71,65,99,50,45,188,141,168,117,54,99,200,183,211,149,160,249, - 87,201,81,153,57,143,219,71,131,252,75,83,252,227,174,234,179,31,221,103,70,166,182,119,197,189,94,20,133,125,47,215,149,160,207,29,101,9,123,239,119,4,248,52,56,7,92,20,209,174,157,27,91,123,8,67,40,21,114,71,169,74,22,148,252,235,214,176,246,225,219,47,199,246,203,142,110,175,43,236,92,4,221,99,200,206,179,104,110,70,221,215,132,105,86,68,62,3,9,178, - 39,226,135,136,191,81,219,203,32,227,187,168,255,114,156,215,81,37,157,29,252,119,30,76,248,109,90,244,199,26,157,115,21,1,218,13,115,34,141,93,180,63,81,223,121,17,189,94,145,181,159,148,184,126,179,223,151,58,222,167,194,168,42,201,143,234,34,125,160,91,160,251,65,247,133,110,133,238,15,61,0,186,13,154,208,109,223,135,229,34,150,207,132,30,8,61,8,186,29,122, - 48,244,251,153,118,68,58,6,101,14,95,226,230,48,106,93,82,241,247,125,182,97,211,70,254,219,20,27,182,147,28,127,146,241,211,57,86,37,57,183,182,108,242,251,188,219,63,95,23,134,168,63,73,30,3,162,150,195,234,76,217,246,251,230,115,68,214,166,200,123,97,58,34,155,195,162,249,16,135,138,68,109,103,195,158,136,63,54,199,43,98,63,204,23,190,94,182,223,168,49, - 152,176,225,111,103,162,141,138,77,217,88,233,140,209,244,56,121,159,117,250,178,33,236,59,221,201,157,23,39,28,246,190,31,63,238,112,58,223,207,159,70,237,79,165,246,103,96,121,58,45,207,68,249,243,199,248,149,164,164,121,223,163,123,141,88,175,215,216,73,29,227,69,236,154,56,231,156,8,247,53,186,231,184,176,24,165,113,238,246,237,218,236,219,212,184,162,226,110,82,162, - 108,196,249,28,118,30,76,99,94,227,108,199,181,211,181,231,47,219,20,27,253,71,197,43,106,126,249,114,26,34,58,135,105,251,108,211,166,232,254,166,154,163,65,219,201,230,76,84,223,34,231,5,155,34,122,204,78,43,215,69,246,199,164,37,42,199,194,252,17,201,207,36,198,34,234,135,168,63,162,62,203,216,21,21,145,220,77,34,151,69,237,217,222,175,85,226,33,114,92,11, - 138,91,82,49,228,219,132,249,97,226,120,172,42,113,190,218,144,184,123,35,255,25,174,143,238,189,150,201,251,45,219,251,130,72,174,155,234,91,71,252,152,166,113,14,243,69,118,44,113,191,77,104,234,88,99,67,146,176,35,179,159,152,122,95,67,245,184,47,115,110,240,197,84,63,65,253,138,74,146,57,162,98,203,100,158,185,199,110,153,92,176,121,220,78,251,51,104,94,252,99, - 78,82,191,53,19,246,251,51,124,125,84,187,52,126,39,135,95,167,251,187,68,38,252,115,223,27,181,53,246,122,24,159,42,238,254,20,149,79,162,121,154,86,110,197,249,152,100,28,195,16,253,189,60,27,168,198,218,214,252,37,145,59,174,4,221,151,120,117,5,124,78,153,63,250,57,229,16,250,251,143,67,168,46,74,156,251,138,33,243,93,150,232,163,221,0,188,152,232,211,164, - 63,178,162,107,199,196,189,167,159,27,58,247,178,238,246,46,252,181,11,155,151,65,215,51,186,231,147,56,191,252,255,71,24,14,46,3,227,193,40,112,5,205,233,82,0,21,9,74,41,83,214,164,162,73,145,209,174,176,117,30,159,123,175,74,174,123,175,139,92,15,61,21,250,6,232,105,208,36,52,230,37,138,223,95,24,174,136,252,166,127,208,182,252,61,181,123,254,208,141,165, - 10,113,191,75,25,151,255,162,231,70,209,253,167,72,46,45,85,201,164,35,223,55,170,88,102,74,2,54,42,145,20,58,112,126,196,119,97,250,64,183,72,127,39,166,34,137,13,137,182,121,211,176,42,153,53,172,139,204,134,190,25,250,139,208,183,64,127,9,122,14,244,109,208,183,66,207,133,190,29,122,30,244,151,161,137,196,184,158,197,54,207,72,110,67,52,249,7,108,254,29, - 54,247,66,239,129,126,3,122,31,244,126,232,55,161,15,64,255,211,176,79,95,235,172,146,133,157,93,228,110,232,69,208,14,244,98,232,37,208,95,135,190,7,122,41,244,10,232,123,161,151,67,47,131,94,9,253,13,232,85,208,247,65,223,15,189,26,250,1,232,53,157,102,125,140,99,7,108,110,135,205,157,208,175,38,108,155,128,67,176,123,208,170,93,95,108,143,69,206,70,199, - 5,85,114,246,5,93,228,92,232,115,160,135,65,127,8,186,19,122,56,52,73,120,30,236,197,72,86,108,231,129,174,232,218,77,235,247,173,125,127,116,255,15,73,213,182,202,239,108,235,92,159,134,137,191,158,239,51,41,49,53,143,182,238,143,226,226,104,99,159,172,199,227,150,234,113,36,109,31,146,242,223,244,248,249,237,85,37,169,248,155,154,195,184,216,198,197,92,103,174,77, - 140,67,39,31,85,164,30,198,171,147,7,186,199,255,52,206,223,166,8,242,39,105,177,241,31,145,50,232,94,255,164,109,95,20,87,100,234,101,250,213,17,21,159,85,125,20,181,21,214,214,190,252,31,0,0,255,255,0,0,0,255,255,99,102,0,0}; + 0, 0, 16, 0, 0, 0, 0, 0, 64, 180, 0, 0, 116, 3, 0, 0, 124, 3, 0, 0, 132, 3, 0, 0, 140, 3, 0, 0, 164, 3, 0, 0, 172, 3, 0, 0, 180, 3, 0, 0, 188, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 194, 3, 0, 0, 202, 3, 0, 0, + 210, 3, 0, 0, 218, 3, 0, 0, 226, 3, 0, 0, 234, 3, 0, 0, 230, 3, 0, 0, 238, 3, 0, 0, 246, 3, 0, 0, 254, 3, 0, 0, 249, 3, 0, 0, 1, 4, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 9, 4, 0, 0, 17, 4, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 148, 3, 0, 0, 156, 3, 0, 0, 23, 4, 0, 0, 31, 4, 0, 0, 39, 4, 0, 0, + 47, 4, 0, 0, 55, 4, 0, 0, 63, 4, 0, 0, 69, 4, 0, 0, 77, 4, 0, 0, 82, 4, 0, 0, 90, 4, 0, 0, 93, 4, 0, 0, 101, 4, 0, 0, 108, 4, 0, 0, 116, 4, 0, 0, 122, 4, 0, 0, 130, 4, 0, 0, 129, 4, 0, 0, 137, 4, 0, 0, 145, 4, 0, 0, 153, 4, 0, 0, 24, 9, 0, 0, 31, 9, 0, 0, 35, 9, 0, 0, 62, 4, 0, 0, 199, 9, 0, 0, 62, 4, 0, 0, 22, 11, 0, 0, 207, 9, 0, 0, + 161, 4, 0, 0, 163, 4, 0, 0, 171, 4, 0, 0, 179, 4, 0, 0, 187, 4, 0, 0, 188, 4, 0, 0, 196, 4, 0, 0, 204, 4, 0, 0, 212, 4, 0, 0, 188, 4, 0, 0, 220, 4, 0, 0, 225, 4, 0, 0, 212, 4, 0, 0, 188, 4, 0, 0, 233, 4, 0, 0, 241, 4, 0, 0, 187, 4, 0, 0, 249, 4, 0, 0, 1, 5, 0, 0, 179, 4, 0, 0, 9, 5, 0, 0, 148, 3, 0, 0, 17, 5, 0, 0, 21, 5, 0, 0, 29, 5, 0, 0, + 31, 5, 0, 0, 39, 5, 0, 0, 47, 5, 0, 0, 187, 4, 0, 0, 188, 4, 0, 0, 55, 5, 0, 0, 179, 4, 0, 0, 11, 4, 0, 0, 59, 5, 0, 0, 196, 4, 0, 0, 179, 4, 0, 0, 187, 4, 0, 0, 148, 3, 0, 0, 67, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 73, 5, 0, 0, 81, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 85, 5, 0, 0, 93, 5, 0, 0, 148, 3, 0, 0, 97, 5, 0, 0, 104, 5, 0, 0, + 148, 3, 0, 0, 112, 5, 0, 0, 120, 5, 0, 0, 127, 5, 0, 0, 8, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 135, 5, 0, 0, 143, 5, 0, 0, 151, 5, 0, 0, 159, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 167, 5, 0, 0, 148, 3, 0, 0, 175, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 183, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 191, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 199, 5, 0, 0, 200, 4, 0, 0, 200, 4, 0, 0, 200, 4, 0, 0, 148, 3, 0, 0, 205, 5, 0, 0, 213, 5, 0, 0, 175, 5, 0, 0, 221, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 228, 5, 0, 0, + 185, 4, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 236, 5, 0, 0, 244, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 246, 5, 0, 0, 231, 9, 0, 0, 254, 5, 0, 0, 148, 3, 0, 0, 5, 6, 0, 0, 13, 6, 0, 0, 148, 3, 0, 0, 21, 6, 0, 0, 27, 11, 0, 0, 148, 3, 0, 0, 248, 4, 0, 0, 29, 6, 0, 0, 9, 5, 0, 0, 37, 6, 0, 0, 11, 4, 0, 0, 45, 6, 0, 0, + 148, 3, 0, 0, 52, 6, 0, 0, 148, 3, 0, 0, 57, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 63, 6, 0, 0, 71, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 78, 6, 0, 0, 86, 6, 0, 0, 90, 6, 0, 0, 98, 6, 0, 0, 163, 9, 0, 0, 223, 9, 0, 0, 106, 6, 0, 0, 114, 6, 0, 0, 171, 9, 0, 0, 175, 9, 0, 0, 130, 5, 0, 0, 122, 6, 0, 0, 130, 6, 0, 0, 138, 6, 0, 0, 148, 3, 0, 0, 146, 6, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, + 147, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 237, 9, 0, 0, 152, 6, 0, 0, 148, 3, 0, 0, 158, 6, 0, 0, 165, 6, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 11, 7, 0, 0, 243, 9, 0, 0, 231, 9, 0, 0, 171, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 178, 6, 0, 0, 231, 9, 0, 0, + 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 183, 6, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 251, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 2, 10, 0, 0, 9, 10, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 17, 10, 0, 0, 231, 9, 0, 0, 24, 10, 0, 0, 31, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, + 39, 10, 0, 0, 45, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 191, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 199, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 226, 3, 0, 0, 231, 9, 0, 0, 53, 10, 0, 0, 56, 10, 0, 0, 148, 3, 0, 0, + 64, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 71, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 79, 10, 0, 0, 85, 10, 0, 0, 207, 6, 0, 0, 215, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 223, 6, 0, 0, 183, 5, 0, 0, 148, 3, 0, 0, 187, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 231, 9, 0, 0, 198, 6, 0, 0, 201, 3, 0, 0, 148, 3, 0, 0, 231, 6, 0, 0, 239, 6, 0, 0, 148, 3, 0, 0, 247, 6, 0, 0, 255, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 3, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 246, 5, 0, 0, 186, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 231, 9, 0, 0, 231, 9, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 231, 6, 0, 0, 231, 9, 0, 0, 11, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 16, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 21, 7, 0, 0, 29, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 99, 5, 0, 0, 231, 9, 0, 0, 245, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 37, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 45, 7, 0, 0, 52, 7, 0, 0, 148, 3, 0, 0, + 59, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 57, 5, 0, 0, 67, 7, 0, 0, 148, 3, 0, 0, 75, 7, 0, 0, 82, 7, 0, 0, 148, 3, 0, 0, 161, 4, 0, 0, 87, 7, 0, 0, 148, 3, 0, 0, 186, 4, 0, 0, 148, 3, 0, 0, 95, 7, 0, 0, 103, 7, 0, 0, 188, 4, 0, 0, 148, 3, 0, 0, 107, 7, 0, 0, 187, 4, 0, 0, 115, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 251, 5, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 122, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 126, 7, 0, 0, 42, 9, 0, 0, 46, 9, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, + 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 93, 10, 0, 0, 101, 10, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 106, 10, 0, 0, 110, 10, 0, 0, 118, 10, 0, 0, 179, 9, 0, 0, 183, 9, 0, 0, 155, 9, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 246, 10, 0, 0, 115, 9, 0, 0, 134, 7, 0, 0, 142, 7, 0, 0, 150, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 191, 9, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 144, 14, 0, 0, 208, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 8, 15, 0, 0, 72, 15, 0, 0, 136, 15, 0, 0, 152, 15, 0, 0, 216, 15, 0, 0, 228, 15, 0, 0, 80, 14, 0, 0, + 80, 14, 0, 0, 36, 16, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 80, 14, 0, 0, 92, 16, 0, 0, 156, 16, 0, 0, 220, 16, 0, 0, 20, 17, 0, 0, 72, 17, 0, 0, 116, 17, 0, 0, 176, 17, 0, 0, 232, 17, 0, 0, 4, 18, 0, 0, 68, 18, 0, 0, 32, 10, 0, 0, 192, 12, 0, 0, 96, 10, 0, 0, 159, 10, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 223, 10, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 31, 11, 0, 0, 160, 1, 0, 0, 69, 11, 0, 0, 128, 11, 0, 0, 192, 11, 0, 0, 0, 12, 0, 0, 253, 12, 0, 0, 64, 12, 0, 0, 61, 13, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 125, 13, 0, 0, 141, 13, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 128, 12, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 158, 7, 0, 0, 148, 3, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 166, 7, 0, 0, 183, 5, 0, 0, 148, 3, 0, 0, 180, 4, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 123, 9, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 174, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 187, 4, 0, 0, 181, 7, 0, 0, 188, 7, 0, 0, 195, 7, 0, 0, 11, 4, 0, 0, 203, 7, 0, 0, 9, 5, 0, 0, 148, 3, 0, 0, 161, 4, 0, 0, 210, 7, 0, 0, 148, 3, 0, 0, 216, 7, 0, 0, 11, 4, 0, 0, 221, 7, 0, 0, 229, 7, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 234, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 199, 6, 0, 0, 242, 7, 0, 0, 11, 4, 0, 0, 59, 5, 0, 0, 30, 5, 0, 0, 249, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 181, 7, 0, 0, 1, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 9, 8, 0, 0, 17, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 21, 8, 0, 0, 29, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 37, 8, 0, 0, 30, 5, 0, 0, 170, 7, 0, 0, 148, 3, 0, 0, 45, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 167, 5, 0, 0, 53, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 58, 8, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 65, 8, 0, 0, 73, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 76, 8, 0, 0, 30, 5, 0, 0, 84, 8, 0, 0, 88, 8, 0, 0, 96, 8, 0, 0, 148, 3, 0, 0, 103, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 110, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 118, 8, 0, 0, 124, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 130, 8, 0, 0, 138, 8, 0, 0, 148, 3, 0, 0, 142, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 61, 5, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 8, 0, 0, 156, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 161, 8, 0, 0, 148, 3, 0, 0, 167, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 217, 7, 0, 0, 148, 3, 0, 0, 173, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 181, 8, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 213, 4, 0, 0, 254, 10, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 226, 3, 0, 0, 35, 11, 0, 0, 189, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 196, 8, 0, 0, 204, 8, 0, 0, 210, 8, 0, 0, 148, 3, 0, 0, 216, 8, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 126, 10, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 240, 9, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 187, 3, 0, 0, 148, 3, 0, 0, 153, 7, 0, 0, 148, 3, 0, 0, 182, 3, 0, 0, 148, 3, 0, 0, 156, 7, 0, 0, 148, 3, 0, 0, 224, 8, 0, 0, 131, 9, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 226, 3, 0, 0, 232, 8, 0, 0, 226, 3, 0, 0, 239, 8, 0, 0, 246, 8, 0, 0, 43, 11, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 51, 11, 0, 0, 59, 11, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 167, 8, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 5, 8, 0, 0, 148, 3, 0, 0, 254, 8, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 231, 9, 0, 0, 142, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 71, 10, 0, 0, 147, 10, 0, 0, 151, 10, 0, 0, 79, 10, 0, 0, 6, 9, 0, 0, 182, 3, 0, 0, 148, 3, 0, 0, + 12, 9, 0, 0, 148, 3, 0, 0, 155, 7, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 156, 6, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, + 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 156, 10, 0, 0, 166, 7, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 71, 10, 0, 0, 231, 9, 0, 0, + 231, 9, 0, 0, 164, 10, 0, 0, 172, 10, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 16, 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4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 46, 9, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 50, 9, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, + 41, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 62, 4, 0, 0, 134, 10, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 41, 4, 0, 0, 142, 10, 0, 0, 231, 9, 0, 0, 180, 10, 0, 0, 231, 9, 0, 0, 188, 10, 0, 0, 193, 10, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 71, 10, 0, 0, 201, 10, 0, 0, 209, 10, 0, 0, 214, 10, 0, 0, 222, 10, 0, 0, 230, 10, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 231, 9, 0, 0, 238, 10, 0, 0, 231, 9, 0, 0, 243, 9, 0, 0, 139, 9, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, + 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 148, 3, 0, 0, 16, 9, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 226, 3, 0, 0, 14, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, + 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, + 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11, 0, 0, 6, 11,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, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, + 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, 0, 0, 52, 0, + 0, 0, 52, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 20, 0, 0, 0, 56, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 20, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 90, 254, 58, 0, 89, 254, 57, 0, 92, 254, 58, 0, 91, 254, 57, 0, 94, 254, 58, 0, 93, 254, 57, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0, 0, 32, 0, 0,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0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 9, 35, 58, 0, 8, 35, 57, 0, 11, 35, 58, 0, 10, 35, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 105, 39, 58, 0, 104, 39, 57, 0, 107, 39, 58, 0, 106, 39, 57, 0, 109, 39, 58, 0, 108, 39, 57, 0, 111, 39, 58, 0, 110, 39, 57, 0, 113, 39, 58, 0, 112, 39, 57, 0, 115, 39, 58, 0, 114, 39, 57, 0, 117, 39, 58, 0, 116, 39, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 198, 39, 58, 0, 197, 39, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 231, 39, 58, 0, 230, 39, 57, 0, 233, 39, 58, 0, 232, 39, 57, 0, 235, 39, 58, 0, 234, 39, 57, 0, 237, 39, 58, 0, 236, 39, 57, 0, 239, 39, 58, 0, 238, 39, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 132, 41, 58, 0, 131, 41, 57, 0, 134, 41, 58, 0, 133, 41, 57, 0, 136, 41, 58, 0, 135, 41, 57, 0, 138, 41, 58, 0, 137, 41, 57, 0, 140, 41, 58, 0, 139, 41, 57, 0, 144, 41, 58, 0, + 143, 41, 57, 0, 142, 41, 58, 0, 141, 41, 57, 0, 146, 41, 58, 0, 145, 41, 57, 0, 148, 41, 58, 0, 147, 41, 57, 0, 150, 41, 58, 0, 149, 41, 57, 0, 152, 41, 58, 0, 151, 41, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 217, 41, 58, 0, 216, 41, 57, 0, 219, 41, 58, 0, 218, 41, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 253, 41, 58, 0, 252, 41, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 35, 46, 58, 0, 34, 46, 57, 0, 37, 46, 58, 0, 36, 46, 57, 0, 39, 46, 58, 0, 38, 46, 57, 0, 41, 46, 58, 0, 40, 46, 57, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, + 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 0, 0, 56, 0, 86, 46, 58, 0, 85, 46, 57, 0, 88, 46, 58, 0, 87, 46, 57, 0, 90, 46, 58, 0, 89, 46, 57, 0, 92, 46, 58, 0, 91, 46, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; } } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiAlgorithm.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiAlgorithm.cs index 2511807d9c..17ec9b1df2 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiAlgorithm.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiAlgorithm.cs @@ -66,7 +66,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The forward mapping maps the start index to the end index. /// The reverse mapping maps the end index to the start index. /// - private readonly Dictionary _isolatePairs = new Dictionary(); + private readonly BidiDictionary _isolatePairs = new BidiDictionary(); /// /// The working BiDi classes @@ -188,12 +188,6 @@ namespace Avalonia.Media.TextFormatting.Unicode { } - /// - /// Gets a per-thread instance that can be re-used as often - /// as necessary. - /// - public static ThreadLocal Instance { get; } = new ThreadLocal(() => new BidiAlgorithm()); - /// /// Gets the resolved levels. /// @@ -1414,35 +1408,37 @@ namespace Avalonia.Media.TextFormatting.Unicode /// Sets the direction of a bracket pair, including setting the direction of /// NSM's inside the brackets and following. /// - /// The paired brackets + /// The paired brackets /// The resolved direction for the bracket pair - private void SetPairedBracketDirection(in BracketPair bracketPair, BidiClass direction) + private void SetPairedBracketDirection(in BracketPair pairedBracket, BidiClass direction) { // Set the direction of the brackets - _runResolvedClasses[bracketPair.OpeningIndex] = direction; - _runResolvedClasses[bracketPair.ClosingIndex] = direction; + _runResolvedClasses[pairedBracket.OpeningIndex] = direction; + _runResolvedClasses[pairedBracket.ClosingIndex] = direction; // Set the directionality of NSM's inside the brackets - for (var i = bracketPair.OpeningIndex + 1; i < bracketPair.ClosingIndex; i++) + // BN characters (such as ZWJ or ZWSP) that appear between the base bracket character + // and the nonspacing mark should be ignored. + for (int i = pairedBracket.OpeningIndex + 1; i < pairedBracket.ClosingIndex; i++) { if (_runOriginalClasses[i] == BidiClass.NonspacingMark) { _runOriginalClasses[i] = direction; } - else + else if (_runOriginalClasses[i] != BidiClass.BoundaryNeutral) { break; } } // Set the directionality of NSM's following the brackets - for (var i = bracketPair.ClosingIndex + 1; i < _runLength; i++) + for (int i = pairedBracket.ClosingIndex + 1; i < _runLength; i++) { if (_runOriginalClasses[i] == BidiClass.NonspacingMark) { - _runResolvedClasses[i] = direction; + _runOriginalClasses[i] = direction; } - else + else if (_runOriginalClasses[i] != BidiClass.BoundaryNeutral) { break; } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiData.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiData.cs index 9d76d56376..65c348e928 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiData.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiData.cs @@ -18,17 +18,12 @@ namespace Avalonia.Media.TextFormatting.Unicode private ArrayBuilder _savedClasses; private ArrayBuilder _savedPairedBracketTypes; private ArrayBuilder _tempLevelBuffer; - - public BidiData(sbyte paragraphEmbeddingLevel = 0) + + public BidiData(sbyte paragraphEmbeddingLevel) { ParagraphEmbeddingLevel = paragraphEmbeddingLevel; } - public BidiData(ReadOnlySlice text, sbyte paragraphEmbeddingLevel = 0) : this(paragraphEmbeddingLevel) - { - Append(text); - } - public sbyte ParagraphEmbeddingLevel { get; private set; } public bool HasBrackets { get; private set; } @@ -64,13 +59,23 @@ namespace Avalonia.Media.TextFormatting.Unicode /// public ArraySlice PairedBracketValues { get; private set; } + /// + /// Appends text to the bidi data. + /// + /// The text to process. public void Append(ReadOnlySlice text) { _classes.Add(text.Length); _pairedBracketTypes.Add(text.Length); _pairedBracketValues.Add(text.Length); - var i = Length; + // Resolve the BidiCharacterType, paired bracket type and paired + // bracket values for all code points + HasBrackets = false; + HasEmbeddings = false; + HasIsolates = false; + + int i = Length; var codePointEnumerator = new CodepointEnumerator(text); @@ -115,13 +120,13 @@ namespace Avalonia.Media.TextFormatting.Unicode // Opening bracket types can never have a null pairing. codepoint.TryGetPairedBracket(out var paired); - _pairedBracketValues[i] = Codepoint.GetCanonicalType(paired).Value; + _pairedBracketValues[i] = (int)Codepoint.GetCanonicalType(paired).Value; HasBrackets = true; } else if (pbt == BidiPairedBracketType.Close) { - _pairedBracketValues[i] = Codepoint.GetCanonicalType(codepoint).Value; + _pairedBracketValues[i] = (int)Codepoint.GetCanonicalType(codepoint).Value; HasBrackets = true; } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs index 39440f6fcf..56a90f31ea 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs @@ -5,50 +5,52 @@ namespace Avalonia.Media.TextFormatting.Unicode { public readonly struct Codepoint { + private readonly uint _value; + /// /// The replacement codepoint that is used for non supported values. /// public static readonly Codepoint ReplacementCodepoint = new Codepoint('\uFFFD'); - public Codepoint(int value) + public Codepoint(uint value) { - Value = value; + _value = value; } /// /// Get the codepoint's value. /// - public int Value { get; } + public uint Value => _value; /// /// Gets the . /// - public GeneralCategory GeneralCategory => UnicodeData.GetGeneralCategory(Value); + public GeneralCategory GeneralCategory => UnicodeData.GetGeneralCategory(_value); /// /// Gets the . /// - public Script Script => UnicodeData.GetScript(Value); + public Script Script => UnicodeData.GetScript(_value); /// /// Gets the . /// - public BidiClass BiDiClass => UnicodeData.GetBiDiClass(Value); + public BidiClass BiDiClass => UnicodeData.GetBiDiClass(_value); /// /// Gets the . /// - public BidiPairedBracketType PairedBracketType => UnicodeData.GetBiDiPairedBracketType(Value); + public BidiPairedBracketType PairedBracketType => UnicodeData.GetBiDiPairedBracketType(_value); /// /// Gets the . /// - public LineBreakClass LineBreakClass => UnicodeData.GetLineBreakClass(Value); + public LineBreakClass LineBreakClass => UnicodeData.GetLineBreakClass(_value); /// /// Gets the . /// - public GraphemeBreakClass GraphemeBreakClass => UnicodeData.GetGraphemeClusterBreak(Value); + public GraphemeBreakClass GraphemeBreakClass => UnicodeData.GetGraphemeClusterBreak(_value); /// /// Determines whether this is a break char. @@ -60,7 +62,7 @@ namespace Avalonia.Media.TextFormatting.Unicode { get { - switch (Value) + switch (_value) { case '\u000A': case '\u000B': @@ -109,12 +111,12 @@ namespace Avalonia.Media.TextFormatting.Unicode [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static Codepoint GetCanonicalType(Codepoint codePoint) { - if (codePoint.Value == 0x3008) + if (codePoint._value == 0x3008) { return new Codepoint(0x2329); } - if (codePoint.Value == 0x3009) + if (codePoint._value == 0x3009) { return new Codepoint(0x232A); } @@ -141,19 +143,19 @@ namespace Avalonia.Media.TextFormatting.Unicode return false; } - codepoint = UnicodeData.GetBiDiPairedBracket(Value); + codepoint = UnicodeData.GetBiDiPairedBracket(_value); return true; } public static implicit operator int(Codepoint codepoint) { - return codepoint.Value; + return (int)codepoint._value; } public static implicit operator uint(Codepoint codepoint) { - return (uint)codepoint.Value; + return codepoint._value; } /// @@ -191,7 +193,7 @@ namespace Avalonia.Media.TextFormatting.Unicode if (0xDC00 <= low && low <= 0xDFFF) { count = 2; - return new Codepoint((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000); + return new Codepoint((uint)((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000)); } return ReplacementCodepoint; @@ -212,7 +214,7 @@ namespace Avalonia.Media.TextFormatting.Unicode if (0xD800 <= hi && hi <= 0xDBFF) { count = 2; - return new Codepoint((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000); + return new Codepoint((uint)((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000)); } return ReplacementCodepoint; @@ -220,5 +222,13 @@ namespace Avalonia.Media.TextFormatting.Unicode return new Codepoint(code); } + + /// + /// Returns if is between + /// and , inclusive. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsInRangeInclusive(Codepoint cp, uint lowerBound, uint upperBound) + => (cp._value - lowerBound) <= (upperBound - lowerBound); } } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.cs new file mode 100644 index 0000000000..6986b908a1 --- /dev/null +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.cs @@ -0,0 +1,7 @@ +namespace Avalonia.Media.TextFormatting.Unicode +{ + internal static class GraphemeBreak + { + public static byte[] Data => new byte[0]; + } +} diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.trie.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.trie.cs index 80158e9d7e..05b7d55ad3 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.trie.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/GraphemeBreak.trie.cs @@ -1,31 +1,409 @@ using System; - namespace Avalonia.Media.TextFormatting.Unicode { internal static class GraphemeBreakTrie { public static ReadOnlySpan Data => new byte[] { - 0,14,16,0,0,0,0,0,0,0,133,64,0,245,7,10,248,236,157,127,136,29,87,21,199,103,157,111,246,157,100,211,138,180,69,177,5,241,7,88,91,40,182,150,210,12,138,161,88,27,163,96,241,15,75,161,210,18,44,149,10,193,46,24,80,49,254,163,33,16,136,54,127,84,8,34,18,253,199,68,196,42,136,154,82,21,149,6,218,82,43,72,107,161,54,22,196,173,10,110, - 16,140,210,82,250,125,190,51,228,228,228,206,204,157,121,119,230,109,182,243,133,15,231,220,115,207,156,123,239,121,111,247,253,216,129,189,33,207,178,130,220,66,118,147,61,228,126,19,43,230,180,171,228,139,100,31,217,31,145,127,128,28,174,153,63,66,142,146,99,228,56,249,49,249,5,249,21,57,101,242,158,36,127,36,207,145,23,201,26,89,39,255,34,103,201,43,4,200,178,47, - 147,175,146,131,152,93,91,242,40,217,206,216,55,200,17,114,148,28,35,199,201,9,242,19,114,146,252,134,252,150,60,65,158,54,227,63,145,191,104,254,75,228,140,94,255,63,242,32,89,218,50,91,103,43,237,25,218,55,109,57,87,255,205,244,223,166,227,119,211,190,135,92,110,214,47,152,127,61,99,103,39,51,127,7,253,157,90,175,32,31,162,255,49,29,223,78,123,135,250,119, - 211,222,71,246,146,255,154,243,238,227,120,63,57,64,14,155,58,5,185,82,206,241,46,229,26,242,126,165,48,185,69,13,95,143,204,43,18,243,16,207,243,16,121,158,231,125,94,207,252,45,142,191,87,246,7,231,231,95,193,248,247,93,15,30,118,227,194,240,51,157,251,37,237,99,234,239,37,47,235,252,83,140,253,129,60,71,78,147,53,178,174,121,103,213,190,26,168,143,101,62, - 255,150,47,140,151,172,146,203,107,230,139,72,62,201,243,223,165,61,184,201,196,247,146,7,106,206,93,140,100,125,247,224,42,247,248,158,12,60,7,138,4,252,213,252,12,188,61,193,115,170,24,201,198,30,100,99,15,242,177,7,99,15,178,177,7,249,216,131,177,7,217,216,131,124,236,193,216,131,108,236,65,62,246,96,236,65,150,188,7,87,47,207,190,75,43,199,159,136,248,254, - 226,189,188,230,102,243,153,247,24,191,83,123,133,236,100,108,151,198,111,167,189,131,92,37,179,239,3,239,162,15,250,159,214,249,251,105,87,201,62,29,239,167,253,51,237,129,134,207,210,135,57,127,43,235,124,152,220,70,118,145,143,144,221,228,163,228,214,113,46,27,251,146,141,207,9,25,127,30,198,223,5,89,178,223,5,55,144,29,228,3,164,24,223,139,100,99,15,178,177,7, - 249,216,131,62,122,112,164,231,191,167,236,87,138,0,187,3,177,51,198,191,199,253,237,179,88,0,187,46,153,113,144,172,109,111,230,20,243,158,13,228,190,229,210,243,199,187,56,62,72,78,145,236,141,179,216,141,180,159,33,223,33,143,144,117,178,115,37,203,62,71,94,220,202,191,125,109,203,50,89,154,113,167,241,197,113,98,229,194,88,136,47,153,26,63,162,255,15,94,119,45, - 247,113,47,57,176,61,174,198,72,54,246,96,105,236,193,216,131,108,236,193,210,230,235,193,58,95,23,50,190,46,60,202,247,9,167,249,122,248,146,222,231,177,198,239,174,222,202,215,231,119,232,107,244,223,201,239,152,179,194,207,44,143,47,207,230,127,79,123,141,121,13,127,54,240,94,227,36,57,189,124,238,62,178,53,250,235,21,239,73,254,195,248,171,102,110,153,223,131,93,170, - 247,152,21,1,46,227,220,149,102,254,157,147,115,247,61,77,185,118,114,254,253,95,239,171,169,117,115,205,92,65,174,227,57,111,114,239,87,62,200,107,110,35,31,159,94,11,222,203,164,53,110,113,121,69,4,159,50,235,223,75,255,179,110,63,15,112,188,91,235,126,161,97,175,133,225,43,45,114,139,30,185,175,67,79,138,158,249,46,123,179,99,192,245,246,178,7,39,184,230,195, - 129,199,228,231,27,228,113,42,90,178,71,239,3,91,85,246,56,86,107,248,60,46,204,127,189,81,204,193,209,134,207,118,47,187,241,177,13,120,111,221,113,238,233,135,21,251,186,34,209,253,159,63,104,121,238,159,6,242,207,246,220,135,175,233,207,255,161,13,240,123,224,65,238,225,50,190,206,127,211,236,229,219,9,246,181,74,126,61,153,217,83,180,79,145,103,54,192,121,139,72, - 94,224,94,255,214,176,223,67,29,207,243,207,139,160,15,135,220,30,255,125,17,236,185,232,192,35,27,96,15,215,231,75,255,39,231,219,243,60,130,55,24,127,41,242,154,60,130,81,139,211,216,255,44,217,243,56,239,200,162,31,55,188,206,73,41,212,176,153,133,139,144,114,223,165,197,212,9,248,155,93,147,10,98,133,22,164,254,221,149,90,232,129,20,123,26,66,168,97,210,144, - 227,107,100,53,57,41,53,81,139,148,69,91,10,9,217,204,66,11,46,86,33,130,216,58,214,135,62,215,177,0,36,16,203,52,46,138,31,195,252,108,214,9,117,147,145,18,3,28,226,226,165,38,165,211,81,147,142,215,133,36,166,230,36,148,16,56,87,121,29,166,206,156,130,214,18,199,84,162,216,92,104,12,186,95,49,22,101,226,130,132,10,68,247,8,71,72,147,10,208,1, - 49,126,149,80,193,68,237,144,130,33,239,161,126,174,181,183,168,159,39,170,153,87,144,66,121,75,134,88,175,73,112,207,61,184,121,113,115,80,242,6,144,128,124,78,250,18,28,161,24,166,193,134,49,76,124,40,193,80,55,39,126,114,64,65,215,135,142,197,128,6,36,144,47,74,89,27,21,196,10,202,34,4,119,158,161,215,246,123,128,163,148,40,126,140,50,208,32,52,204,251, - 92,216,64,207,130,243,225,206,58,148,224,122,43,26,67,69,46,2,99,84,212,76,181,63,4,98,177,18,205,135,99,42,40,50,29,168,21,141,165,22,148,190,132,10,134,22,140,133,233,39,12,165,68,241,99,148,129,10,193,16,43,196,38,38,22,2,231,204,76,76,166,3,55,6,137,17,34,115,196,128,152,194,9,5,183,190,152,56,20,63,198,52,80,35,40,139,16,212,138,250, - 18,240,203,60,81,166,18,5,74,157,160,196,8,138,40,139,20,148,210,151,169,19,41,84,196,68,129,193,230,75,13,208,156,121,5,181,162,62,42,136,169,131,26,82,9,145,251,133,201,109,83,27,1,134,18,148,190,215,8,89,43,81,82,158,9,45,145,138,184,173,25,18,90,208,54,31,61,48,175,16,217,55,184,124,113,185,125,74,26,214,66,205,92,91,193,209,69,80,43,234, - 35,34,183,171,208,245,194,134,154,80,250,20,20,49,62,2,72,3,112,62,34,137,221,99,95,130,65,28,8,196,189,68,129,241,197,1,67,159,130,34,10,122,90,71,204,58,168,161,220,147,181,165,143,26,164,2,68,82,10,1,164,156,28,72,168,65,140,21,7,140,191,40,33,130,174,53,165,237,133,9,37,129,115,136,139,139,155,79,45,184,53,196,0,55,7,51,215,86,210,0, - 26,16,151,55,175,96,240,99,68,34,13,243,94,240,129,138,57,209,49,76,204,11,3,81,181,214,60,130,97,72,65,73,85,7,74,40,134,10,188,208,48,174,138,165,148,40,80,36,144,131,158,214,20,183,246,80,66,34,186,174,93,55,135,26,250,16,90,32,74,234,245,69,129,67,92,92,148,170,58,67,10,21,136,130,138,113,151,117,98,114,164,41,169,71,161,167,122,48,216,57, - 148,3,39,40,109,36,230,58,81,234,242,218,74,20,84,248,153,137,45,90,216,228,107,35,64,76,174,29,135,4,71,223,130,33,52,215,70,80,82,74,180,166,164,44,218,81,8,32,21,113,24,250,18,18,215,19,3,34,144,132,107,136,137,137,137,87,9,106,197,128,6,250,16,220,30,196,204,73,197,88,90,212,142,149,40,246,90,84,96,133,0,125,75,12,104,64,2,121,162,182, - 79,33,97,29,81,80,129,4,242,36,48,143,68,123,234,42,232,94,68,125,24,74,137,3,138,24,127,72,65,73,37,49,160,1,49,121,162,182,141,96,174,19,227,35,128,168,109,146,40,112,72,32,134,166,98,29,36,6,68,32,198,79,37,49,192,81,10,138,56,80,38,168,68,237,144,66,36,67,236,35,54,15,1,68,129,97,30,137,171,5,199,84,168,64,212,166,18,58,146,153, - 189,160,2,169,240,83,9,21,248,156,210,98,234,24,27,35,9,80,214,192,212,49,113,24,155,82,80,68,73,89,19,134,148,66,13,41,106,103,166,31,210,129,58,193,209,69,104,153,47,202,34,5,197,250,152,14,84,168,161,47,193,209,103,253,33,133,30,73,181,86,147,208,148,208,49,183,173,16,160,42,142,72,230,21,106,104,154,71,36,165,80,131,157,207,106,114,82,11,142,212, - 245,96,232,83,162,244,85,87,90,176,104,137,50,228,90,178,32,182,110,0,172,182,45,152,149,158,185,196,209,86,219,18,226,181,178,1,240,226,191,181,184,160,103,125,50,244,122,94,175,1,0,0,255,255,0,0,0,255,255,99,102,0,0}; + 0, 16, 14, 0, 0, 0, 0, 0, 144, 155, 0, 0, 89, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 113, 3, 0, 0, 137, 3, 0, 0, 145, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, + 97, 3, 0, 0, 105, 3, 0, 0, 153, 3, 0, 0, 161, 3, 0, 0, 157, 3, 0, 0, 165, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 173, 3, 0, 0, 181, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 185, 3, 0, 0, 193, 3, 0, 0, 201, 3, 0, 0, + 209, 3, 0, 0, 217, 3, 0, 0, 225, 3, 0, 0, 231, 3, 0, 0, 239, 3, 0, 0, 97, 3, 0, 0, 105, 3, 0, 0, 244, 3, 0, 0, 252, 3, 0, 0, 1, 4, 0, 0, 9, 4, 0, 0, 15, 4, 0, 0, 23, 4, 0, 0, 22, 4, 0, 0, 30, 4, 0, 0, 35, 4, 0, 0, 43, 4, 0, 0, 176, 4, 0, 0, 183, 4, 0, 0, 187, 4, 0, 0, 97, 3, 0, 0, 51, 4, 0, 0, 97, 3, 0, 0, 194, 4, 0, 0, 59, 4, 0, 0, + 202, 4, 0, 0, 204, 4, 0, 0, 212, 4, 0, 0, 220, 4, 0, 0, 228, 4, 0, 0, 229, 4, 0, 0, 237, 4, 0, 0, 245, 4, 0, 0, 253, 4, 0, 0, 254, 4, 0, 0, 6, 5, 0, 0, 11, 5, 0, 0, 253, 4, 0, 0, 254, 4, 0, 0, 19, 5, 0, 0, 27, 5, 0, 0, 228, 4, 0, 0, 35, 5, 0, 0, 43, 5, 0, 0, 220, 4, 0, 0, 51, 5, 0, 0, 203, 4, 0, 0, 59, 5, 0, 0, 97, 3, 0, 0, 67, 5, 0, 0, + 35, 5, 0, 0, 75, 5, 0, 0, 220, 4, 0, 0, 228, 4, 0, 0, 81, 5, 0, 0, 89, 5, 0, 0, 220, 4, 0, 0, 97, 5, 0, 0, 99, 5, 0, 0, 67, 4, 0, 0, 220, 4, 0, 0, 228, 4, 0, 0, 97, 3, 0, 0, 107, 5, 0, 0, 88, 8, 0, 0, 97, 3, 0, 0, 115, 5, 0, 0, 122, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 126, 5, 0, 0, 134, 5, 0, 0, 97, 3, 0, 0, 138, 5, 0, 0, 145, 5, 0, 0, + 97, 3, 0, 0, 153, 5, 0, 0, 161, 5, 0, 0, 168, 5, 0, 0, 50, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 176, 5, 0, 0, 184, 5, 0, 0, 192, 5, 0, 0, 200, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 124, 8, 0, 0, 124, 8, 0, 0, 124, 8, 0, 0, 133, 8, 0, 0, 133, 8, 0, 0, 139, 8, 0, 0, 157, 8, 0, 0, 157, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 182, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 208, 5, 0, 0, 214, 5, 0, 0, 23, 5, 0, 0, 23, 5, 0, 0, 97, 3, 0, 0, 220, 5, 0, 0, 228, 5, 0, 0, 97, 3, 0, 0, 127, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 79, 5, 0, 0, + 233, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 241, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 248, 5, 0, 0, 97, 3, 0, 0, 255, 5, 0, 0, 7, 6, 0, 0, 97, 3, 0, 0, 149, 3, 0, 0, 14, 4, 0, 0, 97, 3, 0, 0, 15, 6, 0, 0, 18, 6, 0, 0, 26, 6, 0, 0, 32, 6, 0, 0, 40, 6, 0, 0, 48, 6, 0, 0, + 97, 3, 0, 0, 55, 6, 0, 0, 97, 3, 0, 0, 62, 6, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 68, 6, 0, 0, 76, 6, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 133, 4, 0, 0, 139, 4, 0, 0, 94, 6, 0, 0, 93, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 149, 3, 0, 0, 171, 5, 0, 0, 97, 3, 0, 0, 180, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 187, 8, 0, 0, 194, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 197, 8, 0, 0, 204, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 204, 8, 0, 0, 97, 3, 0, 0, 209, 8, 0, 0, 215, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 223, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 229, 8, 0, 0, 237, 8, 0, 0, 239, 8, 0, 0, 247, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 3, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 10, 9, 0, 0, 17, 9, 0, 0, 24, 9, 0, 0, 32, 9, 0, 0, 35, 9, 0, 0, 43, 9, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 51, 9, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 58, 9, 0, 0, 97, 3, 0, 0, 66, 9, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3,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97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 104, 6, 0, 0, 24, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 140, 5, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 112, 6, 0, 0, 120, 6, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 237, 7, 0, 0, 93, 8, 0, 0, 128, 6, 0, 0, 136, 6, 0, 0, 97, 3, 0, 0, 144, 6, 0, 0, 151, 6, 0, 0, 125, 8, 0, 0, 202, 4, 0, 0, 156, 6, 0, 0, 101, 8, 0, 0, 164, 6, 0, 0, 97, 3, 0, 0, 170, 6, 0, 0, 178, 6, 0, 0, 182, 6, 0, 0, 97, 3, 0, 0, 190, 6, 0, 0, 5, 4, 0, 0, 198, 6, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 206, 6, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, + 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, + 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, + 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, + 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, + 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, + 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, + 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, + 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, + 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, + 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, + 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, + 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, + 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 172, 8, 0, 0, 166, 8, 0, 0, 167, 8, 0, 0, 168, 8, 0, 0, + 169, 8, 0, 0, 170, 8, 0, 0, 171, 8, 0, 0, 147, 8, 0, 0, 154, 8, 0, 0, 158, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 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 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 228, 13, 0, 0, 228, 13, 0, 0, 36, 14, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 100, 14, 0, 0, 116, 14, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, + 132, 13, 0, 0, 180, 14, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 132, 13, 0, 0, 228, 14, 0, 0, 36, 15, 0, 0, 100, 15, 0, 0, 156, 15, 0, 0, 132, 13, 0, 0, 208, 15, 0, 0, 4, 16, 0, 0, 60, 16, 0, 0, 88, 16, 0, 0, 140, 16, 0, 0, 64, 11, 0, 0, 112, 11, 0, 0, 226, 9, 0, 0, 33, 10, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 89, 10, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 173, 11, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 123, 10, 0, 0, 149, 1, 0, 0, 237, 11, 0, 0, 176, 10, 0, 0, 40, 12, 0, 0, 104, 12, 0, 0, 162, 12, 0, 0, 226, 12, 0, 0, 34, 13, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, + 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 149, 1, 0, 0, 240, 10, 0, 0, 0, 11, 0, 0, 6, 7, 0, 0, 7, 4, 0, 0, 16, 4, 0, 0, 10, 7, 0, 0, 40, 6, 0, 0, 73, 4, 0, 0, 81, 4, 0, 0, 97, 3, 0, 0, 17, 4, 0, 0, 16, 7, 0, 0, 108, 8, 0, 0, 22, 7, 0, 0, 40, 6, 0, 0, 27, 7, 0, 0, 89, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 35, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 226, 3, 0, 0, 43, 7, 0, 0, 97, 5, 0, 0, 99, 5, 0, 0, 51, 7, 0, 0, 59, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 65, 7, 0, 0, 73, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 81, 7, 0, 0, 89, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 94, 7, 0, 0, 102, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 110, 7, 0, 0, 34, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 118, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 182, 3, 0, 0, 126, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 131, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 93, 4, 0, 0, 101, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 138, 7, 0, 0, 146, 7, 0, 0, 154, 7, 0, 0, 105, 4, 0, 0, 161, 7, 0, 0, 97, 3, 0, 0, 113, 4, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 168, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 176, 7, 0, 0, 182, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 188, 7, 0, 0, 121, 4, 0, 0, 97, 3, 0, 0, 196, 7, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 202, 7, 0, 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, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 161, 4, 0, 0, 254, 7, 0, 0, 252, 6, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 6, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 137, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 153, 3, 0, 0, 168, 4, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, + 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, + 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, + 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 137, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 218, 6, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 34, 4, 0, 0,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 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, + 97, 3, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 79, 9, 0, 0, 209, 8, 0, 0, 97, 3, 0, 0, 84, 9, 0, 0, 92, 9, 0, 0, 99, 9, 0, 0, 252, 8, 0, 0, 80, 8, 0, 0, 107, 9, 0, 0, 114, 9, 0, 0, 122, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, + 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 72, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 253, 8, 0, 0, 130, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, + 252, 8, 0, 0, 134, 9, 0, 0, 97, 3, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 67, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 138, 9, 0, 0, 252, 8, 0, 0, 146, 9, 0, 0, 97, 3, 0, 0, 152, 9, 0, 0, 97, 3, 0, 0, 160, 9, 0, 0, 165, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 69, 8, 0, 0, 169, 9, 0, 0, + 176, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 97, 3, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, + 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, + 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, + 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, + 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; } } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakClass.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakClass.cs index 8b2e3f41e3..bd77c398bd 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakClass.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakClass.cs @@ -35,7 +35,6 @@ namespace Avalonia.Media.TextFormatting.Unicode EModifier, //EM ZWJ, //ZWJ ContingentBreak, //CB - Unknown, //XX Ambiguous, //AI MandatoryBreak, //BK diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs index 0f6b81975a..e12a7c06f1 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs @@ -450,6 +450,20 @@ namespace Avalonia.Media.TextFormatting.Unicode _lb30a = 0; } + // Rule LB30b + if (_nextClass == LineBreakClass.EModifier && _lastPosition > 0) + { + // Mahjong Tiles (Unicode block) are extended pictographics but have a class of ID + // Unassigned codepoints with Line_Break=ID in some blocks are also assigned the Extended_Pictographic property. + // Those blocks are intended for future allocation of emoji characters. + var cp = Codepoint.ReadAt(_text, _lastPosition - 1, out int _); + + if (Codepoint.IsInRangeInclusive(cp, 0x1F000, 0x1F02F)) + { + shouldBreak = false; + } + } + _currentClass = _nextClass; return shouldBreak; diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/Script.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/Script.cs index 2593a77848..bc14c2563c 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/Script.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/Script.cs @@ -30,6 +30,7 @@ namespace Avalonia.Media.TextFormatting.Unicode Cherokee, //Cher Chorasmian, //Chrs Coptic, //Copt + CyproMinoan, //Cpmn Cypriot, //Cprt Cyrillic, //Cyrl Devanagari, //Deva @@ -109,6 +110,7 @@ namespace Avalonia.Media.TextFormatting.Unicode Oriya, //Orya Osage, //Osge Osmanya, //Osma + OldUyghur, //Ougr Palmyrene, //Palm PauCinHau, //Pauc OldPermic, //Perm @@ -151,8 +153,11 @@ namespace Avalonia.Media.TextFormatting.Unicode Thai, //Thai Tibetan, //Tibt Tirhuta, //Tirh + Tangsa, //Tnsa + Toto, //Toto Ugaritic, //Ugar Vai, //Vaii + Vithkuqi, //Vith WarangCiti, //Wara Wancho, //Wcho OldPersian, //Xpeo diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.cs index ff39dc5011..0142a20790 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.cs @@ -36,29 +36,9 @@ namespace Avalonia.Media.TextFormatting.Unicode static UnicodeData() { - unsafe - { - var unicodeData = UnicodeDataTrie.Data; - - fixed (byte* unicodeDataPtr = unicodeData) - { - s_unicodeDataTrie = new UnicodeTrie(new UnmanagedMemoryStream(unicodeDataPtr, unicodeData.Length)); - } - - var graphemeData = GraphemeBreakTrie.Data; - - fixed (byte* graphemeDataPtr = graphemeData) - { - s_graphemeBreakTrie = new UnicodeTrie(new UnmanagedMemoryStream(graphemeDataPtr, graphemeData.Length)); - } - - var bidiData = BiDiTrie.Data; - - fixed (byte* bidiDataPtr = bidiData) - { - s_biDiTrie = new UnicodeTrie(new UnmanagedMemoryStream(bidiDataPtr, bidiData.Length)); - } - } + s_unicodeDataTrie = new UnicodeTrie(UnicodeDataTrie.Data); + s_graphemeBreakTrie = new UnicodeTrie(GraphemeBreakTrie.Data); + s_biDiTrie = new UnicodeTrie(BidiTrie.Data); } /// @@ -67,7 +47,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's general category. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GeneralCategory GetGeneralCategory(int codepoint) + public static GeneralCategory GetGeneralCategory(uint codepoint) { return (GeneralCategory)(s_unicodeDataTrie.Get(codepoint) & CATEGORY_MASK); } @@ -78,7 +58,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's script. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Script GetScript(int codepoint) + public static Script GetScript(uint codepoint) { return (Script)((s_unicodeDataTrie.Get(codepoint) >> SCRIPT_SHIFT) & SCRIPT_MASK); } @@ -89,7 +69,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's biDi class. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static BidiClass GetBiDiClass(int codepoint) + public static BidiClass GetBiDiClass(uint codepoint) { return (BidiClass)((s_biDiTrie.Get(codepoint) >> BIDICLASS_SHIFT) & BIDICLASS_MASK); } @@ -100,7 +80,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's paired bracket type. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static BidiPairedBracketType GetBiDiPairedBracketType(int codepoint) + public static BidiPairedBracketType GetBiDiPairedBracketType(uint codepoint) { return (BidiPairedBracketType)((s_biDiTrie.Get(codepoint) >> BIDIPAIREDBRACKEDTYPE_SHIFT) & BIDIPAIREDBRACKEDTYPE_MASK); } @@ -111,9 +91,9 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's paired bracket. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Codepoint GetBiDiPairedBracket(int codepoint) + public static Codepoint GetBiDiPairedBracket(uint codepoint) { - return new Codepoint((int)(s_biDiTrie.Get(codepoint) & BIDIPAIREDBRACKED_MASK)); + return new Codepoint((s_biDiTrie.Get(codepoint) & BIDIPAIREDBRACKED_MASK)); } /// @@ -122,7 +102,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's line break class. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static LineBreakClass GetLineBreakClass(int codepoint) + public static LineBreakClass GetLineBreakClass(uint codepoint) { return (LineBreakClass)((s_unicodeDataTrie.Get(codepoint) >> LINEBREAK_SHIFT) & LINEBREAK_MASK); } @@ -133,7 +113,7 @@ namespace Avalonia.Media.TextFormatting.Unicode /// The codepoint in question. /// The code point's grapheme break type. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static GraphemeBreakClass GetGraphemeClusterBreak(int codepoint) + public static GraphemeBreakClass GetGraphemeClusterBreak(uint codepoint) { return (GraphemeBreakClass)s_graphemeBreakTrie.Get(codepoint); } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.trie.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.trie.cs index dd55fda374..6ef41e3a0b 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.trie.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeData.trie.cs @@ -1,122 +1,1086 @@ using System; - namespace Avalonia.Media.TextFormatting.Unicode { - internal static class UnicodeDataTrie + internal static class UnicodeDataTrie { public static ReadOnlySpan Data => new byte[] { - 0,16,0,0,0,0,0,0,0,1,154,144,0,161,43,94,212,236,157,15,148,28,85,157,239,107,230,215,147,204,84,146,78,103,152,252,115,128,16,8,241,224,234,238,193,197,221,163,139,231,117,2,132,158,162,51,52,67,155,63,244,152,233,66,130,202,81,247,225,209,221,167,7,125,13,139,74,202,48,84,134,89,16,199,5,70,81,244,249,111,117,209,93,93,229,5,68,157,41,218, - 177,9,35,168,3,72,16,124,60,149,125,111,87,217,231,62,193,247,190,53,117,59,115,231,166,254,220,234,170,234,10,58,57,231,147,223,253,255,251,221,63,117,235,214,173,59,213,151,100,20,101,47,208,193,91,193,181,224,0,56,4,110,3,147,224,51,224,139,224,31,193,127,7,223,5,223,7,143,130,199,193,51,224,57,240,60,248,13,80,186,20,165,27,228,192,6,112,26,56,19, - 188,10,188,6,188,30,108,7,26,24,2,151,129,125,224,74,240,14,240,87,224,253,224,131,224,58,96,128,155,192,173,224,239,192,39,193,231,193,87,192,55,193,183,193,247,192,15,192,143,193,83,224,25,240,28,120,30,188,8,104,153,162,172,0,39,129,126,112,6,248,35,240,185,94,69,249,83,200,191,0,231,129,29,96,16,148,193,59,215,41,202,217,39,33,30,252,5,184,7,105, - 135,17,126,57,184,202,142,95,166,40,239,5,53,112,3,48,193,71,192,237,224,83,224,11,224,171,224,27,224,1,80,7,179,224,49,240,52,248,5,248,21,248,15,208,177,92,81,122,192,26,176,30,108,2,47,7,127,2,206,131,238,63,135,252,79,224,66,48,8,118,129,125,224,74,112,21,120,231,114,199,246,247,66,94,11,14,48,255,69,200,251,94,212,227,16,252,183,128,219,193, - 39,193,231,89,252,165,136,223,11,116,240,86,112,53,184,100,13,218,22,241,23,160,190,239,129,255,61,140,107,25,31,2,7,24,135,24,223,92,238,200,111,67,78,131,135,152,255,81,38,31,135,124,6,60,7,246,162,252,189,224,121,184,111,67,220,71,99,226,14,240,34,202,188,27,242,110,208,213,173,40,171,192,90,112,10,56,19,124,17,225,95,6,175,130,251,53,224,245,224,235, - 240,127,3,117,189,0,238,251,224,222,217,237,148,119,9,228,94,160,131,183,130,119,128,105,132,255,21,228,53,96,207,6,69,185,30,242,33,132,29,132,28,7,31,3,119,129,207,117,59,237,251,35,196,61,102,143,157,110,232,0,79,195,253,75,240,107,240,0,252,47,64,214,33,103,193,3,176,225,49,200,39,193,179,224,127,131,127,197,245,180,19,225,117,240,6,123,252,245,34,109, - 175,115,93,253,166,219,185,62,121,244,53,139,253,74,15,108,71,88,6,114,37,184,2,121,251,32,79,6,91,192,107,215,43,202,54,48,0,94,9,255,57,160,128,122,157,11,121,62,184,26,121,223,3,174,5,22,198,81,17,97,159,66,218,207,130,47,129,175,129,251,192,52,120,8,252,8,60,9,158,5,207,129,171,193,123,64,21,101,62,15,249,34,200,192,221,3,214,108,112,194, - 47,69,153,21,240,12,202,255,25,120,11,194,222,2,158,227,220,111,7,87,131,247,128,141,96,51,56,11,92,11,14,128,67,224,108,48,6,62,10,62,14,254,27,248,50,211,241,85,91,255,58,69,249,237,58,199,127,45,236,184,1,220,11,247,189,62,60,203,234,242,44,195,100,242,86,112,187,16,247,172,11,85,148,241,90,144,7,111,178,251,162,199,9,107,114,0,237,122,53,194, - 222,13,14,193,125,27,199,251,16,246,54,244,215,7,32,51,125,138,242,97,200,155,193,4,227,58,212,229,173,208,241,24,210,124,162,199,25,111,159,133,252,14,202,253,142,93,247,158,5,183,200,215,17,119,24,60,141,188,191,4,83,112,175,132,142,6,100,31,228,201,224,215,8,255,33,252,143,129,45,240,111,1,71,225,126,37,228,140,221,54,61,24,163,128,96,67,15,120,100,131, - 227,94,3,158,128,251,41,240,115,198,47,55,56,121,68,206,65,89,231,44,161,44,181,129,178,212,6,125,242,109,208,156,63,206,9,145,231,156,37,148,165,54,80,150,218,160,111,169,13,150,218,64,89,106,131,190,165,54,88,106,3,101,169,13,250,254,48,219,224,55,120,118,123,1,207,120,231,194,125,238,9,130,162,226,185,19,235,218,229,144,25,236,141,156,143,176,243,125,88,137, - 52,171,85,103,239,112,18,207,204,159,1,69,132,23,193,122,132,247,33,254,75,108,79,228,171,144,247,130,7,192,38,196,157,14,202,72,247,10,200,97,200,87,67,94,1,249,102,240,58,184,255,18,242,175,193,251,193,118,248,53,240,65,184,13,48,4,247,101,96,12,238,203,33,175,2,39,219,251,80,125,216,23,0,239,132,255,189,224,58,96,128,119,161,157,15,65,94,3,121,13, - 248,20,210,220,6,255,23,32,191,8,254,30,124,9,124,25,252,3,184,7,124,97,41,78,89,106,23,101,105,76,244,45,93,15,75,115,129,18,219,92,48,137,121,247,211,224,179,224,106,220,23,174,78,17,29,123,165,122,138,236,93,66,89,106,3,101,169,13,214,187,183,65,152,245,244,63,168,11,238,127,132,251,94,240,29,48,3,30,81,157,247,212,54,223,64,252,19,156,255,219, - 1,60,128,244,218,50,199,253,83,150,239,127,66,62,7,158,183,215,151,235,240,94,13,178,107,197,226,124,43,224,63,9,212,177,222,189,30,107,206,45,88,159,158,5,250,17,118,6,248,163,21,233,206,61,54,15,176,245,120,6,246,157,223,235,216,105,191,139,125,193,126,46,57,9,235,102,112,15,120,18,156,134,118,168,130,113,48,11,186,215,226,93,37,248,47,224,159,192,111,64, - 55,218,226,92,240,46,112,15,248,53,56,7,122,222,2,198,193,44,88,137,231,139,34,56,104,239,161,171,138,114,39,120,18,156,134,246,168,130,15,131,7,153,124,142,201,15,115,188,106,37,222,215,195,230,14,240,118,184,63,191,114,113,188,205,115,8,91,181,106,193,191,19,238,27,193,247,192,170,44,252,224,70,112,103,71,188,124,143,149,217,181,26,239,179,87,59,238,18,147,119, - 50,62,8,255,167,192,207,184,240,173,57,39,172,157,108,203,29,223,110,75,40,75,109,176,98,169,13,150,218,64,249,131,104,131,107,83,158,3,21,156,151,82,82,226,190,92,186,207,94,39,2,127,138,62,120,29,216,190,194,57,191,83,199,186,166,206,208,16,54,4,222,0,142,96,29,243,3,240,70,184,247,131,17,236,221,190,157,229,217,193,241,238,21,206,218,232,125,144,31,0, - 143,193,125,35,228,223,130,219,192,36,120,26,97,159,97,121,103,177,134,249,49,56,104,159,3,234,195,115,50,194,191,6,190,9,190,5,126,221,231,172,133,94,128,60,226,162,47,131,53,87,38,128,31,35,223,83,224,231,46,249,255,13,97,207,131,23,193,74,164,237,178,215,77,43,157,184,181,144,167,128,51,153,127,7,232,91,235,172,191,94,3,54,98,45,247,122,200,243,65,17, - 156,140,184,45,107,157,116,175,132,44,35,236,28,200,97,200,43,192,219,192,187,192,53,92,121,231,34,254,92,112,61,11,123,202,110,139,149,88,43,162,61,198,33,207,71,220,199,184,244,59,124,184,11,233,138,72,255,57,46,125,25,254,123,224,255,103,46,236,126,184,167,193,67,96,24,241,251,192,143,224,126,18,92,9,247,85,224,89,184,255,5,188,19,238,127,135,252,29,232,196, - 218,241,189,240,191,31,124,16,168,240,247,130,245,171,22,202,222,4,247,203,193,40,226,255,4,242,207,193,235,193,5,171,156,53,168,104,243,45,72,119,27,120,3,226,222,8,38,225,254,36,216,239,146,118,7,248,60,226,222,142,184,119,179,248,175,192,255,53,240,62,248,63,0,238,91,235,172,115,255,150,197,255,29,228,39,61,202,218,1,166,145,254,243,66,252,207,209,7,31,67, - 251,127,5,225,223,4,223,2,15,114,105,30,134,251,81,240,19,240,16,242,255,0,252,15,184,31,135,252,41,248,95,112,255,2,242,255,248,232,221,193,248,127,72,147,193,154,121,37,56,9,108,0,167,102,23,226,183,194,253,10,240,106,240,58,144,7,5,46,126,135,15,37,143,116,187,17,190,25,99,119,4,242,87,176,243,87,109,228,205,130,77,143,99,78,121,156,241,151,62,246, - 252,181,100,157,119,252,30,243,91,180,195,111,99,224,69,38,187,214,121,167,177,159,99,127,235,18,254,95,79,128,126,200,193,182,92,11,172,21,252,31,106,177,46,69,220,139,138,17,185,9,186,111,5,119,112,54,124,2,238,79,131,83,96,219,102,240,247,112,255,19,56,156,80,155,255,27,230,185,187,236,179,183,217,197,225,103,65,247,89,160,129,240,175,67,62,194,197,63,1,247, - 217,8,59,251,15,148,159,181,161,254,175,109,145,127,97,253,244,239,66,127,238,136,153,109,208,181,221,135,223,49,253,203,176,199,178,10,104,8,211,36,89,179,58,126,123,227,102,8,118,14,49,54,194,222,83,193,214,54,218,93,229,206,239,87,5,254,120,181,35,255,140,201,49,216,248,81,112,231,58,199,127,46,194,95,128,124,1,156,239,98,115,145,229,171,130,50,220,195,46,105, - 254,175,189,247,216,139,53,237,106,103,223,244,109,144,239,2,215,128,223,217,123,189,171,177,134,5,227,128,16,191,162,119,33,207,139,108,175,117,37,248,45,220,157,189,78,158,9,164,237,131,251,100,112,6,120,5,88,15,54,129,173,224,85,224,19,72,115,63,234,145,217,24,141,79,163,140,207,174,115,228,151,109,247,106,236,157,175,78,127,92,201,242,207,176,245,91,62,246,94,134, - 58,61,136,248,135,67,214,233,114,228,155,123,9,180,195,85,176,243,42,23,126,202,108,127,13,198,202,235,193,47,218,80,151,95,65,199,89,88,75,255,134,211,165,96,95,161,43,231,157,103,21,226,214,130,83,192,153,224,85,224,53,44,253,185,62,249,118,48,102,236,107,55,183,240,55,44,5,184,75,160,12,246,130,179,237,119,12,27,157,191,91,234,101,82,207,57,239,131,222,2, - 249,159,193,187,192,53,224,122,22,126,47,199,140,240,55,50,47,67,25,167,131,87,128,18,23,254,106,248,95,11,182,129,129,141,11,225,151,192,189,7,236,3,186,173,127,163,19,254,14,200,119,51,247,12,184,6,238,26,243,223,0,121,16,182,140,231,156,185,167,201,199,56,255,93,112,127,14,220,195,194,190,206,228,253,144,223,229,234,97,162,172,143,176,114,191,207,218,233,78,248, - 31,97,238,42,87,246,19,224,103,224,151,224,95,89,25,85,97,78,253,15,166,167,210,227,188,115,225,219,234,222,54,211,179,38,253,115,123,73,177,134,181,237,57,39,128,45,231,36,204,198,53,254,237,144,180,254,115,78,96,54,167,92,255,179,82,190,198,239,61,1,56,39,166,107,249,222,151,32,61,109,28,127,103,191,132,219,233,222,152,218,250,181,224,18,172,89,46,97,236,16, - 214,59,27,216,119,28,54,184,176,109,205,241,233,95,106,236,245,56,251,179,247,15,128,129,53,233,239,233,164,77,41,211,113,140,109,249,46,9,50,202,182,90,143,178,237,112,183,67,30,110,169,124,93,129,236,175,169,74,165,214,161,84,14,99,189,171,144,178,47,223,9,63,128,187,130,176,97,60,222,236,169,57,113,85,59,78,233,84,118,43,153,121,89,57,220,161,12,29,238,148, - 162,98,167,87,58,149,170,93,142,226,48,175,87,33,156,23,107,15,118,93,42,168,195,30,212,103,4,122,119,129,17,48,133,184,169,54,48,12,253,85,244,229,158,60,36,244,110,67,251,255,161,255,219,230,54,46,15,199,55,190,131,216,175,216,99,16,207,174,24,243,251,48,54,246,49,116,244,79,165,214,173,140,0,29,110,235,80,183,114,217,97,167,223,182,163,15,117,54,118,116, - 228,171,34,125,25,233,202,243,233,51,74,129,229,173,176,252,101,96,33,255,94,228,47,51,127,217,142,87,236,179,146,201,141,247,42,116,212,125,226,167,18,166,10,253,83,1,105,234,191,231,114,42,166,52,245,19,88,214,125,234,53,229,147,166,46,184,235,46,121,234,33,242,76,5,164,159,10,136,155,146,212,85,119,73,51,5,44,23,123,44,129,58,120,144,203,255,160,135,123,42, - 130,156,138,177,127,167,124,108,171,199,168,167,126,130,200,41,15,234,62,253,94,119,105,147,122,68,125,83,47,17,172,54,235,155,150,96,0,247,223,129,0,70,4,6,108,106,221,32,195,100,247,98,191,194,165,113,201,63,210,164,230,220,243,143,161,176,176,121,153,113,181,119,196,142,83,22,179,41,227,208,212,53,32,196,143,180,136,137,53,143,185,132,50,223,6,74,135,35,243,33, - 176,243,40,30,132,41,39,239,80,92,65,74,1,20,153,28,176,251,105,197,130,159,176,70,36,48,192,252,5,70,5,207,82,69,46,158,24,35,43,156,126,182,227,42,76,22,25,132,248,34,39,139,172,172,98,12,16,87,102,209,135,66,130,20,5,119,209,69,103,81,82,214,151,97,190,1,245,144,178,224,161,175,234,210,222,5,183,246,95,254,210,166,144,50,197,19,68,234,160,116, - 97,215,60,38,187,214,75,112,95,204,40,158,32,118,22,19,144,197,22,243,22,78,16,251,11,17,36,97,30,92,217,73,109,129,216,156,223,3,119,191,7,221,39,0,253,157,157,202,250,237,153,99,246,110,70,216,102,112,234,246,206,121,127,110,103,215,75,142,245,59,51,243,178,127,21,29,11,235,231,221,55,118,204,75,18,238,207,36,160,238,164,182,65,1,186,251,97,127,255,170, - 227,211,249,113,93,7,29,199,118,196,220,9,121,39,99,226,218,206,121,110,7,21,172,91,38,58,58,149,73,132,79,2,115,27,230,70,73,42,216,47,190,14,146,160,119,226,90,236,219,193,111,160,12,35,69,6,20,249,180,205,251,128,41,195,54,57,198,238,235,148,98,194,238,131,251,24,130,77,70,202,109,104,156,64,76,96,92,25,1,227,114,187,226,63,118,15,32,238,0,23, - 63,233,146,214,96,250,198,208,31,99,18,24,156,141,147,12,195,182,119,115,107,216,215,208,117,144,6,48,117,216,195,220,70,155,49,161,219,140,9,98,115,146,193,235,232,120,105,163,109,57,49,41,93,129,245,172,36,26,210,83,136,123,10,113,28,249,97,167,20,214,6,236,69,165,76,99,79,87,32,211,72,55,13,142,130,185,121,58,149,185,143,116,204,135,17,171,115,3,233,158, - 216,211,57,79,227,141,200,199,49,125,10,244,248,248,27,12,98,101,205,33,126,174,69,8,249,181,62,244,119,194,148,202,24,39,12,98,118,87,16,78,226,181,188,217,31,59,61,165,140,145,192,28,64,33,202,165,16,182,154,146,107,12,147,191,111,17,230,236,243,186,148,81,6,217,182,17,116,251,64,205,182,33,119,127,88,40,32,47,177,120,226,251,133,220,109,178,235,98,192,63, - 202,213,201,20,32,150,118,148,171,51,113,126,147,149,65,1,237,61,202,229,37,151,54,49,56,251,76,65,247,216,183,176,14,144,192,96,249,111,255,27,172,183,193,56,220,227,34,127,131,245,183,157,230,60,39,253,4,211,71,205,249,231,34,204,33,96,6,16,252,22,246,165,44,23,72,168,139,37,132,91,30,249,172,0,40,32,47,9,186,44,15,55,177,186,16,228,12,171,207,12, - 171,91,131,133,19,71,67,8,111,120,164,109,184,228,37,151,118,176,4,187,200,239,62,247,32,238,99,18,52,152,61,22,87,126,3,254,185,128,242,137,191,238,47,194,216,2,163,128,236,113,183,2,99,38,0,18,210,145,100,62,67,162,44,195,39,158,60,210,18,87,23,3,254,81,86,159,81,86,55,83,128,92,234,61,202,165,167,230,245,184,34,218,125,196,206,111,0,83,40,119, - 12,125,55,38,193,4,242,222,126,145,179,47,226,167,195,244,169,103,238,178,46,37,203,32,248,213,151,225,249,222,7,98,229,170,30,126,53,36,20,144,151,4,93,170,143,77,57,212,65,133,63,11,153,99,117,202,9,16,75,155,229,234,76,156,63,199,133,145,11,57,174,108,18,226,84,15,59,115,66,185,189,63,238,148,98,51,203,223,231,1,73,142,179,198,229,152,3,78,103,115, - 11,164,229,2,241,115,210,233,139,195,101,210,18,115,147,16,70,46,233,200,67,15,185,132,91,18,144,80,223,25,212,119,6,52,152,156,1,228,18,63,195,194,103,56,127,131,75,107,185,148,77,92,25,36,217,254,71,158,194,124,44,193,44,244,205,50,142,122,240,196,229,157,243,146,220,230,234,55,97,142,226,48,129,113,6,230,24,31,200,158,35,206,240,246,135,133,34,230,55,88, - 25,212,156,191,206,192,252,197,234,98,10,245,27,5,196,234,109,50,72,240,155,44,140,60,48,185,52,6,116,25,12,114,155,75,207,112,226,248,60,100,207,215,63,197,124,44,1,249,216,49,241,137,140,50,142,178,199,61,152,4,86,14,247,239,18,198,41,99,206,204,204,135,89,62,144,61,142,115,222,254,176,80,136,252,228,145,150,154,243,82,9,243,18,252,51,144,13,48,227,2, - 177,116,51,156,127,134,185,27,12,242,105,215,25,46,31,121,96,9,182,54,132,114,143,52,112,125,74,64,92,25,36,57,55,16,71,110,23,238,19,32,203,80,215,97,254,15,128,144,79,245,241,171,33,200,50,253,57,14,66,121,89,206,38,18,252,57,102,231,102,166,155,56,84,161,236,62,200,62,15,84,142,28,167,155,64,239,35,184,31,74,208,231,83,126,31,99,243,45,157,190, - 109,217,24,193,120,97,144,221,159,155,208,159,49,64,252,120,219,20,79,153,124,217,86,136,116,36,97,7,113,246,54,88,91,16,127,93,141,44,180,147,29,223,96,16,151,126,134,75,51,227,2,121,221,47,127,130,235,73,2,18,108,153,19,236,38,9,140,45,106,170,152,130,219,244,128,4,187,247,225,28,185,225,81,230,129,128,178,76,48,129,125,214,177,167,113,95,146,96,226,138, - 204,60,228,214,126,107,160,19,16,115,19,23,102,112,144,71,184,17,1,10,208,105,184,96,10,110,51,0,131,149,79,62,245,58,192,164,233,81,6,53,215,9,15,161,61,37,32,15,125,22,250,204,242,129,236,107,122,139,127,154,168,144,208,255,13,236,217,55,90,96,6,227,169,225,18,62,199,133,91,46,250,27,33,116,80,4,251,26,49,65,176,225,40,234,116,212,102,11,214,240, - 46,52,144,238,168,71,28,217,249,183,56,238,185,187,50,14,87,48,137,48,29,41,116,142,185,45,29,243,144,203,181,90,239,193,217,51,23,136,197,145,71,30,98,238,41,184,167,34,96,72,64,246,184,239,57,62,204,45,220,16,210,24,156,52,66,230,55,132,114,140,22,243,27,39,120,253,140,16,118,25,109,172,159,17,51,196,116,154,3,120,86,99,76,32,124,98,0,247,50,91, - 246,184,51,30,51,196,223,43,123,162,213,105,82,18,242,88,235,20,113,230,180,152,0,196,202,47,216,103,90,151,29,79,51,126,255,222,140,162,109,196,123,188,54,48,188,81,81,246,236,21,214,42,120,79,105,72,82,201,103,142,113,51,252,55,51,140,0,200,103,173,169,98,190,86,67,66,46,249,114,184,95,228,24,20,102,173,187,18,54,198,128,89,196,245,196,168,176,54,34,9, - 253,106,23,236,143,129,220,5,168,59,160,144,107,125,11,239,125,173,144,144,144,143,236,53,133,142,123,59,160,144,250,179,57,213,149,156,224,206,73,210,95,202,48,58,148,158,166,63,135,115,121,144,167,150,240,156,203,210,17,211,223,139,61,138,94,9,200,195,254,62,148,221,39,1,121,228,159,192,51,246,4,168,216,127,203,93,235,80,38,118,57,99,231,214,91,48,39,219,113,183, - 32,204,102,29,198,24,158,255,77,198,117,235,156,245,204,24,158,241,199,36,32,175,241,191,14,227,55,97,200,239,250,91,23,156,223,174,175,1,73,110,249,187,144,38,1,72,114,252,106,189,152,91,83,130,160,191,52,132,115,31,140,65,129,146,75,56,9,246,15,114,105,7,61,40,113,144,144,95,103,118,16,163,50,134,113,12,134,142,116,74,161,157,174,198,2,53,251,227,116,239, - 56,25,12,164,55,66,64,17,243,27,146,229,18,99,12,239,68,198,36,24,23,202,152,132,127,18,88,25,204,217,9,209,56,31,247,0,48,195,104,0,98,250,231,16,63,7,52,60,179,107,49,51,8,74,156,44,121,64,246,245,178,102,113,250,160,60,37,46,221,160,64,73,18,98,109,80,186,164,75,25,194,94,198,144,4,228,209,255,67,17,243,87,96,79,197,131,1,159,56,98, - 249,205,48,103,176,243,11,220,196,185,41,228,26,129,98,100,116,59,222,145,1,147,201,81,96,116,98,206,247,128,196,235,239,126,92,95,18,76,108,199,253,219,166,19,247,240,166,123,187,195,36,194,38,37,48,153,157,166,15,147,18,229,16,127,191,34,92,131,46,148,112,126,105,16,148,24,131,28,37,33,174,196,197,81,64,123,87,80,118,133,67,197,253,66,229,200,226,158,146,245, - 33,23,64,86,72,71,156,238,254,33,172,253,4,122,113,207,233,149,128,184,114,84,206,222,177,31,161,127,37,48,240,188,101,184,80,224,254,86,171,224,1,249,180,103,29,207,178,245,54,65,46,58,251,177,222,239,247,129,2,198,131,201,205,3,21,132,152,156,223,148,100,48,32,94,67,185,26,135,233,18,166,185,196,13,10,101,80,128,253,102,130,144,135,174,2,206,46,21,124,40, - 6,80,240,128,88,253,138,30,249,136,197,23,2,244,19,43,131,60,100,33,33,251,11,18,118,145,132,253,23,5,80,240,40,187,224,97,255,69,96,132,197,141,112,20,66,230,31,113,201,87,112,169,87,209,165,223,70,124,242,23,36,218,127,132,131,92,218,145,130,236,255,112,230,88,222,237,53,231,239,127,120,200,14,207,35,92,130,178,226,124,243,193,206,67,160,92,235,158,15,43, - 11,84,57,134,145,110,79,94,81,166,15,177,180,118,158,26,135,100,126,130,156,150,252,134,198,52,7,241,115,72,30,247,150,8,152,104,3,179,133,181,215,77,28,166,139,223,12,1,69,88,127,61,140,246,120,152,81,103,223,36,121,88,160,140,62,209,145,90,119,153,131,171,136,171,10,232,46,84,89,223,233,62,80,27,214,155,122,128,13,122,194,246,232,33,244,235,33,108,212,99, - 46,87,119,209,163,75,164,91,169,182,142,173,163,27,178,59,37,200,94,91,45,91,252,253,11,155,163,30,212,133,180,141,29,120,198,102,212,89,24,185,140,129,185,15,226,253,231,14,188,27,101,204,34,221,28,11,155,194,154,110,202,5,66,190,41,143,247,38,83,92,184,101,159,193,59,163,117,220,202,39,198,52,226,231,222,36,183,143,238,70,195,62,235,217,19,237,253,146,204,251, - 52,242,193,8,200,111,36,28,191,155,189,139,24,134,187,194,189,191,169,184,161,176,119,60,77,153,119,190,211,104,83,1,212,202,252,115,16,249,219,0,37,164,139,78,144,250,82,92,247,131,26,202,11,1,185,148,161,173,234,81,180,27,241,204,20,36,111,76,152,48,122,87,5,196,1,98,245,51,217,58,103,36,223,49,207,192,78,7,59,45,185,180,135,122,61,246,6,218,4,217, - 250,14,194,29,3,196,141,135,178,128,30,97,124,144,223,124,184,186,39,18,155,97,247,230,148,32,123,236,31,196,120,105,51,100,183,115,205,65,189,59,60,182,221,196,216,12,255,230,152,32,137,254,86,79,130,13,17,24,123,6,251,105,18,24,103,226,158,119,166,156,77,97,176,176,127,106,185,240,176,36,13,236,209,54,192,28,220,115,216,251,157,19,32,73,59,234,18,223,200,164, - 152,235,78,130,110,139,123,166,157,98,126,75,64,195,30,160,198,24,196,121,128,65,80,98,12,2,29,225,58,71,73,56,51,80,198,255,101,23,116,198,190,154,243,109,105,62,15,241,243,75,63,198,65,140,76,76,96,207,126,158,142,121,40,160,173,6,247,161,158,28,37,6,5,228,171,236,195,122,11,12,61,129,247,55,18,144,215,245,118,10,174,27,15,114,111,196,30,185,36,89, - 6,133,24,39,253,182,158,226,178,182,67,156,13,217,139,187,148,254,213,216,139,118,227,98,188,3,104,178,122,113,156,157,119,0,255,247,126,31,251,255,18,144,88,247,213,78,57,198,122,188,191,21,48,193,1,151,112,195,133,177,71,49,159,73,96,184,228,37,187,255,151,161,15,2,200,225,121,49,231,66,150,145,243,240,147,204,124,191,108,177,30,25,91,178,92,217,189,223,65,251, - 74,64,205,118,95,134,118,199,115,108,63,67,59,3,239,92,129,6,40,161,249,144,24,26,211,51,0,42,12,117,61,234,37,73,118,55,218,149,145,101,244,239,70,61,128,138,248,30,70,150,165,33,73,187,140,128,231,85,35,98,60,181,160,219,144,124,94,157,138,225,27,199,133,21,139,253,246,253,106,4,165,143,184,220,55,10,24,63,133,8,168,66,127,102,133,254,204,9,125,155, - 21,250,178,23,215,114,175,4,228,117,189,173,196,28,200,65,33,199,176,122,16,249,98,130,196,178,235,8,111,51,36,94,163,7,163,173,185,211,88,227,83,138,76,249,92,87,20,114,108,117,99,205,219,45,64,110,99,112,167,243,221,71,217,239,48,158,182,74,46,157,219,247,27,85,159,112,226,226,201,195,173,6,96,68,252,86,209,29,12,138,225,254,100,196,244,237,36,138,80,22, - 37,124,15,54,66,218,115,251,181,206,183,51,197,189,30,179,69,42,74,39,246,73,237,189,85,251,55,158,216,239,52,225,28,111,5,12,179,247,134,149,195,222,237,96,199,15,11,178,130,235,176,2,134,5,127,133,177,139,163,210,140,207,59,229,85,176,95,85,177,169,57,236,230,202,25,246,208,83,1,85,176,155,201,42,131,236,242,106,220,111,90,177,48,10,104,127,138,105,236,25, - 17,199,220,118,188,107,166,249,58,116,28,171,231,62,174,46,21,48,204,181,69,213,14,203,99,207,156,201,10,228,144,36,21,214,238,85,86,78,117,190,252,142,216,246,234,212,22,160,69,247,121,242,77,163,198,24,79,156,222,125,236,119,161,170,104,143,17,182,103,184,15,254,125,246,251,108,197,121,199,215,124,87,91,101,232,12,66,60,73,176,157,59,31,160,43,206,251,223,102,156, - 133,51,91,86,8,168,133,60,86,74,101,19,87,30,69,44,155,90,108,47,43,166,252,86,4,157,196,81,193,59,171,10,131,132,184,50,254,47,39,12,113,250,116,110,44,235,94,172,144,163,204,208,57,72,86,135,178,24,59,31,53,109,92,209,158,115,16,94,232,130,109,122,27,48,185,51,44,26,246,152,181,54,67,92,253,173,46,140,229,136,80,132,246,55,217,153,170,114,155,32, - 65,255,108,150,22,65,18,54,91,72,103,53,81,163,243,176,100,26,114,177,69,195,30,177,150,0,165,10,246,141,5,200,77,255,153,72,159,2,100,207,181,251,177,223,182,21,126,14,18,237,219,186,56,94,164,114,101,70,185,20,242,82,1,146,28,191,198,203,176,230,75,1,98,250,199,126,140,253,88,9,200,195,254,34,202,42,198,8,9,229,23,16,86,104,35,36,232,87,177,175, - 167,250,64,1,253,171,98,61,175,70,128,66,204,133,253,49,60,175,26,88,151,24,9,65,41,234,167,152,234,79,17,219,151,130,198,203,114,244,187,11,196,197,147,79,58,53,38,136,211,65,130,125,196,185,45,140,57,43,1,8,229,207,109,195,89,63,184,103,125,208,54,164,135,109,35,249,80,70,154,114,0,20,113,188,88,43,209,94,49,65,92,121,228,162,107,22,225,179,2,218, - 201,201,80,246,128,56,123,42,195,25,197,192,122,212,104,3,228,210,30,19,118,220,218,100,17,117,142,35,108,156,139,31,143,8,9,229,142,135,196,194,59,227,6,222,89,55,24,132,178,26,156,155,4,26,92,218,6,176,144,223,226,32,123,12,174,246,246,39,5,185,216,71,46,182,207,34,237,108,0,228,115,189,206,225,221,253,156,31,171,253,243,27,125,232,119,1,179,140,189,92, - 238,183,19,168,217,167,125,232,35,129,137,50,206,130,184,49,43,55,23,105,120,7,162,37,0,241,215,245,118,236,127,120,96,97,14,176,18,128,154,115,220,201,232,67,31,44,60,219,88,49,65,110,115,108,63,244,248,160,194,6,53,6,200,167,143,251,17,223,207,65,33,239,73,125,200,211,231,1,69,189,223,109,68,219,5,64,17,117,144,15,7,241,204,126,48,38,168,5,253,55, - 32,223,13,49,65,62,122,198,17,63,238,130,134,51,82,26,71,9,103,172,74,28,20,96,255,208,227,56,255,37,1,121,217,213,1,59,82,130,236,241,183,21,99,76,2,66,218,198,149,184,143,128,71,177,71,64,205,241,187,117,33,190,21,202,167,97,29,228,129,6,40,32,191,138,52,106,12,228,170,56,7,34,73,31,210,247,113,244,187,64,49,93,159,6,206,180,24,17,25,247, - 129,98,158,79,52,236,33,104,9,65,18,250,75,231,227,186,245,160,114,62,238,185,54,25,236,115,9,144,56,46,51,24,131,17,24,122,0,215,189,4,20,161,173,75,168,83,255,37,56,159,6,40,68,190,78,238,236,136,129,177,106,68,132,124,116,141,61,137,253,54,9,200,107,60,117,161,239,61,40,93,128,126,21,24,116,9,43,9,144,61,111,127,27,237,47,65,229,2,140,23, - 14,13,122,7,153,30,13,110,10,104,107,11,207,84,86,76,52,46,197,185,117,200,185,155,177,110,244,120,134,35,23,102,55,97,173,21,35,20,102,62,200,161,175,98,128,90,44,107,176,132,190,98,148,56,6,185,176,65,46,188,82,66,63,219,228,48,47,112,238,18,251,214,190,134,115,133,154,7,196,226,201,37,29,5,228,213,2,160,16,249,43,56,215,72,94,247,147,77,184,102, - 35,48,58,210,117,12,51,0,114,155,15,126,130,235,93,2,242,176,63,119,17,238,193,32,203,32,132,169,120,103,170,250,64,44,175,234,225,87,67,66,1,121,73,208,165,122,164,49,243,78,93,108,127,150,213,39,199,213,45,203,213,145,64,214,195,159,229,194,84,159,247,199,89,46,29,113,168,46,246,101,133,114,115,204,182,156,11,228,210,63,57,143,120,10,96,116,15,198,22,48, - 57,70,153,52,176,191,104,112,76,236,193,115,62,207,6,82,198,126,136,241,35,193,4,203,67,208,57,129,124,166,80,62,133,176,153,98,36,183,31,237,14,114,12,21,239,246,84,208,207,36,5,228,239,125,6,231,147,37,32,175,249,122,19,230,144,22,25,196,53,63,200,40,9,16,43,127,144,75,51,200,197,15,114,238,202,29,152,115,71,24,119,224,28,151,205,38,204,107,77,70, - 184,248,144,104,200,175,113,148,4,251,74,187,160,223,254,230,231,46,128,111,92,106,30,223,185,36,15,134,30,193,186,65,2,242,200,63,97,127,103,244,150,112,120,149,69,45,160,158,142,113,38,73,238,114,140,85,144,99,50,203,220,57,23,178,76,170,62,191,87,69,246,248,125,10,227,83,2,74,232,250,211,58,212,182,65,205,49,215,161,30,99,144,81,18,24,116,9,43,113,101, - 80,115,252,221,135,241,37,65,25,121,203,160,130,119,82,21,134,14,191,218,141,190,13,65,182,128,190,101,228,36,200,114,238,126,228,39,193,254,35,152,155,142,72,48,139,185,112,54,0,10,217,247,22,242,88,246,59,192,229,238,28,75,183,124,177,59,40,143,229,226,182,90,100,230,194,46,87,8,101,207,112,110,2,13,184,27,44,172,1,44,150,223,98,178,1,230,46,196,30,61, - 131,36,218,232,200,119,209,254,18,144,87,27,175,71,61,124,32,201,116,86,4,102,118,163,77,24,13,1,106,182,221,110,199,207,167,157,97,97,22,202,152,187,21,207,96,172,44,74,104,46,34,23,42,47,199,253,239,205,184,94,121,238,6,8,47,189,57,216,22,11,207,235,13,236,97,53,92,152,97,52,56,44,164,183,56,230,238,196,88,169,58,4,233,162,4,80,237,119,6,253, - 201,226,167,223,34,180,67,0,36,153,206,138,200,204,121,232,35,31,200,30,199,231,185,199,53,243,90,40,103,238,60,244,167,0,73,246,199,145,111,225,122,151,96,22,122,102,91,132,56,125,115,227,176,111,188,67,177,240,238,207,138,1,106,94,239,101,180,71,11,144,61,239,150,253,211,240,241,51,66,94,10,192,192,57,71,195,3,226,226,41,32,173,17,1,83,195,243,151,11,196, - 217,105,50,191,201,197,153,30,249,76,96,176,114,41,160,254,99,22,158,215,36,32,143,252,26,244,104,46,16,23,71,62,233,180,152,24,68,93,7,5,8,122,75,144,37,230,30,100,225,37,78,106,30,231,92,137,49,132,186,15,73,64,73,205,199,125,152,51,99,34,135,107,34,7,178,140,126,132,245,3,138,211,222,147,162,149,247,196,199,157,223,182,141,10,181,160,123,238,114,156, - 15,194,187,54,163,13,144,135,13,55,35,238,230,22,33,228,159,192,187,195,9,1,10,209,6,134,164,157,148,16,22,158,89,172,22,33,228,191,191,187,195,7,69,185,191,16,80,127,252,173,173,225,1,181,163,254,157,168,75,194,144,159,254,117,72,147,18,4,253,71,176,119,115,68,2,18,175,221,93,88,183,0,138,216,254,170,253,205,118,138,78,179,188,28,214,128,57,129,254,16, - 235,191,105,140,187,105,142,185,157,25,229,104,136,177,120,228,123,104,47,9,8,105,103,81,238,172,7,100,143,141,85,232,167,152,33,183,49,184,42,217,242,195,208,135,51,139,125,9,209,255,6,188,91,182,89,11,55,32,183,249,232,100,204,61,146,144,144,215,28,198,58,16,225,163,144,163,45,66,62,109,99,34,222,228,56,0,93,7,66,210,243,166,14,165,103,175,243,183,196,3, - 192,204,5,127,115,138,103,176,136,181,28,160,86,175,247,79,224,122,77,16,10,208,111,224,221,167,145,0,20,99,253,41,226,53,68,62,104,73,127,51,243,70,111,252,236,34,89,251,87,57,223,210,228,191,167,73,33,48,132,239,61,82,80,127,221,134,62,105,35,36,218,219,141,241,37,9,185,213,183,91,62,191,95,57,20,178,60,98,233,39,225,54,177,55,110,130,137,66,230,184, - 239,237,83,130,99,157,92,208,241,191,158,0,20,131,126,74,216,70,61,164,173,212,74,251,174,112,254,118,188,132,247,228,37,134,14,63,181,169,127,203,248,191,28,35,116,130,140,47,93,210,150,114,204,245,47,135,108,147,34,254,47,182,64,193,7,66,185,133,128,52,5,70,81,162,188,66,140,20,153,125,69,206,77,204,79,66,155,144,71,27,145,68,187,21,60,218,132,2,218,134, - 66,180,93,161,197,190,43,250,216,89,244,169,35,73,142,25,10,72,67,33,235,88,136,216,223,69,159,250,20,125,236,39,201,235,132,98,168,15,69,188,30,139,45,244,119,53,160,221,10,156,93,67,135,177,143,27,3,147,167,210,34,204,125,93,199,220,19,251,176,31,199,115,106,180,251,144,93,182,41,64,30,225,166,36,20,241,126,151,195,158,122,206,3,10,136,207,73,66,33,117, - 145,71,90,74,224,126,175,102,177,110,14,9,241,237,55,8,219,60,232,65,218,30,15,136,229,239,157,193,249,29,9,200,197,238,205,45,254,141,17,241,229,108,69,157,66,144,187,18,117,227,232,253,25,236,147,128,92,116,159,122,101,167,162,97,31,69,19,160,230,90,100,45,214,11,1,148,222,128,53,162,7,36,81,255,41,252,63,197,209,192,51,69,195,131,105,110,254,33,198,17, - 204,33,71,36,32,33,223,28,131,98,160,140,255,203,45,162,215,112,246,137,243,239,19,252,101,151,58,83,130,246,148,99,66,143,152,159,88,93,140,14,60,143,114,144,75,152,145,32,196,233,35,230,38,206,54,10,97,15,249,212,135,132,178,73,192,112,137,51,60,242,27,45,216,79,18,229,145,75,126,35,68,223,144,100,30,138,169,109,141,22,251,155,92,218,217,8,208,67,9,234, - 167,16,220,137,50,238,140,80,142,206,190,193,168,75,66,2,122,204,80,72,244,24,116,233,17,203,208,219,0,73,183,71,119,11,80,236,223,141,214,149,229,237,225,198,214,199,142,211,94,212,86,168,5,253,36,97,63,197,92,127,106,19,122,30,125,24,166,13,243,225,210,7,234,175,69,235,195,200,249,149,120,9,221,254,74,2,248,212,151,34,182,31,197,140,30,178,110,20,115,251, - 81,76,246,81,139,249,169,77,227,131,132,254,166,86,251,171,150,32,108,110,161,8,101,80,179,156,60,67,244,231,37,137,88,23,242,169,7,121,196,147,11,186,132,14,242,65,143,1,106,177,124,106,1,61,106,125,149,24,175,25,123,125,174,132,207,19,133,33,201,125,92,242,42,163,22,255,28,45,133,226,232,79,227,247,24,181,132,127,31,134,66,180,131,22,241,247,99,180,151,248, - 111,215,104,105,219,169,56,191,63,224,121,125,40,201,98,255,77,191,25,1,138,168,63,147,239,78,5,98,250,235,61,148,42,197,101,233,34,254,6,104,61,38,57,21,64,157,251,173,181,130,15,197,0,10,17,243,235,236,62,88,180,101,205,249,109,208,249,61,14,133,133,177,240,2,243,23,25,5,70,145,15,171,113,249,240,251,36,58,123,103,90,116,65,231,169,177,125,21,46,174, - 200,108,43,50,127,221,110,179,67,221,139,242,23,184,242,234,107,28,105,135,105,2,5,78,87,65,200,87,117,161,200,165,43,112,249,171,92,57,83,107,28,121,220,222,124,173,219,65,241,136,19,220,43,213,116,177,219,109,202,229,55,113,167,2,198,120,221,227,55,116,167,2,174,129,105,70,189,201,50,132,131,122,74,178,184,28,253,11,138,33,165,6,74,23,118,41,23,115,84,88, - 88,73,130,10,210,14,180,160,183,24,81,14,48,74,204,142,17,140,193,17,197,233,11,190,239,234,33,231,185,122,76,114,58,196,220,89,23,198,227,148,132,28,96,245,29,113,169,179,21,115,253,234,30,215,73,221,231,250,169,7,200,10,214,76,245,67,237,193,254,109,175,10,244,237,201,43,243,191,61,181,11,20,113,222,181,152,34,133,132,57,24,227,247,85,15,182,64,253,204,116, - 89,137,51,11,43,83,164,136,235,178,216,6,10,9,81,124,137,219,95,144,168,79,181,77,186,171,41,183,115,245,247,164,94,213,4,251,168,126,130,48,149,22,61,237,163,2,125,211,98,248,26,119,92,159,7,151,47,172,191,227,98,0,229,14,128,105,143,240,1,142,41,15,91,167,124,24,88,238,31,159,36,211,46,20,2,158,183,47,10,160,16,49,255,84,27,199,219,148,27,107, - 218,135,189,70,159,134,156,230,40,224,153,173,144,34,35,88,3,79,97,109,60,213,6,134,177,254,174,178,245,119,181,230,248,163,174,111,45,156,17,183,34,112,67,140,223,255,191,161,5,166,176,70,157,74,145,110,172,81,187,83,196,58,37,25,26,111,196,25,98,142,105,151,176,6,48,48,31,27,192,196,222,129,105,239,99,228,157,223,138,29,251,110,167,20,19,200,123,128,149,97, - 180,194,186,5,14,112,110,163,93,108,76,150,3,30,76,236,205,204,51,45,204,135,211,109,96,128,187,135,79,167,160,127,154,179,227,178,195,138,178,23,12,99,46,220,131,121,113,216,67,86,216,184,172,52,169,117,204,239,253,84,154,126,69,112,11,236,62,156,153,167,194,151,161,144,178,127,222,173,28,251,125,115,29,12,20,59,20,13,242,82,188,35,27,14,176,107,152,73,157,229, - 29,14,72,183,59,223,113,204,189,135,229,187,20,122,46,13,192,20,222,83,101,139,14,246,111,179,15,136,228,187,142,217,115,41,87,198,128,93,175,188,243,219,239,205,120,227,38,14,251,111,204,111,114,145,110,172,14,136,115,137,175,64,247,128,210,163,28,184,184,99,30,3,97,234,221,241,211,243,230,14,249,244,39,37,75,143,7,253,151,102,230,49,112,15,50,66,112,0,76,236, - 199,220,241,201,142,121,105,132,204,111,8,140,224,26,24,73,136,1,9,140,245,106,36,14,248,196,77,114,24,96,20,152,76,26,140,61,236,218,31,62,54,207,40,243,227,212,224,199,241,106,111,236,241,108,120,93,7,55,181,143,129,230,247,81,46,116,238,227,54,163,192,136,114,111,94,222,58,77,253,38,179,97,148,249,71,57,251,76,15,70,5,76,206,109,216,101,231,133,247,246, - 92,94,35,192,46,21,247,124,181,77,228,118,117,205,163,194,157,133,204,2,107,11,41,71,239,202,28,99,206,102,11,57,242,46,219,221,177,224,190,162,233,119,1,225,71,231,243,117,204,203,163,140,198,21,88,215,129,163,92,216,81,14,35,226,245,102,196,200,40,119,77,154,28,163,46,97,166,75,220,168,224,55,192,216,163,88,151,74,48,177,27,115,168,205,122,204,167,28,134,164, - 173,134,128,41,196,141,114,24,46,97,163,30,105,12,151,58,27,45,96,186,216,60,234,129,201,217,55,38,217,126,163,66,254,73,134,90,92,150,46,7,83,166,158,46,6,246,116,140,20,185,245,2,172,73,240,187,76,198,9,196,36,152,136,171,188,83,210,69,205,225,26,75,145,28,35,203,185,115,46,100,25,70,26,207,244,235,22,99,226,190,107,2,67,8,55,146,224,116,212,57, - 69,180,53,233,98,110,71,91,115,140,2,163,19,237,210,38,76,166,211,116,97,148,147,163,140,156,238,144,5,234,102,92,95,41,144,101,54,228,56,178,140,28,231,207,113,168,44,111,239,209,78,41,84,15,221,26,165,139,218,155,46,214,25,233,178,232,155,131,171,122,218,254,141,195,221,246,179,238,106,143,125,31,81,222,148,48,237,210,115,211,2,42,246,197,212,52,185,62,93,194, - 252,189,128,150,0,106,2,251,127,106,8,140,136,251,103,70,68,172,54,124,207,219,242,65,179,239,1,155,113,126,20,247,20,13,82,99,148,4,191,230,17,166,69,196,232,79,151,193,125,93,243,104,120,23,170,165,192,32,211,63,40,137,41,177,127,102,74,96,120,236,143,77,112,24,182,252,16,158,231,184,61,189,161,239,119,74,161,173,70,253,18,164,116,49,206,59,251,80,177,223, - 235,92,156,81,84,251,153,233,148,214,201,161,172,28,35,11,84,232,86,83,34,199,108,200,114,54,229,56,219,178,46,126,21,103,28,212,20,209,206,192,115,65,138,148,56,89,226,252,154,139,95,115,137,83,177,39,168,166,73,29,125,184,18,123,59,237,162,222,94,125,113,124,67,200,0,119,180,136,145,18,123,216,59,39,203,126,6,233,77,17,236,105,89,105,146,77,23,109,107,186, - 68,57,187,101,197,128,138,61,91,53,77,58,210,197,192,53,96,164,136,245,178,228,56,202,152,245,193,178,207,160,173,77,15,213,30,131,167,182,151,62,70,191,237,223,208,126,250,56,140,62,127,38,3,226,141,136,104,246,51,96,103,122,88,56,11,103,165,136,134,53,190,150,34,150,125,15,216,154,30,218,105,237,167,204,49,120,62,158,215,192,32,208,50,136,111,51,37,166,191,228, - 65,238,18,135,44,80,113,102,81,109,51,89,166,59,203,236,200,113,100,133,240,126,164,239,7,157,182,188,4,231,203,64,233,2,212,131,161,97,189,165,181,153,220,8,108,3,89,160,110,66,157,82,36,203,236,200,50,155,114,1,100,61,236,238,31,65,219,218,108,114,220,98,190,126,132,103,153,187,247,39,120,255,34,129,106,151,117,7,246,43,88,153,253,12,3,126,35,37,76,216, - 111,216,247,168,13,233,50,186,7,239,234,24,102,0,42,246,84,213,20,201,238,199,152,97,228,60,200,114,50,43,164,215,208,238,90,154,172,75,151,65,188,167,31,100,148,2,24,228,210,13,50,169,158,142,126,72,147,238,116,209,216,239,208,151,36,208,144,86,75,144,146,135,222,65,166,187,36,132,87,238,206,28,247,123,247,86,74,52,170,56,71,25,146,25,206,61,87,197,217,77, - 134,133,242,230,238,132,27,168,62,191,123,175,182,1,3,107,62,35,69,44,140,81,43,85,148,5,10,28,98,186,130,24,214,76,231,145,62,105,155,11,238,122,189,126,139,216,104,59,138,98,236,4,17,203,177,82,166,177,19,215,175,7,115,59,113,13,55,89,133,107,26,28,21,48,66,252,30,171,145,0,106,194,191,87,170,6,96,36,244,123,165,134,44,55,225,222,211,230,51,52, - 154,15,106,155,127,143,83,21,48,236,57,162,59,61,90,249,189,35,53,78,182,166,139,248,91,67,90,155,49,183,225,185,8,108,87,22,220,237,228,200,211,157,82,204,110,193,126,180,4,71,175,200,28,251,251,150,6,39,31,219,162,40,63,188,66,57,38,103,16,54,3,74,56,179,80,74,17,83,252,91,165,188,28,205,252,149,26,206,232,49,118,49,134,37,255,38,117,24,82,71, - 191,235,2,131,40,127,80,208,167,187,196,15,10,108,15,192,12,64,103,229,155,18,105,244,152,49,19,210,99,70,248,45,61,51,102,38,241,62,99,146,195,140,169,156,73,151,114,39,3,210,76,50,70,35,252,182,252,104,12,12,197,244,187,141,67,45,242,240,161,238,112,172,161,197,28,106,49,31,227,210,21,233,83,22,208,125,184,25,247,204,155,83,164,220,252,222,107,45,29,100, - 127,179,168,156,4,10,250,0,223,98,208,109,89,235,96,208,162,249,110,56,196,189,103,15,39,203,73,181,151,178,216,190,32,202,168,79,89,2,61,33,202,129,253,79,210,54,150,19,178,187,28,129,113,172,57,199,83,100,22,123,176,179,49,115,52,128,39,62,222,121,140,178,61,198,148,20,105,105,206,33,142,238,72,236,199,185,219,253,94,40,29,139,252,219,149,46,229,58,172,197, - 174,59,188,252,216,26,114,55,194,119,35,221,110,91,230,157,111,182,236,70,185,21,27,101,241,247,98,108,247,101,130,191,194,165,173,216,28,230,64,121,111,58,220,173,92,1,182,187,172,95,247,67,111,165,214,233,143,178,96,195,188,158,60,242,216,40,88,155,51,42,28,85,165,147,251,182,68,199,162,244,21,31,170,76,238,106,134,229,133,111,220,52,81,22,194,230,219,52,31,188, - 78,79,146,76,74,191,127,144,97,116,229,213,84,169,216,227,226,240,194,184,60,54,86,14,47,192,135,93,214,116,231,133,126,117,233,231,221,243,82,153,247,239,182,251,93,225,198,34,220,21,137,251,223,176,248,221,34,197,35,109,208,189,181,198,16,194,171,12,221,135,225,32,221,74,235,52,245,87,57,134,153,190,170,71,124,53,1,134,37,215,69,213,20,116,14,135,148,213,20,219, - 173,218,70,221,85,143,177,162,115,99,75,119,113,235,30,227,80,143,145,170,168,191,230,92,159,77,169,39,68,53,44,181,238,5,89,99,110,62,174,198,133,241,110,69,200,139,223,27,169,218,40,46,233,196,176,26,43,183,137,226,82,94,83,214,92,224,211,40,46,122,196,180,138,79,157,130,168,121,212,57,40,157,18,162,124,62,111,205,167,109,252,252,74,68,226,44,191,38,217,102, - 178,241,74,140,117,140,171,44,37,6,14,71,47,35,169,121,68,247,160,154,130,78,157,211,93,141,25,253,4,169,131,222,42,53,129,208,249,187,23,214,142,53,230,118,67,9,81,14,243,87,221,242,213,66,166,19,210,234,110,241,53,9,251,100,237,175,133,40,79,34,93,53,0,157,215,87,19,244,207,187,201,61,141,226,204,103,209,234,76,137,141,231,106,8,244,128,178,244,192,122, - 116,75,247,223,62,172,81,246,121,81,243,137,11,162,22,16,198,220,186,120,189,214,146,99,164,182,252,56,54,227,204,197,230,20,209,35,142,55,61,42,53,151,177,210,78,148,54,216,35,234,80,18,108,15,175,114,20,89,253,2,243,97,221,199,151,173,120,216,125,92,56,45,158,51,107,112,47,10,167,197,191,87,173,180,1,94,183,34,198,177,58,132,237,55,37,110,27,61,218,179, - 221,237,83,147,161,217,183,62,125,220,12,175,137,233,197,48,209,205,245,147,239,245,74,62,215,5,121,216,76,194,248,235,246,73,79,238,99,166,198,16,127,127,93,17,210,37,65,13,182,242,254,195,216,19,20,152,204,224,28,65,138,232,7,83,166,217,63,181,116,216,12,27,54,167,132,30,131,253,147,56,15,58,153,18,122,202,250,39,153,13,186,95,255,222,157,46,126,103,65,244, - 54,48,41,121,142,105,50,33,116,123,14,172,181,0,63,135,214,98,96,209,188,76,194,125,166,59,2,116,60,121,110,189,20,55,10,35,201,121,81,241,209,225,21,158,231,238,173,110,237,144,119,137,143,147,188,139,110,89,106,49,234,143,131,90,192,88,18,211,230,37,235,210,140,207,71,168,115,179,255,21,137,241,224,151,87,137,56,54,221,168,69,196,175,108,37,65,187,101,168,37, - 132,221,79,121,143,49,22,87,249,53,73,157,113,160,180,185,29,91,209,147,247,185,214,69,148,136,227,198,139,195,220,115,8,206,235,232,77,20,159,122,136,246,214,90,28,15,110,117,175,181,216,159,34,121,143,251,143,23,249,22,239,13,126,113,97,202,23,245,200,232,142,10,95,190,232,22,210,138,255,254,63,0,0,0,255,255,0,0,0,255,255,99,102,0,0}; + 0, 0, 16, 0, 0, 0, 0, 0, 0, 164, 1, 0, 108, 4, 0, 0, 116, 4, 0, 0, 124, 4, 0, 0, 132, 4, 0, 0, 156, 4, 0, 0, 164, 4, 0, 0, 172, 4, 0, 0, 180, 4, 0, 0, 188, 4, 0, 0, 196, 4, 0, 0, 202, 4, 0, 0, 210, 4, 0, 0, 218, 4, 0, 0, 226, 4, 0, 0, 234, 4, 0, 0, 242, 4, 0, 0, 248, 4, 0, 0, 0, 5, 0, 0, 8, 5, 0, 0, 16, 5, 0, 0, 19, 5, 0, 0, 27, 5, 0, 0, + 35, 5, 0, 0, 43, 5, 0, 0, 51, 5, 0, 0, 59, 5, 0, 0, 64, 5, 0, 0, 72, 5, 0, 0, 80, 5, 0, 0, 88, 5, 0, 0, 93, 5, 0, 0, 101, 5, 0, 0, 109, 5, 0, 0, 117, 5, 0, 0, 121, 5, 0, 0, 129, 5, 0, 0, 137, 5, 0, 0, 145, 5, 0, 0, 153, 5, 0, 0, 161, 5, 0, 0, 157, 5, 0, 0, 165, 5, 0, 0, 170, 5, 0, 0, 178, 5, 0, 0, 184, 5, 0, 0, 192, 5, 0, 0, 200, 5, 0, 0, + 208, 5, 0, 0, 216, 5, 0, 0, 224, 5, 0, 0, 232, 5, 0, 0, 240, 5, 0, 0, 245, 5, 0, 0, 253, 5, 0, 0, 0, 6, 0, 0, 8, 6, 0, 0, 16, 6, 0, 0, 24, 6, 0, 0, 30, 6, 0, 0, 38, 6, 0, 0, 46, 6, 0, 0, 54, 6, 0, 0, 62, 6, 0, 0, 70, 6, 0, 0, 22, 19, 0, 0, 78, 6, 0, 0, 86, 6, 0, 0, 94, 6, 0, 0, 100, 6, 0, 0, 224, 5, 0, 0, 30, 19, 0, 0, 252, 22, 0, 0, + 163, 19, 0, 0, 165, 19, 0, 0, 173, 19, 0, 0, 38, 19, 0, 0, 108, 6, 0, 0, 114, 6, 0, 0, 122, 6, 0, 0, 130, 6, 0, 0, 138, 6, 0, 0, 144, 6, 0, 0, 152, 6, 0, 0, 160, 6, 0, 0, 168, 6, 0, 0, 174, 6, 0, 0, 182, 6, 0, 0, 190, 6, 0, 0, 198, 6, 0, 0, 204, 6, 0, 0, 212, 6, 0, 0, 220, 6, 0, 0, 228, 6, 0, 0, 236, 6, 0, 0, 244, 6, 0, 0, 251, 6, 0, 0, 3, 7, 0, 0, + 9, 7, 0, 0, 17, 7, 0, 0, 25, 7, 0, 0, 33, 7, 0, 0, 39, 7, 0, 0, 47, 7, 0, 0, 55, 7, 0, 0, 63, 7, 0, 0, 181, 19, 0, 0, 71, 7, 0, 0, 79, 7, 0, 0, 87, 7, 0, 0, 94, 7, 0, 0, 102, 7, 0, 0, 110, 7, 0, 0, 118, 7, 0, 0, 122, 7, 0, 0, 130, 7, 0, 0, 137, 7, 0, 0, 145, 7, 0, 0, 152, 7, 0, 0, 160, 7, 0, 0, 137, 7, 0, 0, 189, 19, 0, 0, 4, 23, 0, 0, + 168, 7, 0, 0, 173, 7, 0, 0, 181, 7, 0, 0, 188, 7, 0, 0, 196, 7, 0, 0, 137, 7, 0, 0, 197, 19, 0, 0, 203, 19, 0, 0, 211, 19, 0, 0, 219, 19, 0, 0, 227, 19, 0, 0, 175, 17, 0, 0, 204, 7, 0, 0, 167, 18, 0, 0, 235, 19, 0, 0, 235, 19, 0, 0, 235, 19, 0, 0, 243, 19, 0, 0, 243, 19, 0, 0, 249, 19, 0, 0, 251, 19, 0, 0, 251, 19, 0, 0, 3, 20, 0, 0, 3, 20, 0, 0, 212, 7, 0, 0, + 3, 20, 0, 0, 220, 7, 0, 0, 224, 7, 0, 0, 232, 7, 0, 0, 3, 20, 0, 0, 238, 7, 0, 0, 3, 20, 0, 0, 244, 7, 0, 0, 252, 7, 0, 0, 4, 8, 0, 0, 183, 17, 0, 0, 183, 17, 0, 0, 12, 8, 0, 0, 11, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, + 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 12, 20, 0, 0, 17, 20, 0, 0, 20, 8, 0, 0, 25, 20, 0, 0, 25, 20, 0, 0, 28, 8, 0, 0, 36, 8, 0, 0, 44, 8, 0, 0, 52, 8, 0, 0, 60, 8, 0, 0, 33, 20, 0, 0, 36, 20, 0, 0, 68, 8, 0, 0, 76, 8, 0, 0, 84, 8, 0, 0, 44, 20, 0, 0, 46, 19, 0, 0, 92, 8, 0, 0, 51, 20, 0, 0, + 100, 8, 0, 0, 12, 20, 0, 0, 104, 8, 0, 0, 112, 8, 0, 0, 120, 8, 0, 0, 128, 8, 0, 0, 133, 8, 0, 0, 59, 20, 0, 0, 141, 8, 0, 0, 147, 8, 0, 0, 226, 24, 0, 0, 155, 8, 0, 0, 67, 20, 0, 0, 163, 8, 0, 0, 171, 8, 0, 0, 179, 8, 0, 0, 187, 8, 0, 0, 195, 8, 0, 0, 137, 7, 0, 0, 75, 20, 0, 0, 78, 20, 0, 0, 203, 8, 0, 0, 211, 8, 0, 0, 86, 20, 0, 0, 94, 20, 0, 0, + 102, 20, 0, 0, 219, 8, 0, 0, 110, 20, 0, 0, 227, 8, 0, 0, 235, 8, 0, 0, 54, 19, 0, 0, 243, 8, 0, 0, 247, 8, 0, 0, 255, 8, 0, 0, 7, 9, 0, 0, 12, 5, 0, 0, 175, 18, 0, 0, 62, 19, 0, 0, 183, 18, 0, 0, 190, 18, 0, 0, 70, 19, 0, 0, 51, 5, 0, 0, 51, 5, 0, 0, 188, 4, 0, 0, 188, 4, 0, 0, 188, 4, 0, 0, 188, 4, 0, 0, 191, 17, 0, 0, 188, 4, 0, 0, 188, 4, 0, 0, + 188, 4, 0, 0, 15, 9, 0, 0, 199, 17, 0, 0, 19, 9, 0, 0, 27, 9, 0, 0, 198, 18, 0, 0, 35, 9, 0, 0, 43, 9, 0, 0, 51, 9, 0, 0, 195, 23, 0, 0, 203, 23, 0, 0, 211, 23, 0, 0, 59, 9, 0, 0, 67, 9, 0, 0, 210, 24, 0, 0, 75, 9, 0, 0, 83, 9, 0, 0, 207, 17, 0, 0, 215, 17, 0, 0, 223, 17, 0, 0, 84, 23, 0, 0, 91, 9, 0, 0, 48, 24, 0, 0, 53, 24, 0, 0, 59, 24, 0, 0, + 67, 24, 0, 0, 75, 24, 0, 0, 83, 24, 0, 0, 91, 24, 0, 0, 99, 24, 0, 0, 106, 24, 0, 0, 114, 24, 0, 0, 119, 24, 0, 0, 251, 23, 0, 0, 3, 24, 0, 0, 234, 24, 0, 0, 127, 24, 0, 0, 135, 24, 0, 0, 142, 24, 0, 0, 147, 24, 0, 0, 155, 24, 0, 0, 234, 24, 0, 0, 98, 9, 0, 0, 106, 9, 0, 0, 111, 23, 0, 0, 112, 23, 0, 0, 242, 24, 0, 0, 242, 24, 0, 0, 119, 23, 0, 0, 242, 24, 0, 0, + 242, 24, 0, 0, 247, 24, 0, 0, 251, 24, 0, 0, 3, 25, 0, 0, 163, 24, 0, 0, 171, 24, 0, 0, 179, 24, 0, 0, 11, 25, 0, 0, 19, 25, 0, 0, 27, 25, 0, 0, 187, 24, 0, 0, 28, 25, 0, 0, 36, 25, 0, 0, 44, 25, 0, 0, 52, 25, 0, 0, 60, 25, 0, 0, 234, 24, 0, 0, 64, 25, 0, 0, 127, 23, 0, 0, 133, 23, 0, 0, 234, 24, 0, 0, 11, 24, 0, 0, 18, 24, 0, 0, 72, 25, 0, 0, 72, 25, 0, 0, + 72, 25, 0, 0, 72, 25, 0, 0, 72, 25, 0, 0, 72, 25, 0, 0, 72, 25, 0, 0, 72, 25, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 26, 24, 0, 0, 114, 24, 0, 0, 33, 24, 0, 0, 40, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 114, 24, 0, 0, 234, 24, 0, 0, 195, 24, 0, 0, 202, 24, 0, 0, + 114, 9, 0, 0, 120, 9, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 231, 17, 0, 0, 235, 17, 0, 0, 206, 18, 0, 0, 243, 17, 0, 0, 251, 17, 0, 0, 251, 17, 0, 0, 251, 17, 0, 0, 128, 9, 0, 0, 214, 18, 0, 0, 136, 9, 0, 0, 118, 20, 0, 0, 142, 9, 0, 0, 150, 9, 0, 0, 158, 9, 0, 0, 158, 9, 0, 0, 12, 23, 0, 0, 243, 23, 0, 0, 78, 19, 0, 0, 166, 9, 0, 0, 137, 7, 0, 0, + 174, 9, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 181, 9, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 80, 25, 0, 0, 189, 9, 0, 0, 195, 9, 0, 0, 86, 19, 0, 0, 94, 19, 0, 0, 203, 9, 0, 0, 126, 20, 0, 0, 211, 9, 0, 0, 134, 20, 0, 0, 142, 20, 0, 0, 102, 19, 0, 0, 219, 9, 0, 0, 223, 9, 0, 0, 150, 20, 0, 0, 150, 20, 0, 0, 228, 9, 0, 0, + 158, 20, 0, 0, 88, 25, 0, 0, 235, 9, 0, 0, 243, 9, 0, 0, 141, 23, 0, 0, 147, 23, 0, 0, 96, 25, 0, 0, 141, 23, 0, 0, 155, 23, 0, 0, 104, 25, 0, 0, 108, 25, 0, 0, 116, 25, 0, 0, 116, 25, 0, 0, 118, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 234, 24, 0, 0, 234, 24, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 110, 19, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, + 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 174, 20, 0, 0, 251, 9, 0, 0, 126, 25, 0, 0, 2, 10, 0, 0, 118, 19, 0, 0, 182, 20, 0, 0, 182, 20, 0, 0, + 182, 20, 0, 0, 182, 20, 0, 0, 182, 20, 0, 0, 182, 20, 0, 0, 182, 20, 0, 0, 182, 20, 0, 0, 126, 19, 0, 0, 10, 10, 0, 0, 129, 5, 0, 0, 3, 18, 0, 0, 11, 18, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 18, 10, 0, 0, 134, 19, 0, 0, 19, 18, 0, 0, 188, 4, 0, 0, 24, 18, 0, 0, 32, 18, 0, 0, 38, 18, 0, 0, 26, 10, 0, 0, 33, 10, 0, 0, 198, 20, 0, 0, 41, 10, 0, 0, 206, 20, 0, 0, + 49, 10, 0, 0, 214, 20, 0, 0, 217, 20, 0, 0, 57, 10, 0, 0, 225, 20, 0, 0, 233, 20, 0, 0, 240, 20, 0, 0, 65, 10, 0, 0, 73, 10, 0, 0, 248, 20, 0, 0, 252, 20, 0, 0, 81, 10, 0, 0, 89, 10, 0, 0, 4, 21, 0, 0, 97, 10, 0, 0, 105, 10, 0, 0, 142, 19, 0, 0, 12, 21, 0, 0, 16, 21, 0, 0, 113, 10, 0, 0, 121, 10, 0, 0, 129, 10, 0, 0, 137, 10, 0, 0, 222, 18, 0, 0, 144, 10, 0, 0, + 230, 18, 0, 0, 230, 18, 0, 0, 24, 21, 0, 0, 152, 10, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, + 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, + 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, + 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, + 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, + 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, + 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, + 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, + 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, + 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, + 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, + 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, + 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, + 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 38, 21, 0, 0, 32, 21, 0, 0, 33, 21, 0, 0, 34, 21, 0, 0, + 35, 21, 0, 0, 36, 21, 0, 0, 37, 21, 0, 0, 160, 10, 0, 0, 167, 10, 0, 0, 170, 10, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, + 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, + 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 178, 10, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 182, 10, 0, 0, 189, 10, 0, 0, 197, 10, 0, 0, 205, 10, 0, 0, 213, 10, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 46, 21, 0, 0, 221, 10, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, + 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 54, 21, 0, 0, 62, 21, 0, 0, 224, 5, 0, 0, 226, 10, 0, 0, 224, 5, 0, 0, 232, 10, 0, 0, 236, 10, 0, 0, 244, 10, 0, 0, 20, 23, 0, 0, 252, 10, 0, 0, 4, 11, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 224, 5, 0, 0, 10, 11, 0, 0, 18, 11, 0, 0, 46, 18, 0, 0, 238, 18, 0, 0, 150, 19, 0, 0, 155, 19, 0, 0, 26, 11, 0, 0, 34, 11, 0, 0, + 42, 11, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, + 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 235, 23, 0, 0, 48, 18, 0, 0, 48, 18, 0, 0, 112, 18, 0, 0, 176, 18, 0, 0, 240, 18, 0, 0, 40, 19, 0, 0, 104, 19, 0, 0, 168, 19, 0, 0, 224, 19, 0, 0, 32, 20, 0, 0, 76, 20, 0, 0, 140, 20, 0, 0, 204, 20, 0, 0, 0, 21, 0, 0, 64, 21, 0, 0, 116, 21, 0, 0, 180, 21, 0, 0, + 228, 21, 0, 0, 36, 22, 0, 0, 100, 22, 0, 0, 116, 22, 0, 0, 168, 22, 0, 0, 224, 22, 0, 0, 32, 23, 0, 0, 96, 23, 0, 0, 160, 23, 0, 0, 212, 23, 0, 0, 0, 24, 0, 0, 64, 24, 0, 0, 120, 24, 0, 0, 184, 24, 0, 0, 248, 24, 0, 0, 96, 10, 0, 0, 160, 10, 0, 0, 224, 10, 0, 0, 32, 11, 0, 0, 96, 11, 0, 0, 139, 11, 0, 0, 203, 11, 0, 0, 237, 11, 0, 0, 13, 12, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 77, 12, 0, 0, 112, 17, 0, 0, 112, 17, 0, 0, 141, 12, 0, 0, 205, 12, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 246, 12, 0, 0, 54, 13, 0, 0, 86, 13, 0, 0, 237, 11, 0, 0, 124, 13, 0, 0, 188, 13, 0, 0, 252, 13, 0, 0, 60, 14, 0, 0, 124, 14, 0, 0, 188, 14, 0, 0, 252, 14, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 60, 15, 0, 0, 160, 1, 0, 0, 116, 15, 0, 0, 180, 15, 0, 0, 160, 1, 0, 0, 191, 15, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, + 160, 1, 0, 0, 245, 15, 0, 0, 21, 16, 0, 0, 85, 16, 0, 0, 160, 1, 0, 0, 160, 1, 0, 0, 149, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, + 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 21, 16, 0, 0, 176, 16, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 240, 16, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, + 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 237, 11, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, + 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 48, 17, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, + 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, + 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, + 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 140, 4, 0, 0, 50, 11, 0, 0, 57, 11, 0, 0, 65, 11, 0, 0, 137, 7, 0, 0, 70, 21, 0, 0, 70, 21, 0, 0, 70, 21, 0, 0, 73, 11, 0, 0, 81, 11, 0, 0, 84, 11, 0, 0, 92, 23, 0, 0, 95, 23, 0, 0, 92, 11, 0, 0, 100, 11, 0, 0, 110, 9, 0, 0, 108, 11, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 116, 11, 0, 0, 78, 21, 0, 0, 124, 11, 0, 0, 132, 11, 0, 0, 86, 21, 0, 0, 140, 11, 0, 0, 148, 11, 0, 0, 152, 11, 0, 0, 160, 11, 0, 0, 94, 21, 0, 0, 168, 11, 0, 0, 137, 7, 0, 0, 54, 18, 0, 0, 60, 18, 0, 0, 246, 18, 0, 0, 102, 21, 0, 0, 176, 11, 0, 0, 184, 11, 0, 0, 188, 11, 0, 0, 194, 11, 0, 0, 110, 21, 0, 0, + 202, 11, 0, 0, 118, 21, 0, 0, 209, 11, 0, 0, 213, 11, 0, 0, 221, 11, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 126, 21, 0, 0, 229, 11, 0, 0, 237, 11, 0, 0, 245, 11, 0, 0, 253, 11, 0, 0, 1, 12, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 9, 12, 0, 0, 12, 12, 0, 0, + 20, 12, 0, 0, 134, 21, 0, 0, 28, 12, 0, 0, 36, 12, 0, 0, 137, 7, 0, 0, 44, 12, 0, 0, 52, 12, 0, 0, 60, 12, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 142, 21, 0, 0, 68, 12, 0, 0, 76, 12, 0, 0, 163, 23, 0, 0, 84, 12, 0, 0, 91, 12, 0, 0, 99, 12, 0, 0, 150, 21, 0, 0, 158, 21, 0, 0, 137, 7, 0, 0, 166, 21, 0, 0, 107, 12, 0, 0, 174, 21, 0, 0, 115, 12, 0, 0, 123, 12, 0, 0, + 131, 12, 0, 0, 139, 12, 0, 0, 147, 12, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 182, 21, 0, 0, 182, 21, 0, 0, 155, 12, 0, 0, 137, 7, 0, 0, 68, 18, 0, 0, 163, 12, 0, 0, 254, 18, 0, 0, 171, 12, 0, 0, 190, 21, 0, 0, 179, 12, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 187, 12, 0, 0, + 198, 21, 0, 0, 195, 12, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 206, 21, 0, 0, 203, 12, 0, 0, 210, 12, 0, 0, 217, 12, 0, 0, 225, 12, 0, 0, 229, 12, 0, 0, 236, 12, 0, 0, 244, 12, 0, 0, 214, 21, 0, 0, 216, 21, 0, 0, 252, 12, 0, 0, 3, 13, 0, 0, 224, 21, 0, 0, 228, 21, 0, 0, 11, 13, 0, 0, 17, 13, 0, 0, 236, 21, 0, 0, 25, 13, 0, 0, 33, 13, 0, 0, 37, 13, 0, 0, 244, 21, 0, 0, + 248, 21, 0, 0, 0, 22, 0, 0, 45, 13, 0, 0, 53, 13, 0, 0, 58, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 66, 13, 0, 0, 74, 13, 0, 0, 8, 22, 0, 0, 82, 13, 0, 0, 90, 13, 0, 0, 96, 13, 0, 0, 104, 13, 0, 0, 112, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 16, 22, 0, 0, 19, 22, 0, 0, 120, 13, 0, 0, 128, 13, 0, 0, 27, 22, 0, 0, 31, 22, 0, 0, + 136, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 39, 22, 0, 0, 144, 13, 0, 0, 152, 13, 0, 0, 137, 7, 0, 0, 47, 22, 0, 0, 51, 22, 0, 0, 160, 13, 0, 0, 168, 13, 0, 0, 59, 22, 0, 0, 176, 13, 0, 0, 184, 13, 0, 0, 137, 7, 0, 0, 192, 13, 0, 0, 200, 13, 0, 0, 208, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 67, 22, 0, 0, 216, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 76, 18, 0, 0, 6, 19, 0, 0, 224, 13, 0, 0, 232, 13, 0, 0, 238, 13, 0, 0, 246, 13, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 254, 13, 0, 0, 2, 14, 0, 0, 10, 14, 0, 0, 75, 22, 0, 0, 79, 22, 0, 0, 18, 14, 0, 0, 87, 22, 0, 0, 93, 22, 0, 0, 26, 14, 0, 0, 101, 22, 0, 0, 34, 14, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 42, 14, 0, 0, 47, 14, 0, 0, 55, 14, 0, 0, 62, 14, 0, 0, 67, 14, 0, 0, 73, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 81, 14, 0, 0, 85, 14, 0, 0, 93, 14, 0, 0, 101, 14, 0, 0, 107, 14, 0, 0, 115, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 123, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 130, 14, 0, 0, 171, 23, 0, 0, 138, 14, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, + 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 146, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 103, 23, 0, 0, 103, 23, 0, 0, 103, 23, 0, 0, + 154, 14, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 109, 22, 0, 0, 162, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 166, 14, 0, 0, 117, 22, 0, 0, 117, 22, 0, 0, 170, 14, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, + 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 127, 22, 0, 0, 125, 22, 0, 0, 135, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 138, 22, 0, 0, + 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 125, 22, 0, 0, 178, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, + 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 151, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 146, 22, 0, 0, 186, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 190, 20, 0, 0, 194, 14, 0, 0, 202, 14, 0, 0, 210, 14, 0, 0, 159, 22, 0, 0, 214, 14, 0, 0, 222, 14, 0, 0, + 227, 14, 0, 0, 167, 22, 0, 0, 171, 22, 0, 0, 235, 14, 0, 0, 243, 14, 0, 0, 251, 14, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 84, 18, 0, 0, 14, 19, 0, 0, 3, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 179, 22, 0, 0, 179, 22, 0, 0, 11, 15, 0, 0, 68, 23, 0, 0, 17, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 25, 15, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 33, 15, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 195, 22, 0, 0, 41, 15, 0, 0, 137, 7, 0, 0, 49, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 53, 15, 0, 0, 203, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 204, 22, 0, 0, 61, 15, 0, 0, 65, 15, 0, 0, 72, 15, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, + 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 212, 22, 0, 0, 76, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 220, 22, 0, 0, + 220, 22, 0, 0, 220, 22, 0, 0, 84, 15, 0, 0, 89, 15, 0, 0, 97, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 51, 5, 0, 0, 105, 15, 0, 0, 112, 15, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 119, 15, 0, 0, 137, 7, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, + 234, 24, 0, 0, 127, 15, 0, 0, 234, 24, 0, 0, 135, 15, 0, 0, 234, 24, 0, 0, 28, 23, 0, 0, 36, 23, 0, 0, 42, 23, 0, 0, 234, 24, 0, 0, 106, 9, 0, 0, 134, 25, 0, 0, 134, 25, 0, 0, 143, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 151, 15, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 159, 15, 0, 0, 167, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 92, 18, 0, 0, 99, 18, 0, 0, 175, 15, 0, 0, 102, 18, 0, 0, 183, 15, 0, 0, 191, 15, 0, 0, 199, 15, 0, 0, 96, 18, 0, 0, 207, 15, 0, 0, 215, 15, 0, 0, 223, 15, 0, 0, 101, 18, 0, 0, 109, 18, 0, 0, 92, 18, 0, 0, 99, 18, 0, 0, 95, 18, 0, 0, 102, 18, 0, 0, 110, 18, 0, 0, 93, 18, 0, 0, 100, 18, 0, 0, 96, 18, 0, 0, 230, 15, 0, 0, 118, 18, 0, 0, 126, 18, 0, 0, + 133, 18, 0, 0, 140, 18, 0, 0, 121, 18, 0, 0, 129, 18, 0, 0, 136, 18, 0, 0, 143, 18, 0, 0, 238, 15, 0, 0, 76, 23, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 142, 25, 0, 0, 50, 23, 0, 0, + 53, 23, 0, 0, 50, 23, 0, 0, 60, 23, 0, 0, 246, 15, 0, 0, 254, 15, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 6, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 14, 16, 0, 0, 22, 16, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 228, 22, 0, 0, 30, 16, 0, 0, 38, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 42, 16, 0, 0, 47, 16, 0, 0, 236, 22, 0, 0, 55, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 63, 16, 0, 0, 244, 22, 0, 0, 244, 22, 0, 0, 244, 22, 0, 0, 244, 22, 0, 0, 244, 22, 0, 0, 244, 22, 0, 0, 71, 16, 0, 0, 137, 7, 0, 0, 151, 18, 0, 0, 159, 18, 0, 0, 79, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 87, 16, 0, 0, 179, 23, 0, 0, 92, 16, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 100, 16, 0, 0, 105, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 113, 16, 0, 0, 121, 16, 0, 0, 129, 16, 0, 0, 137, 16, 0, 0, 145, 16, 0, 0, 153, 16, 0, 0, 137, 7, 0, 0, 160, 16, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 88, 25, 0, 0, 168, 16, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 172, 16, 0, 0, 180, 16, 0, 0, 184, 16, 0, 0, 189, 16, 0, 0, 187, 23, 0, 0, 150, 25, 0, 0, 242, 24, 0, 0, 156, 25, 0, 0, 242, 24, 0, 0, 197, 16, 0, 0, 189, 10, 0, 0, 204, 16, 0, 0, 212, 16, 0, 0, 216, 16, 0, 0, 224, 16, 0, 0, 232, 16, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 88, 25, 0, 0, + 88, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 164, 25, 0, 0, 172, 25, 0, 0, 180, 25, 0, 0, 218, 24, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 188, 25, 0, 0, 195, 25, 0, 0, 203, 25, 0, 0, 211, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, 219, 25, 0, 0, 226, 25, 0, 0, 232, 25, 0, 0, 235, 25, 0, 0, 242, 25, 0, 0, 88, 25, 0, 0, 248, 25, 0, 0, 255, 25, 0, 0, 88, 25, 0, 0, 88, 25, 0, 0, + 6, 26, 0, 0, 10, 26, 0, 0, 88, 25, 0, 0, 18, 26, 0, 0, 240, 16, 0, 0, 248, 16, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 0, 17, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 8, 17, 0, 0, 16, 17, 0, 0, 24, 17, 0, 0, 234, 24, 0, 0, 30, 17, 0, 0, 234, 24, 0, 0, 38, 17, 0, 0, 43, 17, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 26, 26, 0, 0, 34, 26, 0, 0, 88, 25, 0, 0, + 42, 26, 0, 0, 88, 25, 0, 0, 48, 26, 0, 0, 55, 26, 0, 0, 88, 25, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 0, 17, 0, 0, 51, 17, 0, 0, 59, 17, 0, 0, 64, 17, 0, 0, 72, 17, 0, 0, 80, 17, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 234, 24, 0, 0, 88, 17, 0, 0, 234, 24, 0, 0, 106, 9, 0, 0, 96, 17, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 104, 17, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 189, 10, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 112, 17, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 120, 17, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 127, 17, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 135, 17, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 120, 17, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 104, 17, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, + 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 166, 20, 0, 0, 143, 17, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, + 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 189, 10, 0, 0, 104, 17, 0, 0, 151, 17, 0, 0, 219, 23, 0, 0, 219, 23, 0, 0, 219, 23, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 51, 5, 0, 0, 51, 5, 0, 0, 51, 5, 0, 0, + 51, 5, 0, 0, 51, 5, 0, 0, 51, 5, 0, 0, 51, 5, 0, 0, 159, 17, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, + 137, 7, 0, 0, 137, 7, 0, 0, 137, 7, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, + 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 227, 23, 0, 0, 167, 17, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, + 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 187, 22, 0, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 4, 0, 65, 128, 9, 0, 65, 192, 8, 0, 65, 192, 8, 0, 65, 64, 9, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, + 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 101, 128, 10, 0, 91, 128, 1, 0, 91, 192, 0, 0, 91, 0, 3, 0, 94, 64, 2, 0, 91, 128, 2, 0, 91, 0, 3, 0, 91, 192, 0, 0, 92, 0, 0, 0, 88, 128, 0, 0, 91, 0, 3, 0, 96, 64, 2, 0, + 91, 0, 2, 0, 87, 0, 4, 0, 91, 0, 2, 0, 91, 192, 1, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 91, 0, 2, 0, 91, 0, 2, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 91, 128, 1, 0, 91, 0, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, + 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 92, 0, 0, 0, 91, 64, 2, 0, 88, 128, 0, 0, + 95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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 64, 5, 0, 65, 64, 5, 0, + 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 192, 9, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, + 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 65, 64, 5, 0, 101, 0, 1, 0, 91, 0, 0, 0, 94, 128, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 97, 0, 3, 0, 91, 128, 8, 0, 95, 128, 8, 0, 97, 0, 3, 0, 10, 146, 8, 0, 90, 192, 0, 0, 96, 0, 3, 0, 66, 64, 4, 0, 97, 0, 3, 0, 95, 0, 3, 0, 97, 128, 2, 0, 96, 64, 2, 0, 84, 128, 8, 0, 84, 128, 8, 0, + 95, 128, 4, 0, 72, 0, 3, 0, 91, 128, 8, 0, 91, 128, 8, 0, 95, 128, 8, 0, 84, 128, 8, 0, 10, 146, 8, 0, 89, 192, 0, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 91, 0, 0, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, + 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 96, 128, 8, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 96, 128, 8, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 10, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 10, 18, 3, 0, 10, 18, 3, 0, 10, 18, 3, 0, 10, 18, 3, 0, 12, 18, 3, 0, 11, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 11, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 11, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 11, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 10, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 73, 0, 3, 0, 73, 128, 8, 0, 73, 128, 4, 0, 73, 128, 8, 0, 73, 128, 8, 0, 73, 128, 8, 0, + 73, 128, 4, 0, 73, 128, 8, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 128, 8, 0, 73, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 128, 8, 0, 95, 128, 8, 0, 95, 128, 8, 0, 95, 128, 8, 0, 95, 0, 3, 0, 95, 128, 8, 0, 95, 0, 3, 0, 95, 128, 4, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 31, 4, 3, 0, 31, 4, 3, 0, 73, 0, 3, 0, 95, 0, 3, 0, 73, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, + 95, 0, 3, 0, 95, 0, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 0, 1, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 0, 1, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 73, 0, 3, 0, 159, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 137, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 91, 0, 2, 0, 140, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 159, 11, 3, 0, 95, 0, 3, 0, 140, 11, 3, 0, + 91, 0, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, + 140, 11, 3, 0, 140, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, + 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 160, 11, 3, 0, + 140, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, + 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, + 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, + 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, + 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 161, 7, 3, 0, 144, 71, 5, 0, + 144, 71, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 71, 5, 0, 143, 71, 5, 0, 143, 71, 5, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, + 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, + 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, + 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, + 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 3, 0, 0, 0, + 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0, 12, 2, 3, 0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, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 80, 77, 5, 0, 87, 77, 4, 0, 80, 77, 5, 0, 91, 13, 3, 0, 80, 77, 5, 0, + 80, 77, 5, 0, 91, 13, 3, 0, 80, 77, 5, 0, 80, 77, 5, 0, 91, 141, 1, 0, 80, 77, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, + 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 91, 13, 3, 0, + 91, 13, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 130, 1, 3, 0, 130, 1, 3, 0, 130, 1, 3, 0, 130, 1, 3, 0, 130, 1, 3, 0, 66, 0, 3, 0, 160, 1, 3, 0, 160, 1, 3, 0, 160, 1, 3, 0, 155, 129, 2, 0, 155, 129, 2, 0, 158, 129, 2, 0, 91, 0, 2, 0, + 155, 1, 2, 0, 161, 1, 3, 0, 161, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 91, 128, 1, 0, 130, 65, 5, 0, 155, 129, 1, 0, 155, 129, 1, 0, 91, 128, 1, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 73, 0, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, + 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 155, 129, 2, 0, 155, 193, 2, 0, 155, 193, 2, 0, 155, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 144, 64, 5, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 155, 129, 1, 0, 138, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, + 144, 65, 5, 0, 66, 0, 3, 0, 161, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 137, 1, 3, 0, 137, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 161, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 138, 1, 3, 0, 138, 1, 3, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, + 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 146, 193, 2, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 138, 1, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, 27, 34, 3, 0, + 3, 0, 0, 0, 2, 34, 3, 0, 10, 34, 3, 0, 16, 98, 5, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, + 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, + 16, 98, 5, 0, 16, 98, 5, 0, 16, 98, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, + 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 202, 36, 3, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, + 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 208, 100, 5, 0, 202, 36, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, + 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, 18, 217, 2, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, + 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 10, 25, 3, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 16, 89, 5, 0, 9, 25, 3, 0, 9, 25, 3, 0, 33, 25, 3, 0, + 27, 25, 3, 0, 27, 25, 2, 0, 27, 153, 1, 0, 9, 25, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 89, 5, 0, 30, 89, 2, 0, 30, 89, 2, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 73, 30, 3, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 73, 30, 3, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 91, 30, 3, 0, 3, 0, 0, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, + 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 138, 20, 3, 0, 144, 84, 5, 0, 144, 84, 5, 0, 144, 84, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 20, 3, 0, 3, 0, 0, 0, 10, 34, 3, 0, 10, 34, 3, 0, + 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 10, 34, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 159, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 130, 1, 3, 0, 130, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, + 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 138, 3, 3, 0, 144, 67, 5, 0, 142, 67, 5, 0, 142, 67, 5, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, + 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 138, 3, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 67, 5, 0, 138, 3, 3, 0, 142, 67, 5, 0, 142, 67, 5, 0, 142, 67, 5, 0, 144, 67, 5, 0, 144, 67, 5, 0, 144, 67, 5, 0, 144, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 67, 5, 0, 142, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 67, 5, 0, 142, 67, 5, 0, 144, 67, 5, 0, 138, 3, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, 3, 0, 0, 0, 138, 3, 3, 0, 138, 3, 3, 0, 138, 3, 3, 0, 144, 67, 5, 0, 144, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 146, 195, 2, 0, 146, 195, 2, 0, + 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 146, 195, 2, 0, 138, 3, 3, 0, 138, 3, 3, 0, 158, 131, 2, 0, 158, 131, 2, 0, 148, 3, 3, 0, 148, 3, 3, 0, 148, 3, 3, 0, 148, 3, 3, 0, 148, 3, 3, 0, 148, 131, 2, 0, 161, 3, 3, 0, 158, 67, 2, 0, 138, 3, 3, 0, 155, 3, 3, 0, 144, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 16, 76, 5, 0, 16, 76, 5, 0, 14, 76, 5, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, + 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 16, 76, 5, 0, 3, 0, 0, 0, 14, 76, 5, 0, 14, 76, 5, 0, 14, 76, 5, 0, 16, 76, 5, 0, 16, 76, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 76, 5, 0, 16, 76, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 76, 5, 0, 16, 76, 5, 0, 16, 76, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 76, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 3, 0, 0, 0, 10, 12, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, + 18, 204, 2, 0, 18, 204, 2, 0, 18, 204, 2, 0, 16, 76, 5, 0, 16, 76, 5, 0, 10, 12, 3, 0, 10, 12, 3, 0, 10, 12, 3, 0, 16, 76, 5, 0, 27, 12, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 208, 75, 5, 0, 208, 75, 5, 0, 206, 75, 5, 0, 3, 0, 0, 0, 202, 11, 3, 0, + 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, + 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 202, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 208, 75, 5, 0, 202, 11, 3, 0, 206, 75, 5, 0, 206, 75, 5, 0, + 206, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 3, 0, 0, 0, 208, 75, 5, 0, 208, 75, 5, 0, 206, 75, 5, 0, 3, 0, 0, 0, 206, 75, 5, 0, 206, 75, 5, 0, 208, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 11, 3, 0, 202, 11, 3, 0, 208, 75, 5, 0, 208, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 210, 203, 2, 0, 219, 11, 3, 0, 222, 75, 2, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 11, 3, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 208, 75, 5, 0, 3, 0, 0, 0, 80, 90, 5, 0, 78, 90, 5, 0, 78, 90, 5, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, + 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, + 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 90, 5, 0, 74, 26, 3, 0, 78, 90, 5, 0, 80, 90, 5, 0, 78, 90, 5, 0, 80, 90, 5, 0, 80, 90, 5, 0, 80, 90, 5, 0, 80, 90, 5, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 78, 90, 5, 0, 78, 90, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 90, 5, 0, 78, 90, 5, 0, 80, 90, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 90, 5, 0, 80, 90, 5, 0, 78, 90, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, + 3, 0, 0, 0, 74, 26, 3, 0, 74, 26, 3, 0, 74, 26, 3, 0, 80, 90, 5, 0, 80, 90, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 82, 218, 2, 0, 97, 26, 3, 0, 74, 26, 3, 0, 84, 26, 3, 0, 84, 26, 3, 0, 84, 26, 3, 0, 84, 26, 3, 0, 84, 26, 3, 0, + 84, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 99, 5, 0, 74, 35, 3, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, + 74, 35, 3, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 74, 35, 3, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, + 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 99, 5, 0, 78, 99, 5, 0, 80, 99, 5, 0, 78, 99, 5, 0, + 78, 99, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 99, 5, 0, 78, 99, 5, 0, 78, 99, 5, 0, 3, 0, 0, 0, 78, 99, 5, 0, 78, 99, 5, 0, 78, 99, 5, 0, 80, 99, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 99, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 82, 227, 2, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, + 97, 35, 3, 0, 94, 99, 2, 0, 97, 35, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 100, 5, 0, 14, 100, 5, 0, 14, 100, 5, 0, 14, 100, 5, 0, 16, 100, 5, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 3, 0, 0, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, + 3, 0, 0, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 3, 0, 0, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, + 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 100, 5, 0, 10, 36, 3, 0, 16, 100, 5, 0, 16, 100, 5, 0, 16, 100, 5, 0, 14, 100, 5, 0, 14, 100, 5, 0, 14, 100, 5, 0, 14, 100, 5, 0, 3, 0, 0, 0, 16, 100, 5, 0, 16, 100, 5, 0, 16, 100, 5, 0, 3, 0, 0, 0, 16, 100, 5, 0, + 16, 100, 5, 0, 16, 100, 5, 0, 16, 100, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 100, 5, 0, 16, 100, 5, 0, 3, 0, 0, 0, 10, 36, 3, 0, 10, 36, 3, 0, 10, 36, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 36, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 36, 3, 0, 10, 36, 3, 0, 16, 100, 5, 0, 16, 100, 5, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 18, 228, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 164, 4, 0, 20, 36, 3, 0, 20, 36, 3, 0, 20, 36, 3, 0, 20, 36, 3, 0, 20, 36, 3, 0, + 20, 36, 3, 0, 20, 36, 3, 0, 33, 36, 3, 0, 10, 17, 3, 0, 16, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 27, 145, 4, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, + 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, + 10, 17, 3, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 81, 5, 0, 10, 17, 3, 0, 14, 81, 5, 0, 16, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 3, 0, 0, 0, 16, 81, 5, 0, 14, 81, 5, 0, 14, 81, 5, 0, 3, 0, 0, 0, 14, 81, 5, 0, 14, 81, 5, 0, 16, 81, 5, 0, 16, 81, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 14, 81, 5, 0, 14, 81, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 16, 81, 5, 0, 16, 81, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, + 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, 18, 209, 2, 0, 3, 0, 0, 0, 10, 17, 3, 0, 10, 17, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 86, 5, 0, 80, 86, 5, 0, + 78, 86, 5, 0, 78, 86, 5, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 3, 0, 0, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 3, 0, 0, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, + 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 78, 86, 5, 0, 80, 86, 5, 0, 80, 86, 5, 0, 80, 86, 5, 0, 80, 86, 5, 0, 3, 0, 0, 0, 78, 86, 5, 0, 78, 86, 5, 0, 78, 86, 5, 0, 3, 0, 0, 0, 78, 86, 5, 0, 78, 86, 5, 0, 78, 86, 5, 0, 80, 86, 5, 0, 74, 22, 3, 0, 97, 22, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 78, 86, 5, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 80, 86, 5, 0, 80, 86, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, + 82, 214, 2, 0, 82, 214, 2, 0, 82, 214, 2, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 84, 22, 3, 0, 97, 150, 2, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 3, 0, 0, 0, 80, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 3, 0, 0, 0, 74, 32, 3, 0, + 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, + 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 3, 0, 0, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, + 3, 0, 0, 0, 74, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 74, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 96, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 80, 96, 5, 0, 80, 96, 5, 0, 80, 96, 5, 0, + 3, 0, 0, 0, 80, 96, 5, 0, 3, 0, 0, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 78, 96, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, 82, 224, 2, 0, + 82, 224, 2, 0, 82, 224, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 96, 5, 0, 78, 96, 5, 0, 91, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, + 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, + 10, 37, 10, 0, 16, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 94, 64, 2, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 10, 37, 10, 0, 9, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, + 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 16, 37, 10, 0, 27, 37, 3, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 18, 229, 2, 0, 27, 101, 4, 0, 27, 101, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 3, 0, 0, 0, 202, 17, 10, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, + 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 3, 0, 0, 0, 202, 17, 10, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 208, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 208, 17, 10, 0, + 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 202, 17, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 3, 0, 0, 0, 201, 17, 10, 0, 3, 0, 0, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, 208, 17, 10, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 210, 209, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 202, 17, 10, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, + 74, 37, 3, 0, 3, 0, 0, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, + 74, 37, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 78, 101, 4, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, + 91, 101, 4, 0, 80, 101, 5, 0, 80, 101, 5, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 74, 37, 3, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 3, 0, 0, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, + 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, 80, 101, 5, 0, + 80, 101, 5, 0, 80, 101, 5, 0, 3, 0, 0, 0, 97, 101, 4, 0, 97, 101, 4, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 80, 101, 5, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 3, 0, 0, 0, 97, 37, 3, 0, 97, 37, 3, 0, 91, 165, 4, 0, 91, 165, 4, 0, 91, 101, 4, 0, 91, 165, 4, 0, + 91, 37, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 91, 37, 1, 0, 91, 37, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 3, 0, 0, 0, 12, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 12, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, + 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 208, 73, 5, 0, 208, 73, 5, 0, 208, 73, 5, 0, 219, 9, 3, 0, 219, 73, 4, 0, 219, 9, 3, 0, 219, 9, 3, 0, 219, 9, 3, 0, 219, 9, 3, 0, 219, 9, 3, 0, 219, 9, 3, 0, 219, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, + 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 212, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 225, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, + 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 165, 89, 4, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, 138, 25, 3, 0, + 138, 25, 3, 0, 138, 25, 3, 0, 156, 25, 0, 0, 152, 89, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 19, 30, 3, 0, 19, 30, 3, 0, 19, 30, 3, 0, 10, 30, 3, 0, + 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, + 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 138, 36, 3, 0, 144, 100, 5, 0, 144, 100, 5, 0, 144, 100, 5, 0, 142, 100, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 36, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, + 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 202, 12, 3, 0, 208, 76, 5, 0, 208, 76, 5, 0, 206, 76, 5, 0, 91, 64, 4, 0, 91, 64, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 10, 5, 3, 0, 16, 69, 5, 0, 16, 69, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 74, 34, 3, 0, 3, 0, 0, 0, 74, 34, 3, 0, + 74, 34, 3, 0, 74, 34, 3, 0, 3, 0, 0, 0, 80, 98, 5, 0, 80, 98, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 16, 10, 0, 78, 16, 10, 0, 78, 16, 10, 0, 78, 16, 10, 0, 78, 16, 10, 0, 78, 16, 10, 0, 80, 16, 10, 0, 78, 16, 10, 0, + 78, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 91, 80, 4, 0, 91, 80, 4, 0, 91, 80, 1, 0, 73, 16, 10, 0, 91, 80, 4, 0, 91, 16, 3, 0, 91, 80, 4, 0, 94, 80, 2, 0, 74, 16, 10, 0, 80, 16, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 208, 2, 0, + 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 82, 208, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, 84, 16, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 22, 3, 0, 219, 22, 3, 0, 91, 128, 1, 0, 91, 128, 1, 0, 219, 86, 4, 0, 91, 64, 4, 0, 215, 150, 4, 0, 219, 22, 3, 0, 219, 150, 1, 0, 219, 150, 1, 0, 219, 22, 3, 0, 208, 86, 5, 0, 208, 86, 5, 0, 208, 86, 5, 0, 194, 22, 1, 0, 208, 86, 5, 0, 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, + 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, 210, 214, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 208, 86, 5, 0, 202, 22, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, + 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, + 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 138, 18, 3, 0, 3, 0, 0, 0, + 144, 82, 5, 0, 144, 82, 5, 0, 144, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 144, 82, 5, 0, 144, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 82, 5, 0, 142, 82, 5, 0, 144, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, 142, 82, 5, 0, + 144, 82, 5, 0, 144, 82, 5, 0, 144, 82, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 161, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 146, 1, 0, 155, 146, 1, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 146, 210, 2, 0, 202, 34, 10, 0, 202, 34, 10, 0, + 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 202, 34, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 227, 2, 0, + 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 18, 227, 2, 0, 20, 35, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 33, 35, 10, 0, 33, 35, 10, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, + 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 202, 4, 3, 0, 208, 68, 5, 0, 208, 68, 5, 0, 206, 68, 5, 0, 206, 68, 5, 0, 208, 68, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 4, 3, 0, 219, 4, 3, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, + 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 142, 17, 10, 0, 144, 17, 10, 0, 142, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, + 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 3, 0, 0, 0, 144, 17, 10, 0, 142, 17, 10, 0, 144, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 142, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, + 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 144, 17, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 81, 5, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 146, 209, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, + 137, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 155, 17, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 143, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 66, 5, 0, 142, 66, 5, 0, 144, 66, 5, 0, 142, 66, 5, 0, 142, 66, 5, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 146, 194, 2, 0, 146, 194, 2, 0, + 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 146, 194, 2, 0, 155, 66, 4, 0, 155, 66, 4, 0, 155, 2, 3, 0, 155, 66, 4, 0, 155, 66, 4, 0, 155, 66, 4, 0, 155, 66, 4, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, + 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 161, 2, 3, 0, 155, 66, 4, 0, 155, 66, 4, 0, 3, 0, 0, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, + 74, 3, 3, 0, 74, 3, 3, 0, 80, 67, 5, 0, 78, 67, 5, 0, 80, 67, 5, 0, 80, 67, 5, 0, 78, 67, 5, 0, 78, 67, 5, 0, 78, 67, 5, 0, 80, 67, 5, 0, 78, 67, 5, 0, 80, 67, 5, 0, 80, 67, 5, 0, 80, 67, 5, 0, 78, 67, 5, 0, 78, 67, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 91, 3, 3, 0, + 91, 3, 3, 0, 91, 3, 3, 0, 91, 3, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 80, 82, 5, 0, 78, 82, 5, 0, 78, 82, 5, 0, + 80, 82, 5, 0, 80, 82, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 91, 82, 4, 0, 91, 82, 4, 0, 91, 82, 4, 0, 91, 82, 4, 0, 91, 82, 4, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 82, 210, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 18, 3, 0, 74, 18, 3, 0, + 74, 18, 3, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 210, 217, 2, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, 136, 7, 3, 0, + 136, 7, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, + 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 155, 33, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 91, 0, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 78, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 144, 64, 5, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 144, 64, 5, 0, 74, 0, 3, 0, 74, 0, 3, 0, 78, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 74, 0, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, 3, 0, 0, 0, 140, 11, 3, 0, + 3, 0, 0, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, + 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 139, 11, 3, 0, 159, 11, 3, 0, 136, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, + 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 139, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 3, 0, 0, 0, 159, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 159, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 3, 0, 0, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, + 140, 11, 3, 0, 139, 11, 3, 0, 159, 139, 4, 0, 159, 11, 3, 0, 3, 0, 0, 0, 66, 128, 5, 0, 66, 0, 3, 0, 66, 0, 3, 0, 66, 0, 3, 0, 66, 0, 3, 0, 3, 0, 0, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 84, 0, 3, 0, 9, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 84, 128, 8, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 9, 146, 8, 0, 84, 0, 3, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 92, 0, 0, 0, 88, 64, 0, 0, 3, 0, 0, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 94, 128, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, + 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 3, 64, 2, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 143, 64, 5, 0, 143, 64, 5, 0, + 143, 64, 5, 0, 143, 64, 5, 0, 144, 64, 5, 0, 143, 64, 5, 0, 143, 64, 5, 0, 143, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 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, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 200, 6, 3, 0, 225, 6, 3, 0, 225, 6, 3, 0, 225, 6, 3, 0, 225, 6, 3, 0, 225, 6, 3, 0, 225, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 208, 70, 5, 0, 208, 70, 5, 0, 208, 70, 5, 0, 204, 6, 3, 0, + 200, 6, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 134, 1, 0, 219, 70, 4, 0, 219, 70, 4, 0, 219, 70, 4, 0, 212, 6, 3, 0, 219, 134, 1, 0, 219, 70, 4, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 3, 0, 0, 0, 8, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 8, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 73, 36, 3, 0, 91, 100, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 100, 5, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 87, 64, 4, 0, 91, 64, 4, 0, 92, 0, 0, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 91, 0, 3, 0, 91, 128, 1, 0, 91, 128, 1, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 87, 64, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, + 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 3, 0, 0, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, + 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, + 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, + 138, 141, 3, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 13, 9, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, 144, 64, 5, 0, 95, 64, 1, 0, 95, 64, 1, 0, 137, 77, 1, 0, 137, 77, 1, 0, 138, 141, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, + 10, 132, 3, 0, 10, 132, 3, 0, 3, 0, 0, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 97, 128, 3, 0, 97, 128, 3, 0, 84, 128, 3, 0, + 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, + 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 3, 0, 0, 0, 74, 168, 3, 0, 74, 168, 3, 0, + 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, + 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, + 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 146, 230, 2, 0, 138, 38, 3, 0, 138, 38, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 211, 2, 3, 0, 211, 2, 3, 0, 211, 2, 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3, 0, 202, 33, 3, 0, 206, 97, 5, 0, 206, 97, 5, 0, 208, 97, 5, 0, 208, 97, 5, 0, 206, 97, 5, 0, 225, 33, 3, 0, 225, 33, 3, 0, 225, 33, 3, 0, 225, 33, 3, 0, 208, 97, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 94, 128, 2, 0, 97, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, + 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 27, 156, 4, 0, 27, 156, 4, 0, 27, 156, 1, 0, 27, 156, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, + 208, 94, 5, 0, 208, 94, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 94, 4, 0, 219, 94, 4, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 210, 222, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 144, 93, 5, 0, 142, 93, 5, 0, 142, 93, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 29, 3, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, + 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 79, 5, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 79, 4, 0, + 91, 79, 4, 0, 91, 79, 4, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 91, 15, 3, 0, 3, 0, 0, 0, 73, 0, 3, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 82, 207, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 91, 15, 3, 0, 91, 15, 3, 0, 202, 23, 10, 0, + 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 208, 23, 10, 0, 201, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, + 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 3, 0, 0, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 16, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, 14, 70, 5, 0, 14, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, + 14, 70, 5, 0, 14, 70, 5, 0, 16, 70, 5, 0, 16, 70, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 16, 70, 5, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, + 16, 70, 5, 0, 14, 70, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 18, 198, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 6, 3, 0, 27, 70, 4, 0, 27, 70, 4, 0, 27, 70, 4, 0, 202, 35, 10, 0, 208, 35, 10, 0, 202, 35, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 35, 10, 0, 202, 35, 10, 0, 201, 35, 10, 0, + 219, 35, 10, 0, 219, 35, 10, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 78, 87, 5, 0, 80, 87, 5, 0, 80, 87, 5, 0, 78, 87, 5, 0, 78, 87, 5, 0, 91, 87, 4, 0, 91, 87, 4, 0, 74, 23, 3, 0, 73, 23, 3, 0, 73, 23, 3, 0, 78, 87, 5, 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0, 3, 0, 0, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, + 72, 6, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 78, 87, 5, 0, 78, 87, 5, 0, 80, 87, 5, 0, 78, 87, 5, 0, 78, 87, 5, 0, 80, 87, 5, 0, 78, 87, 5, 0, 78, 87, 5, 0, 91, 87, 4, 0, 78, 87, 5, 0, 80, 87, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, 82, 215, 2, 0, + 82, 215, 2, 0, 82, 215, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 140, 6, 0, + 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, + 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, + 74, 204, 6, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 8, 2, 3, 0, 8, 2, 3, 0, 8, 2, 3, 0, 8, 2, 3, 0, 8, 2, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 77, 3, 0, 80, 77, 5, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 96, 13, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, + 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 3, 0, 0, 0, 74, 77, 3, 0, 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, + 3, 0, 0, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 74, 77, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 161, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 158, 129, 2, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 91, 0, 2, 0, 91, 64, 0, 0, 91, 64, 0, 0, 91, 0, 2, 0, 91, 0, 2, 0, 91, 128, 1, 0, 91, 128, 1, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 192, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 128, 3, 0, 91, 128, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 128, 3, 0, 91, 128, 3, 0, 91, 128, 3, 0, 91, 128, 3, 0, 86, 128, 3, 0, 86, 128, 3, 0, 86, 128, 3, 0, 91, 64, 0, 0, 91, 128, 3, 0, 91, 64, 0, 0, 3, 0, 0, 0, 91, 64, 1, 0, 91, 64, 1, 0, 91, 128, 1, 0, 91, 128, 1, 0, + 87, 128, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 128, 3, 0, 91, 128, 3, 0, 91, 128, 3, 0, 96, 128, 3, 0, 87, 128, 3, 0, 96, 128, 3, 0, 96, 128, 3, 0, 96, 128, 3, 0, 3, 0, 0, 0, 91, 128, 3, 0, 94, 64, 2, 0, 91, 128, 2, 0, 91, 128, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 66, 128, 5, 0, 3, 0, 0, 0, 91, 128, 1, 0, 91, 128, 3, 0, 91, 128, 3, 0, 94, 64, 2, 0, 91, 128, 2, 0, 91, 128, 3, 0, 91, 128, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 128, 3, 0, + 96, 128, 3, 0, 91, 64, 0, 0, 87, 128, 3, 0, 91, 64, 0, 0, 91, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 82, 128, 3, 0, 91, 64, 1, 0, 91, 64, 1, 0, 96, 128, 3, 0, 96, 128, 3, 0, 96, 128, 3, 0, 91, 128, 1, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, + 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, + 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, + 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 94, 128, 2, 0, 94, 64, 2, 0, 96, 128, 3, 0, 95, 128, 3, 0, 97, 128, 3, 0, 94, 64, 2, 0, 94, 64, 2, 0, 3, 0, 0, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 97, 0, 8, 0, 97, 128, 8, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 0, 3, 0, 84, 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0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 144, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, + 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 138, 19, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5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, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 19, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 10, 11, 3, 0, 19, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 202, 27, 3, 0, 208, 91, 5, 0, 208, 91, 5, 0, 208, 91, 5, 0, + 208, 91, 5, 0, 208, 91, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, + 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 74, 38, 3, 0, 3, 0, 0, 0, 91, 102, 4, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, + 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 155, 103, 4, 0, 147, 39, 3, 0, 147, 39, 3, 0, 147, 39, 3, 0, 147, 39, 3, 0, 147, 39, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, + 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, 202, 26, 3, 0, + 202, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 210, 218, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, + 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 140, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, + 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 136, 26, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, + 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 1, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, + 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 3, 0, 0, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 204, 38, 3, 0, 3, 0, 0, 0, 204, 38, 3, 0, 204, 38, 3, 0, 3, 0, 0, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, + 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 3, 0, 0, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 3, 0, 0, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, 200, 38, 3, 0, + 200, 38, 3, 0, 200, 38, 3, 0, 3, 0, 0, 0, 200, 38, 3, 0, 200, 38, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, + 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, + 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, + 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 9, 18, 3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 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 7, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 7, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, + 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 202, 1, 3, 0, 3, 0, 0, 0, 219, 65, 4, 0, 212, 1, 3, 0, 212, 1, 3, 0, 212, 1, 3, 0, 212, 1, 3, 0, 212, 1, 3, 0, + 212, 1, 3, 0, 212, 1, 3, 0, 212, 1, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, + 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 138, 24, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, 148, 24, 3, 0, + 148, 24, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, + 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 10, 13, 3, 0, 3, 0, 0, 0, 10, 13, 3, 0, 10, 13, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 20, 13, 3, 0, 20, 13, 3, 0, 20, 13, 3, 0, 20, 13, 3, 0, 20, 13, 3, 0, 202, 28, 3, 0, + 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 202, 28, 3, 0, 212, 28, 3, 0, 212, 28, 3, 0, 212, 28, 3, 0, 212, 28, 3, 0, + 212, 28, 3, 0, 212, 28, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 92, 4, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, + 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 202, 19, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 19, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, + 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 212, 21, 3, 0, 212, 21, 3, 0, 202, 21, 3, 0, 202, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, + 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, + 212, 21, 3, 0, 212, 21, 3, 0, 10, 16, 3, 0, 16, 80, 5, 0, 16, 80, 5, 0, 16, 80, 5, 0, 3, 0, 0, 0, 16, 80, 5, 0, 16, 80, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 80, 5, 0, 16, 80, 5, 0, 16, 80, 5, 0, 16, 80, 5, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 3, 0, 0, 0, 10, 16, 3, 0, 10, 16, 3, 0, + 10, 16, 3, 0, 3, 0, 0, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, 10, 16, 3, 0, + 10, 16, 3, 0, 10, 16, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 80, 5, 0, 16, 80, 5, 0, 16, 80, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 80, 5, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 20, 16, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 80, 4, 0, 27, 16, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 208, 84, 5, 0, + 208, 84, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 212, 20, 3, 0, 212, 20, 3, 0, 212, 20, 3, 0, 212, 20, 3, 0, 212, 20, 3, 0, 219, 84, 4, 0, 219, 84, 4, 0, 219, 84, 4, 0, 219, 84, 4, 0, 219, 84, 4, 0, 219, 84, 4, 0, 219, 212, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 91, 66, 4, 0, 91, 66, 4, 0, 91, 66, 4, 0, 91, 66, 4, 0, 91, 66, 4, 0, 91, 66, 4, 0, 91, 66, 4, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, + 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 74, 29, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 84, 29, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, + 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 74, 28, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 84, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, + 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 138, 28, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 28, 3, 0, 155, 28, 3, 0, 155, 28, 3, 0, +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204, 14, 3, 0, 204, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 212, 14, 3, 0, 212, 14, 3, 0, 212, 14, 3, 0, 212, 14, 3, 0, 212, 14, 3, 0, 212, 14, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 208, 93, 5, 0, 208, 93, 5, 0, 208, 93, 5, 0, 208, 93, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 210, 221, 2, 0, 210, 221, 2, 0, + 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 210, 221, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, + 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 148, 1, 3, 0, 3, 0, 0, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, + 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 3, 0, 0, 0, 16, 104, 5, 0, 16, 104, 5, 0, 23, 104, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 40, 3, 0, 10, 40, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 202, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, + 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 138, 32, 3, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 144, 96, 5, 0, 148, 32, 3, 0, 148, 32, 3, 0, + 148, 32, 3, 0, 148, 32, 3, 0, 155, 32, 3, 0, 155, 32, 3, 0, 155, 32, 3, 0, 155, 32, 3, 0, 155, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 10, 27, 3, 0, 16, 91, 5, 0, 16, 91, 5, 0, 16, 91, 5, 0, 16, 91, 5, 0, 27, 27, 3, 0, 27, 27, 3, 0, 27, 27, 3, 0, + 27, 27, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3,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 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 91, 68, 4, 0, 91, 68, 4, 0, 91, 4, 3, 0, 91, 4, 3, 0, 91, 4, 3, 0, 91, 4, 3, 0, 91, 4, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, + 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 84, 4, 3, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 82, 196, 2, 0, 80, 68, 5, 0, 74, 4, 3, 0, 74, 4, 3, 0, 80, 68, 5, 0, 80, 68, 5, 0, 74, 4, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 68, 5, 0, 91, 81, 4, 0, 91, 81, 4, 0, 80, 81, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 66, 17, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 10, 33, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 225, 2, 0, + 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 18, 225, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, + 80, 69, 5, 0, 80, 69, 5, 0, 78, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 3, 0, 0, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 82, 197, 2, 0, 91, 69, 4, 0, 91, 69, 4, 0, 91, 69, 4, 0, + 91, 69, 4, 0, 74, 5, 3, 0, 78, 69, 5, 0, 78, 69, 5, 0, 74, 5, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, + 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 10, 20, 3, 0, 16, 84, 5, 0, 27, 20, 3, 0, 27, 148, 4, 0, 10, 20, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, + 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 84, 32, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 3, 0, 0, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, + 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 138, 16, 3, 0, 142, 80, 5, 0, 142, 80, 5, 0, 142, 80, 5, 0, 144, 80, 5, 0, 144, 80, 5, 0, 144, 80, 5, 0, 142, 80, 5, 0, 142, 80, 5, 0, 144, 80, 5, 0, 142, 80, 5, 0, 144, 80, 5, 0, 144, 80, 5, 0, 155, 80, 4, 0, 155, 80, 4, 0, 155, 16, 3, 0, 155, 80, 4, 0, + 155, 80, 4, 0, 155, 16, 3, 0, 144, 80, 5, 0, 3, 0, 0, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 3, 0, 0, 0, 138, 23, 3, 0, 3, 0, 0, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 3, 0, 0, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, + 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 3, 0, 0, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 138, 23, 3, 0, 155, 87, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 14, 96, 5, 0, 14, 96, 5, 0, 14, 96, 5, 0, 16, 96, 5, 0, 16, 96, 5, 0, 16, 96, 5, 0, 16, 96, 5, 0, + 16, 96, 5, 0, 16, 96, 5, 0, 16, 96, 5, 0, 16, 96, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 18, 224, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 80, 75, 5, 0, 80, 75, 5, 0, 78, 75, 5, 0, 78, 75, 5, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, + 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, + 3, 0, 0, 0, 144, 64, 5, 0, 80, 75, 5, 0, 74, 11, 3, 0, 78, 75, 5, 0, 78, 75, 5, 0, 80, 75, 5, 0, 78, 75, 5, 0, 78, 75, 5, 0, 78, 75, 5, 0, 78, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 75, 5, 0, 78, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 75, 5, 0, 78, 75, 5, 0, 78, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 11, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 78, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 74, 11, 3, 0, 78, 75, 5, 0, 78, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, + 80, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 80, 75, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 206, 88, 5, 0, 206, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, + 206, 88, 5, 0, 208, 88, 5, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 219, 88, 4, 0, 219, 88, 4, 0, 219, 88, 4, 0, 219, 88, 4, 0, 219, 24, 3, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 210, 216, 2, 0, 219, 88, 4, 0, 219, 88, 4, 0, 3, 0, 0, 0, 219, 24, 3, 0, + 208, 88, 5, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 101, 5, 0, 142, 101, 5, 0, 144, 101, 5, 0, 144, 101, 5, 0, 138, 37, 3, 0, 138, 37, 3, 0, 155, 37, 3, 0, 138, 37, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 146, 229, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, + 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 206, 95, 5, 0, 206, 95, 5, 0, 206, 95, 5, 0, 208, 95, 5, 0, 208, 95, 5, 0, 208, 95, 5, 0, 208, 95, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 206, 95, 5, 0, 206, 95, 5, 0, 206, 95, 5, 0, 206, 95, 5, 0, 208, 95, 5, 0, 208, 95, 5, 0, 206, 95, 5, 0, 208, 95, 5, 0, 208, 95, 5, 0, 219, 159, 4, 0, + 219, 95, 4, 0, 219, 95, 4, 0, 219, 159, 1, 0, 219, 159, 1, 0, 219, 31, 3, 0, 219, 31, 3, 0, 219, 31, 3, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 219, 95, 4, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, + 202, 31, 3, 0, 208, 95, 5, 0, 208, 95, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 86, 5, 0, 155, 86, 4, 0, 155, 86, 4, 0, 155, 22, 3, 0, 138, 22, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, + 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, 146, 214, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, 219, 150, 4, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, + 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 144, 98, 5, 0, 142, 98, 5, 0, 144, 98, 5, 0, 142, 98, 5, 0, 142, 98, 5, 0, 144, 98, 5, 0, 144, 98, 5, 0, 144, 98, 5, 0, 144, 98, 5, 0, 144, 98, 5, 0, 144, 98, 5, 0, 142, 98, 5, 0, 144, 98, 5, 0, 138, 34, 3, 0, 155, 34, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 146, 226, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, + 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, 78, 1, 10, 0, 78, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, 78, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, 80, 1, 10, 0, + 80, 1, 10, 0, 80, 1, 10, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 82, 193, 2, 0, 84, 1, 10, 0, 84, 1, 10, 0, 91, 65, 4, 0, 91, 65, 4, 0, 91, 65, 4, 0, 97, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, 74, 1, 10, 0, + 74, 1, 10,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, 18, 200, 2, 0, 18, 200, 2, 0, 18, 200, 2, 0, 18, 200, 2, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, + 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 10, 24, 3, 0, 14, 88, 5, 0, 14, 88, 5, 0, 14, 88, 5, 0, 16, 88, 5, 0, 16, 88, 5, 0, 16, 88, 5, 0, 16, 88, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 88, 5, 0, 16, 88, 5, 0, + 14, 88, 5, 0, 14, 88, 5, 0, 14, 88, 5, 0, 14, 88, 5, 0, 16, 88, 5, 0, 10, 24, 3, 0, 27, 152, 4, 0, 10, 24, 3, 0, 14, 88, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 155, 40, 3, 0, 155, 104, 4, 0, 155, 104, 4, 0, 155, 104, 4, 0, 155, 104, 4, 0, 155, 168, 4, 0, 155, 40, 3, 0, 144, 104, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 74, 33, 3, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 78, 97, 5, 0, 78, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 91, 161, 4, 0, 91, 97, 4, 0, 91, 97, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, + 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 3, 0, 0, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, + 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 202, 3, 3, 0, 206, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, + 3, 0, 0, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 208, 67, 5, 0, 206, 67, 5, 0, 208, 67, 5, 0, 202, 3, 3, 0, 219, 67, 4, 0, 219, 67, 4, 0, 219, 67, 4, 0, 219, 67, 4, 0, 219, 67, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 210, 195, 2, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, 212, 3, 3, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 149, 4, 0, 27, 149, 1, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 10, 21, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 3, 0, 0, 0, 14, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 14, 85, 5, 0, 16, 85, 5, 0, + 16, 85, 5, 0, 14, 85, 5, 0, 16, 85, 5, 0, 16, 85, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 3, 0, 0, 0, 202, 10, 3, 0, 202, 10, 3, 0, 3, 0, 0, 0, 202, 10, 3, 0, + 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 202, 10, 3, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, + 208, 74, 5, 0, 208, 74, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 208, 74, 5, 0, 3, 0, 0, 0, 208, 74, 5, 0, 208, 74, 5, 0, 3, 0, 0, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 208, 74, 5, 0, 202, 10, 3, 0, 208, 74, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 210, 202, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 3, 0, 0, 0, + 138, 10, 3, 0, 138, 10, 3, 0, 3, 0, 0, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, 138, 10, 3, 0, + 138, 10, 3, 0, 138, 10, 3, 0, 142, 74, 5, 0, 142, 74, 5, 0, 142, 74, 5, 0, 142, 74, 5, 0, 142, 74, 5, 0, 3, 0, 0, 0, 144, 74, 5, 0, 144, 74, 5, 0, 3, 0, 0, 0, 142, 74, 5, 0, 142, 74, 5, 0, 144, 74, 5, 0, 142, 74, 5, 0, 144, 74, 5, 0, 138, 10, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 146, 202, 2, 0, + 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 146, 202, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74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 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 91, 99, 4, 0, 202, 39, 3, 0, 202, 39, 3, 0, + 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 3, 0, 0, 0, 219, 103, 4, 0, 219, 103, 4, 0, 219, 103, 4, 0, 219, 103, 4, 0, + 219, 103, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3,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13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, + 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, + 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, + 10, 23, 3, 0, 10, 23, 3, 0, 10, 23, 3, 0, 3, 0, 0, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 18, 215, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 27, 87, 4, 0, 27, 87, 4, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, + 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, + 202, 37, 3, 0, 3, 0, 0, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 210, 229, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, + 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 10, 3, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 67, 5, 0, 16, 67, 5, 0, 16, 67, 5, 0, 16, 67, 5, 0, 16, 67, 5, 0, 27, 67, 4, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 9, 14, 3, 0, 9, 14, 3, 0, 9, 14, 3, 0, 9, 14, 3, 0, 27, 78, 4, 0, 33, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, + 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, 18, 206, 2, 0, 3, 0, 0, 0, 20, 14, 3, 0, 20, 14, 3, 0, 20, 14, 3, 0, 20, 14, 3, 0, 20, 14, 3, 0, 20, 14, 3, 0, 20, 14, 3, 0, 3, 0, 0, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, + 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, + 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 84, 21, 3, 0, 91, 85, 4, 0, 91, 85, 4, 0, + 91, 21, 3, 0, 91, 21, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 93, 5, 0, 10, 29, 3, 0, 14, 93, 5, 0, + 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 16, 93, 5, 0, 16, 93, 5, 0, 16, 93, 5, 0, 16, 93, 5, 0, + 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 9, 29, 3, 0, 137, 99, 1, 0, 73, 89, 1, 0, 155, 76, 1, 0, 137, 76, 1, 0, 208, 16, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 142, 76, 5, 0, 142, 76, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, + 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 201, 15, 3, 0, 201, 15, 3, 0, 201, 15, 3, 0, 201, 15, 3, 0, 3, 0, 0, 0, 201, 15, 3, 0, 201, 15, 3, 0, 201, 15, 3, 0, 201, 15, 3, 0, + 201, 15, 3, 0, 201, 15, 3, 0, 201, 15, 3, 0, 3, 0, 0, 0, 201, 15, 3, 0, 201, 15, 3, 0, 3, 0, 0, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 13, 9, 0, 138, 13, 9, 0, 138, 13, 9, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, + 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 8, 3, 0, + 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, + 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 225, 8, 3, 0, 208, 72, 5, 0, 208, 72, 5, 0, + 219, 72, 4, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0,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 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, + 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 96, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, + 76, 0, 3, 0, 72, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, + 33, 31, 3, 0, 16, 95, 5, 0, 33, 31, 3, 0, 33, 31, 3, 0, 27, 95, 4, 0, 27, 95, 4, 0, 27, 95, 4, 0, 27, 95, 4, 0, 27, 31, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 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, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, + 3, 0, 0, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, + 80, 74, 5, 0, 80, 74, 5, 0, 3, 0, 0, 0, 80, 74, 5, 0, 80, 74, 5, 0, 3, 0, 0, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 80, 74, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 80, 78, 5, 0, 80, 78, 5, 0, + 80, 78, 5, 0, 80, 78, 5, 0, 80, 78, 5, 0, 80, 78, 5, 0, 80, 78, 5, 0, 73, 14, 3, 0, 73, 14, 3, 0, 73, 14, 3, 0, 73, 14, 3, 0, 73, 14, 3, 0, 73, 14, 3, 0, 73, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 82, 206, 2, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 14, 3, 0, 97, 14, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, + 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 10, 38, 3, 0, 16, 102, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 80, 103, 5, 0, 80, 103, 5, 0, 80, 103, 5, 0, 80, 103, 5, 0, 82, 231, 2, 0, 82, 231, 2, 0, + 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 82, 231, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 94, 103, 2, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 3, 0, 0, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, + 138, 21, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 148, 21, 3, 0, 144, 85, 5, 0, 144, 85, 5, 0, 144, 85, 5, 0, 144, 85, 5, 0, 144, 85, 5, 0, 144, 85, 5, 0, 144, 85, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 208, 64, 5, 0, 208, 64, 5, 0, 208, 64, 5, 0, 208, 64, 5, 0, 208, 64, 5, 0, 208, 64, 5, 0, 208, 64, 5, 0, 201, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, + 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, 210, 192, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 219, 0, 0, 0, 219, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 97, 128, 2, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 94, 128, 2, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 97, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, + 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 160, 1, 3, 0, 160, 1, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, + 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 97, 0, 7, 0, 161, 141, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, + 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 0, 0, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 0, 0, 0, 3, 0, 0, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, + 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 128, 3, 0, 3, 0, 0, 0, 66, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, + 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, + 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 3, 0, 0, 0, 3, 0, 0, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, + 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 12, 10, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, + 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, 76, 6, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 140, 11, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 76, 0, 3, 0, 97, 128, 2, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 76, 0, 3, 0, 97, 0, 3, 0, 97, 128, 2, 0, 72, 0, 3, 0, + 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 72, 128, 8, 0, 97, 0, 3, 0, 76, 0, 3, 0, 97, 64, 2, 0, 97, 0, 3, 0, 96, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, + 76, 0, 3, 0, 97, 0, 3, 0, 140, 11, 3, 0, 97, 0, 3, 0, 76, 0, 3, 0, 97, 0, 3, 0, 12, 18, 3, 0, 12, 146, 8, 0, 76, 0, 3, 0, 76, 0, 3, 0, 97, 0, 3, 0, 72, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 12, 18, 3, 0, 76, 0, 3, 0, 72, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 74, 0, 3, 0, 72, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 72, 0, 3, 0, + 72, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 76, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 8, 18, 3, 0, 97, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 128, 8, 0, 84, 128, 8, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 128, 8, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 128, 8, 0, 84, 0, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, + 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 76, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, + 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, + 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 204, 6, 3, 0, 200, 6, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, + 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 138, 7, 3, 0, 144, 71, 5, 0, 143, 71, 5, 0, 143, 71, 5, 0, 143, 71, 5, 0, 155, 7, 3, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, + 144, 71, 5, 0, 144, 71, 5, 0, 155, 7, 3, 0, 137, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, + 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 140, 7, 3, 0, 136, 7, 3, 0, 137, 7, 3, 0, 137, 7, 3, 0, 144, 71, 5, 0, 144, 71, 5, 0, 95, 0, 3, 0, 95, 0, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, + 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 9, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 73, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 12, 18, 3, 0, + 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 10, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, + 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 12, 18, 3, 0, 8, 18, 3, 0, 91, 128, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, + 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 12, 146, 3, 0, 92, 0, 0, 0, 91, 128, 3, 0, 88, 64, 0, 0, 95, 128, 3, 0, + 86, 128, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, + 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 140, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, + 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, + 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 204, 14, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, + 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 12, 39, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, + 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, + 76, 21, 3, 0, 76, 21, 3, 0, 76, 21, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, + 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0,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, 0, 76, 0, 3, 0, + 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 76, 0, 3, 0, 96, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, + 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 72, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, + 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 204, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, + 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, + 200, 0, 3, 0, 200, 0, 3, 0, 200, 0, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, + 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 91, 0, 3, 0, 9, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 7, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 137, 11, 3, 0, 137, 11, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 137, 11, 3, 0, 137, 11, 3, 0, + 137, 11, 3, 0, 137, 11, 3, 0, 137, 11, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 137, 7, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 9, 18, 3, 0, 9, 18, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, 136, 11, 3, 0, + 136, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 139, 11, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, + 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 72, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, + 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 10, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, 8, 18, 3, 0, + 95, 0, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, + 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 72, 6, 3, 0, 95, 128, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, + 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 8, 146, 3, 0, 92, 0, 0, 0, 96, 128, 3, 0, 88, 64, 0, 0, 96, 128, 3, 0, 92, 0, 0, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, + 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 136, 8, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, + 74, 31, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, + 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 200, 14, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, + 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 8, 39, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, + 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 72, 21, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, + 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 74, 30, 3, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 73, 30, 3, 0, 80, 94, 5, 0, + 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 80, 94, 5, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 137, 1, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, + 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 202, 7, 3, 0, 202, 7, 3, 0, 208, 71, 5, 0, 208, 71, 5, 0, 91, 64, 4, 0, 91, 64, 4, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, 210, 199, 2, 0, + 210, 199, 2, 0, 210, 199, 2, 0, 219, 7, 3, 0, 201, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 201, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 202, 25, 3, 0, 201, 25, 3, 0, + 201, 25, 3, 0, 201, 25, 3, 0, 201, 25, 3, 0, 201, 25, 3, 0, 201, 25, 3, 0, 219, 89, 4, 0, 219, 89, 4, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 137, 11, 3, 0, 137, 11, 3, 0, 137, 11, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, + 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 9, 18, 3, 0, 137, 11, 3, 0, 90, 192, 0, 0, 89, 192, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, + 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 128, 1, 0, 73, 0, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 87, 192, 4, 0, 87, 192, 4, 0, 91, 64, 4, 0, + 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, 101, 64, 4, 0, 91, 64, 0, 0, 91, 64, 0, 0, 91, 128, 3, 0, 97, 128, 3, 0, 137, 76, 1, 0, 74, 128, 3, 0, 147, 140, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 97, 128, 3, 0, 97, 128, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, + 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 87, 64, 1, 0, 92, 0, 0, 0, 88, 64, 0, 0, 88, 64, 0, 0, 97, 128, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 78, 76, 5, 0, + 78, 76, 5, 0, 87, 128, 3, 0, 73, 128, 3, 0, 73, 128, 3, 0, 73, 128, 3, 0, 73, 128, 3, 0, 73, 64, 5, 0, 97, 128, 3, 0, 97, 128, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 147, 140, 3, 0, 137, 76, 1, 0, 74, 64, 1, 0, 91, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 15, 9, 0, + 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 91, 64, 1, 0, 73, 0, 9, 0, 201, 79, 1, 0, 201, 79, 1, 0, 202, 143, 3, 0, 74, 168, 3, 0, + 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 73, 104, 1, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, + 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, + 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 74, 19, 3, 0, 73, 19, 3, 0, 73, 19, 3, 0, 73, 19, 3, 0, 73, 19, 3, 0, 73, 19, 3, 0, 73, 19, 3, 0, 91, 83, 4, 0, 91, 83, 4, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, + 137, 38, 3, 0, 155, 102, 4, 0, 155, 166, 1, 0, 155, 102, 4, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, + 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 95, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, 73, 0, 3, 0, + 73, 0, 3, 0, 73, 0, 3, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 201, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, + 225, 23, 10, 0, 225, 23, 10, 0, 225, 23, 10, 0, 202, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 88, 64, 0, 0, 91, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 64, 0, 0, 91, 64, 1, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, 202, 15, 9, 0, + 73, 0, 9, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, + 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 73, 64, 1, 0, 73, 64, 1, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 206, 71, 5, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, + 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 208, 71, 5, 0, 206, 71, 5, 0, 208, 71, 5, 0, 202, 7, 3, 0, 206, 71, 5, 0, + 206, 71, 5, 0, 206, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 206, 71, 5, 0, 206, 71, 5, 0, 206, 71, 5, 0, 206, 71, 5, 0, 208, 71, 5, 0, 206, 71, 5, 0, 206, 71, 5, 0, 202, 7, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, + 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, + 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 74, 22, 3, 0, 80, 86, 5, 0, 80, 86, 5, 0, 74, 22, 3, 0, 78, 86, 5, 0, 78, 86, 5, 0, 74, 37, 3, 0, 97, 165, 4, 0, 97, 165, 4, 0, 97, 165, 4, 0, 91, 165, 4, 0, 91, 37, 3, 0, 91, 165, 4, 0, 91, 165, 4, 0, 91, 37, 1, 0, 91, 165, 4, 0, + 91, 165, 4, 0, 91, 101, 4, 0, 91, 37, 1, 0, 91, 165, 1, 0, 91, 165, 1, 0, 91, 165, 1, 0, 91, 165, 1, 0, 91, 165, 1, 0, 91, 37, 1, 0, 97, 37, 3, 0, 91, 165, 1, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 80, 101, 5, 0, 80, 101, 5, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 97, 37, 3, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, + 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, + 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, + 208, 23, 10, 0, 208, 23, 10, 0, 202, 23, 10, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 219, 87, 4, 0, 219, 87, 4, 0, 219, 23, 3, 0, 219, 23, 3, 0, 219, 23, 3, 0, 219, 23, 3, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, + 206, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 202, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 202, 23, 10, 0, + 202, 23, 10, 0, 202, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 202, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 208, 23, 10, 0, 206, 23, 10, 0, + 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 202, 23, 10, 0, 206, 23, 10, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 210, 215, 2, 0, 206, 23, 10, 0, 206, 23, 10, 0, 206, 23, 10, 0, 208, 23, 10, 0, 225, 23, 10, 0, 225, 23, 10, 0, 74, 76, 6, 0, + 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, + 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 76, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, + 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 140, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, + 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 74, 204, 6, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, 202, 9, 3, 0, + 202, 9, 3, 0, 202, 9, 3, 0, 151, 69, 4, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, + 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 161, 5, 3, 0, 155, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, + 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 138, 5, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, + 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 10, 30, 3, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, + 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 74, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 78, 16, 10, 0, + 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 80, 16, 10, 0, 78, 16, 10, 0, 78, 16, 10, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 208, 86, 5, 0, 208, 86, 5, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, + 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 202, 22, 3, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, + 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, 10, 35, 10, 0, + 10, 35, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, + 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 138, 17, 10, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 142, 66, 5, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, + 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 138, 2, 3, 0, 144, 66, 5, 0, 142, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 144, 66, 5, 0, 142, 66, 5, 0, 144, 66, 5, 0, 142, 66, 5, 0, + 142, 66, 5, 0, 142, 66, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 142, 97, 5, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, + 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 142, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 142, 97, 5, 0, 142, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 142, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 144, 97, 5, 0, 138, 33, 3, 0, 138, 33, 3, 0, + 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 146, 225, 2, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 138, 33, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, + 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 3, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, + 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, + 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 18, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, + 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 74, 36, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 13, 9, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, + 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 87, 64, 1, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 15, 9, 0, + 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, + 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 15, 9, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, + 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 202, 143, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, + 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 74, 140, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, + 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 10, 132, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, + 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 138, 140, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, + 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 74, 168, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, + 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 138, 38, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, + 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, 202, 2, 3, 0, + 202, 33, 3, 0, 202, 33, 3, 0, 208, 97, 5, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 208, 97, 5, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 208, 97, 5, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, + 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 202, 33, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, + 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 10, 28, 3, 0, 206, 94, 5, 0, 206, 94, 5, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, + 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 202, 30, 3, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, + 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 206, 94, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, 208, 71, 5, 0, + 208, 71, 5, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 202, 7, 3, 0, 219, 7, 3, 0, 219, 7, 3, 0, 219, 7, 3, 0, 202, 7, 3, 0, 219, 135, 4, 0, 202, 7, 3, 0, 202, 7, 3, 0, 208, 71, 5, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, 146, 207, 2, 0, + 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 138, 15, 3, 0, 144, 79, 5, 0, + 144, 79, 5, 0, 144, 79, 5, 0, 144, 79, 5, 0, 144, 79, 5, 0, 144, 79, 5, 0, 144, 79, 5, 0, 144, 79, 5, 0, 91, 64, 4, 0, 155, 79, 4, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, 138, 29, 3, 0, + 80, 79, 5, 0, 80, 79, 5, 0, 80, 79, 5, 0, 78, 79, 5, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, + 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 74, 15, 3, 0, 80, 79, 5, 0, 78, 79, 5, 0, 78, 79, 5, 0, 80, 79, 5, 0, 80, 79, 5, 0, 80, 79, 5, 0, 80, 79, 5, 0, 78, 79, 5, 0, 78, 79, 5, 0, 80, 79, 5, 0, 80, 79, 5, 0, 78, 79, 5, 0, 78, 79, 5, 0, 10, 6, 3, 0, 10, 6, 3, 0, + 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, + 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 10, 6, 3, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, + 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 208, 35, 10, 0, 202, 35, 10, 0, 208, 35, 10, 0, 208, 35, 10, 0, 208, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 208, 35, 10, 0, 208, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, 202, 35, 10, 0, + 202, 35, 10, 0, 208, 35, 10, 0, 208, 35, 10, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, + 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 23, 3, 0, 74, 204, 5, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, + 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 204, 5, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, + 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 74, 12, 6, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 159, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 88, 64, 0, 0, 92, 0, 0, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 161, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, + 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 138, 1, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, + 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 10, 19, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, + 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, 202, 5, 3, 0, + 202, 5, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, + 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 10, 15, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, + 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 138, 39, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, + 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 31, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, + 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, + 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 74, 9, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, + 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 10, 1, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, + 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 202, 18, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, + 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 74, 27, 3, 0, 97, 27, 3, 0, 97, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, 84, 27, 3, 0, + 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, + 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 10, 22, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, + 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 138, 30, 3, 0, 148, 30, 3, 0, 148, 30, 3, 0, 155, 30, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, + 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 74, 24, 3, 0, 84, 24, 3, 0, 84, 24, 3, 0, 84, 24, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, + 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 225, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, + 202, 20, 3, 0, 202, 20, 3, 0, 202, 20, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, + 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 74, 2, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, + 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 10, 26, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, + 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 202, 29, 3, 0, 10, 40, 3, 0, + 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, + 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 10, 40, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, + 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 202, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 212, 32, 3, 0, 78, 68, 5, 0, 80, 68, 5, 0, 78, 68, 5, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, + 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 74, 4, 3, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, + 80, 68, 5, 0, 80, 68, 5, 0, 80, 68, 5, 0, 80, 81, 5, 0, 80, 81, 5, 0, 78, 81, 5, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, + 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 74, 17, 3, 0, 78, 81, 5, 0, 78, 81, 5, 0, 78, 81, 5, 0, 80, 81, 5, 0, 80, 81, 5, 0, 80, 81, 5, 0, 80, 81, 5, 0, 78, 81, 5, 0, 78, 81, 5, 0, 80, 81, 5, 0, 80, 81, 5, 0, 91, 17, 3, 0, 91, 17, 3, 0, 66, 17, 3, 0, 91, 81, 4, 0, + 91, 81, 4, 0, 80, 69, 5, 0, 80, 69, 5, 0, 80, 69, 5, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, + 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 74, 5, 3, 0, 144, 95, 5, 0, 144, 95, 5, 0, 142, 95, 5, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, + 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 142, 95, 5, 0, 142, 95, 5, 0, 142, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, + 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 142, 95, 5, 0, 142, 95, 5, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 138, 31, 3, 0, 155, 95, 4, 0, 155, 95, 4, 0, 155, 31, 3, 0, 155, 95, 4, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 144, 95, 5, 0, 155, 31, 3, 0, 142, 95, 5, 0, 144, 95, 5, 0, 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, + 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, 146, 223, 2, 0, 138, 31, 3, 0, 155, 159, 4, 0, 138, 31, 3, 0, 155, 95, 4, 0, 155, 95, 4, 0, 155, 95, 4, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, + 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 10, 32, 3, 0, 16, 96, 5, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, + 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, + 202, 24, 3, 0, 202, 24, 3, 0, 202, 24, 3, 0, 206, 88, 5, 0, 206, 88, 5, 0, 206, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 208, 88, 5, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, + 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 138, 37, 3, 0, 142, 101, 5, 0, 142, 101, 5, 0, 142, 101, 5, 0, 144, 101, 5, 0, + 144, 101, 5, 0, 144, 101, 5, 0, 144, 101, 5, 0, 144, 101, 5, 0, 144, 101, 5, 0, 142, 101, 5, 0, 144, 101, 5, 0, 142, 101, 5, 0, 142, 101, 5, 0, 142, 101, 5, 0, 142, 101, 5, 0, 144, 101, 5, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, + 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 202, 31, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, + 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, 138, 22, 3, 0, + 138, 22, 3, 0, 142, 86, 5, 0, 142, 86, 5, 0, 142, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 144, 86, 5, 0, 142, 86, 5, 0, 142, 86, 5, 0, 144, 86, 5, 0, 142, 86, 5, 0, 144, 86, 5, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, + 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 138, 34, 3, 0, 74, 8, 3, 0, + 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, + 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 74, 8, 3, 0, 138, 40, 3, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, + 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 138, 40, 3, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 142, 104, 5, 0, 138, 40, 3, 0, 144, 104, 5, 0, + 144, 104, 5, 0, 144, 104, 5, 0, 144, 104, 5, 0, 155, 168, 4, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, + 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 74, 33, 3, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, + 80, 97, 5, 0, 78, 97, 5, 0, 80, 97, 5, 0, 80, 97, 5, 0, 91, 97, 4, 0, 91, 97, 4, 0, 91, 97, 4, 0, 74, 33, 3, 0, 91, 161, 4, 0, 91, 161, 4, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, + 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 138, 27, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, + 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0, 202, 39, 3, 0,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 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, + 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 0, 0, 10, 73, 0, 0, 10, 73, 0, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 10, 9, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, + 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 0, 0, + 202, 77, 0, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 13, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, + 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 202, 37, 3, 0, 10, 14, 3, 0, + 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, + 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 10, 14, 3, 0, 16, 78, 5, 0, 16, 78, 5, 0, 16, 78, 5, 0, 16, 78, 5, 0, 16, 78, 5, 0, 16, 78, 5, 0, 16, 78, 5, 0, 27, 78, 4, 0, 27, 78, 4, 0, 27, 78, 4, 0, 27, 14, 3, 0, 27, 14, 3, 0, 33, 14, 3, 0, 33, 14, 3, 0, 33, 14, 3, 0, 33, 14, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, + 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, + 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 10, 29, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, + 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 138, 163, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, + 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 16, 3, 0, 202, 143, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, + 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, + 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 138, 141, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, + 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 74, 153, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, + 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 202, 8, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, + 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, 74, 14, 3, 0, + 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, + 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 74, 39, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, + 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 138, 21, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 66, 0, 3, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, + 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 144, 65, 5, 0, 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, + 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, 82, 229, 2, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 84, 37, 3, 0, 97, 101, 4, 0, 80, 101, 5, 0, 97, 37, 3, 0, 80, 101, 5, 0, 97, 37, 3, 0, 80, 101, 5, 0, 92, 37, 0, 0, 88, 101, 0, 0, 92, 37, 0, 0, + 88, 101, 0, 0, 78, 101, 5, 0, 78, 101, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, + 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 71, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 71, 5, 0, + 144, 71, 5, 0, 91, 128, 3, 0, 87, 128, 3, 0, 87, 128, 3, 0, 86, 128, 3, 0, 86, 128, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 78, 64, 5, 0, 78, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 78, 64, 5, 0, 78, 64, 5, 0, 78, 64, 5, 0, 78, 64, 5, 0, 78, 64, 5, 0, 78, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, + 144, 64, 5, 0, 144, 64, 5, 0, 97, 0, 3, 0, 97, 0, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 144, 64, 5, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, + 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, + 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 16, 95, 5, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 16, 95, 5, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, + 33, 31, 3, 0, 33, 31, 3, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, + 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 14, 93, 5, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, + 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 82, 192, 2, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, + 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 146, 8, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 19, 18, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, + 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, + 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 147, 11, 3, 0, 148, 11, 3, 0, 148, 11, 3, 0, 148, 11, 3, 0, 148, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, + 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 211, 39, 3, 0, 84, 128, 8, 0, + 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, + 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, + 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 0, 3, 0, 97, 192, 0, 0, 97, 0, 3, 0, 97, 128, 1, 0, 97, 128, 1, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, + 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, + 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, + 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 97, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, + 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 84, 128, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, + 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 212, 21, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, + 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 84, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 97, 35, 3, 0, 94, 163, 2, 0, 94, 163, 2, 0, 94, 163, 2, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, + 84, 0, 3, 0, 84, 0, 3, 0, 84, 0, 3, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 84, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 0, 1, 0, 101, 64, 4, 0, 101, 64, 4, 0, 101, 64, 4, 0, 66, 0, 5, 0, 130, 64, 5, 0, 130, 192, 7, 0, 66, 64, 5, 0, + 66, 64, 5, 0, 87, 64, 4, 0, 87, 0, 1, 0, 87, 64, 4, 0, 87, 64, 4, 0, 87, 192, 4, 0, 87, 128, 8, 0, 91, 128, 8, 0, 91, 0, 3, 0, 90, 192, 0, 0, 89, 192, 0, 0, 92, 0, 0, 0, 90, 192, 0, 0, 90, 192, 0, 0, 89, 192, 0, 0, 92, 0, 0, 0, 90, 192, 0, 0, 91, 128, 8, 0, 91, 128, 8, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 192, 3, 0, 91, 192, 3, 0, 91, 192, 3, 0, 91, 64, 4, 0, + 99, 192, 8, 0, 100, 192, 8, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 101, 0, 1, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 128, 2, 0, 91, 0, 3, 0, 90, 192, 0, 0, 89, 192, 0, 0, 91, 128, 8, 0, 91, 64, 1, 0, 91, 64, 1, 0, 91, 0, 3, 0, 86, 0, 3, 0, 86, 0, 3, 0, + 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 96, 0, 2, 0, 92, 0, 0, 0, 88, 64, 0, 0, 91, 64, 1, 0, 91, 64, 1, 0, 91, 64, 1, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 91, 0, 3, 0, 96, 0, 3, 0, 91, 0, 3, 0, 86, 0, 3, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, + 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, 91, 64, 4, 0, 91, 64, 4, 0, 101, 64, 4, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, + 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 66, 64, 5, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, + 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 4, 64, 8, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, + 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, 5, 64, 10, 0, + 5, 64, 10, 0, 5, 64, 10, 0, 91, 192, 0, 0, 91, 192, 0, 0, 90, 192, 0, 0, 89, 192, 0, 0, 90, 192, 0, 0, 89, 192, 0, 0, 91, 192, 0, 0, 91, 192, 0, 0, 91, 192, 0, 0, 90, 192, 0, 0, 89, 192, 0, 0, 91, 192, 0, 0, 90, 192, 0, 0, 89, 192, 0, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 64, 4, 0, 91, 0, 3, 0, + 87, 64, 4, 0, 91, 0, 0, 0, 91, 64, 4, 0, 87, 0, 3, 0, 91, 0, 3, 0, 90, 192, 0, 0, 89, 192, 0, 0, 91, 0, 3, 0, 91, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 92, 0, 0, 0, 88, 64, 0, 0, 92, 0, 0, 0, 88, 64, 0, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 92, 0, 0, 0, 88, 64, 0, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0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 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 128, 8, 0, 97, 0, 3, 0, 96, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 128, 8, 0, + 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 64, 2, 0, 96, 64, 2, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, + 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, + 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, + 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 128, 8, 0, + 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 128, 8, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96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 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 96, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 96, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 96, 0, 3, 0, 96, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 96, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, 96, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, + 94, 64, 2, 0, 94, 128, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 128, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 128, 2, 0, 94, 64, 2, 0, 94, 64, 2, 0, 94, 128, 2, 0, + 94, 64, 2, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 95, 128, 7, 0, 95, 128, 7, 0, 95, 128, 7, 0, 95, 128, 7, 0, 95, 128, 7, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, + 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 16, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 192, 0, 0, 97, 192, 0, 0, 97, 192, 0, 0, 97, 192, 0, 0, 97, 192, 0, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, + 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 4, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, + 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, + 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 161, 140, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, + 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 140, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, + 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 97, 128, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, + 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 225, 143, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, + 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 97, 168, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, + 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 161, 11, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, + 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, + 33, 31, 3, 0, 33, 31, 3, 0, 33, 31, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, + 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 8, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, + 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, + 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, + 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 192, 0, 0, 97, 192, 0, 0, 97, 192, 0, 0, 97, 64, 1, 0, 97, 64, 1, 0, 97, 64, 1, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 0, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, + 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, 97, 64, 7, 0, + 97, 64, 7, 0, 97, 64, 7, 0, 97, 128, 3, 0, 97, 128, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; } } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrie.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrie.cs index 08b019ed33..cf03ed7cd3 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrie.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrie.cs @@ -15,92 +15,119 @@ // Ported from: https://github.com/foliojs/unicode-trie // Copied from: https://github.com/toptensoftware/RichTextKit +using System; using System.IO; -using System.IO.Compression; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Text; namespace Avalonia.Media.TextFormatting.Unicode { internal class UnicodeTrie { - private readonly int[] _data; + private readonly uint[] _data; private readonly int _highStart; private readonly uint _errorValue; + /// + /// Initializes a new instance of the class. + /// + /// The uncompressed trie data. + public UnicodeTrie(ReadOnlySpan rawData) + { + var header = UnicodeTrieHeader.Parse(rawData); + int length = header.DataLength; + uint[] data = new uint[length / sizeof(uint)]; + + MemoryMarshal.Cast(rawData.Slice(rawData.Length - length)) + .CopyTo(data); + + _highStart = header.HighStart; + _errorValue = header.ErrorValue; + _data = data; + } + + /// + /// Initializes a new instance of the class. + /// + /// The stream containing the data. public UnicodeTrie(Stream stream) { - int dataLength; - using (var bw = new BinaryReader(stream, Encoding.UTF8, true)) + // Read the header info + using (var br = new BinaryReader(stream, Encoding.UTF8, true)) { - _highStart = bw.ReadInt32BE(); - _errorValue = bw.ReadUInt32BE(); - dataLength = bw.ReadInt32BE() / 4; + _highStart = br.ReadInt32(); + _errorValue = br.ReadUInt32(); + _data = new uint[br.ReadInt32() / sizeof(uint)]; } - using (var infl1 = new DeflateStream(stream, CompressionMode.Decompress, true)) - using (var infl2 = new DeflateStream(infl1, CompressionMode.Decompress, true)) - using (var bw = new BinaryReader(infl2, Encoding.UTF8, true)) + // Read the data in compressed format. + using (var br = new BinaryReader(stream, Encoding.UTF8, true)) { - _data = new int[dataLength]; for (int i = 0; i < _data.Length; i++) { - _data[i] = bw.ReadInt32(); + _data[i] = br.ReadUInt32(); } } } - public UnicodeTrie(byte[] buf) : this(new MemoryStream(buf)) - { - } - - internal UnicodeTrie(int[] data, int highStart, uint errorValue) + /// + /// Initializes a new instance of the class. + /// + /// The uncompressed trie data. + /// The start of the last range which ends at U+10ffff. + /// The value for out-of-range code points and illegal UTF-8. + public UnicodeTrie(uint[] data, int highStart, uint errorValue) { _data = data; _highStart = highStart; _errorValue = errorValue; } + /// + /// Saves the to the stream in a compressed format. + /// + /// The output stream. internal void Save(Stream stream) { // Write the header info using (var bw = new BinaryWriter(stream, Encoding.UTF8, true)) { - bw.WriteBE(_highStart); - bw.WriteBE(_errorValue); - bw.WriteBE(_data.Length * 4); + bw.Write(_highStart); + bw.Write(_errorValue); + bw.Write(_data.Length * sizeof(uint)); } - // Double compress the data - using (var def1 = new DeflateStream(stream, CompressionLevel.Optimal, true)) - using (var def2 = new DeflateStream(def1, CompressionLevel.Optimal, true)) - using (var bw = new BinaryWriter(def2, Encoding.UTF8, true)) + // Write the data. + using (var bw = new BinaryWriter(stream, Encoding.UTF8, true)) { - foreach (var v in _data) + for (int i = 0; i < _data.Length; i++) { - bw.Write(v); + bw.Write(_data[i]); } - bw.Flush(); - def2.Flush(); - def1.Flush(); } } - public uint Get(int codePoint) + /// + /// Get the value for a code point as stored in the trie. + /// + /// The code point. + /// The value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public uint Get(uint codePoint) { - int index; - if ((codePoint < 0) || (codePoint > 0x10ffff)) - { - return _errorValue; - } + uint index; + ref uint dataBase = ref MemoryMarshal.GetReference(_data.AsSpan()); - if ((codePoint < 0xd800) || ((codePoint > 0xdbff) && (codePoint <= 0xffff))) + if (codePoint is < 0x0d800 or (> 0x0dbff and <= 0x0ffff)) { // Ordinary BMP code point, excluding leading surrogates. - // BMP uses a single level lookup. BMP index starts at offset 0 in the index. - // data is stored in the index array itself. - index = (_data[codePoint >> UnicodeTrieBuilder.SHIFT_2] << UnicodeTrieBuilder.INDEX_SHIFT) + (codePoint & UnicodeTrieBuilder.DATA_MASK); - return (uint)_data[index]; + // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. + // 16 bit data is stored in the index array itself. + index = _data[codePoint >> UnicodeTrieBuilder.SHIFT_2]; + index = (index << UnicodeTrieBuilder.INDEX_SHIFT) + (codePoint & UnicodeTrieBuilder.DATA_MASK); + return Unsafe.Add(ref dataBase, (nint)index); } if (codePoint <= 0xffff) @@ -109,20 +136,57 @@ namespace Avalonia.Media.TextFormatting.Unicode // lead surrogate code units and code points. // The main index has the code unit data. // For this function, we need the code point data. - index = (_data[UnicodeTrieBuilder.LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UnicodeTrieBuilder.SHIFT_2)] << UnicodeTrieBuilder.INDEX_SHIFT) + (codePoint & UnicodeTrieBuilder.DATA_MASK); - return (uint)_data[index]; + // Note: this expression could be refactored for slightly improved efficiency, but + // surrogate code points will be so rare in practice that it's not worth it. + index = _data[UnicodeTrieBuilder.LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UnicodeTrieBuilder.SHIFT_2)]; + index = (index << UnicodeTrieBuilder.INDEX_SHIFT) + (codePoint & UnicodeTrieBuilder.DATA_MASK); + return Unsafe.Add(ref dataBase, (nint)index); } if (codePoint < _highStart) { // Supplemental code point, use two-level lookup. - index = _data[(UnicodeTrieBuilder.INDEX_1_OFFSET - UnicodeTrieBuilder.OMITTED_BMP_INDEX_1_LENGTH) + (codePoint >> UnicodeTrieBuilder.SHIFT_1)]; - index = _data[index + ((codePoint >> UnicodeTrieBuilder.SHIFT_2) & UnicodeTrieBuilder.INDEX_2_MASK)]; + index = UnicodeTrieBuilder.INDEX_1_OFFSET - UnicodeTrieBuilder.OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UnicodeTrieBuilder.SHIFT_1); + index = _data[index]; + index += (codePoint >> UnicodeTrieBuilder.SHIFT_2) & UnicodeTrieBuilder.INDEX_2_MASK; + index = _data[index]; index = (index << UnicodeTrieBuilder.INDEX_SHIFT) + (codePoint & UnicodeTrieBuilder.DATA_MASK); - return (uint)_data[index]; + return Unsafe.Add(ref dataBase, (nint)index); + } + + if (codePoint <= 0x10ffff) + { + return Unsafe.Add(ref dataBase, (nint)(_data.Length - UnicodeTrieBuilder.DATA_GRANULARITY)); + } + + // Fall through. The code point is outside of the legal range of 0..0x10ffff. + return _errorValue; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct UnicodeTrieHeader + { + public int HighStart + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get; + } + + public uint ErrorValue + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get; + } + + public int DataLength + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get; } - return (uint)_data[_data.Length - UnicodeTrieBuilder.DATA_GRANULARITY]; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static UnicodeTrieHeader Parse(ReadOnlySpan data) + => MemoryMarshal.Cast(data)[0]; } } } diff --git a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrieBuilder.cs b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrieBuilder.cs index a60bac4ce4..87f96984c5 100644 --- a/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrieBuilder.cs +++ b/src/Avalonia.Base/Media/TextFormatting/Unicode/UnicodeTrieBuilder.cs @@ -368,24 +368,24 @@ namespace Avalonia.Media.TextFormatting.Unicode // calculate the sizes of, and allocate, the index and data arrays var indexLength = allIndexesLength + _dataLength; - var data = new int[indexLength]; + var data = new uint[indexLength]; // write the index-2 array values shifted right by INDEX_SHIFT, after adding dataMove var destIdx = 0; for (i = 0; i < INDEX_2_BMP_LENGTH; i++) { - data[destIdx++] = ((_index2[i] + dataMove) >> INDEX_SHIFT); + data[destIdx++] = (uint)((_index2[i] + dataMove) >> INDEX_SHIFT); } // write UTF-8 2-byte index-2 values, not right-shifted for (i = 0; i < 0xc2 - 0xc0; i++) { // C0..C1 - data[destIdx++] = (dataMove + BAD_UTF8_DATA_OFFSET); + data[destIdx++] = (uint)(dataMove + BAD_UTF8_DATA_OFFSET); } for (; i < 0xe0 - 0xc0; i++) { // C2..DF - data[destIdx++] = (dataMove + _index2[i << (6 - SHIFT_2)]); + data[destIdx++] = (uint)(dataMove + _index2[i << (6 - SHIFT_2)]); } if (_highStart > 0x10000) @@ -396,21 +396,21 @@ namespace Avalonia.Media.TextFormatting.Unicode // write 16-bit index-1 values for supplementary code points for (i = 0; i < index1Length; i++) { - data[destIdx++] = (INDEX_2_OFFSET + _index1[i + OMITTED_BMP_INDEX_1_LENGTH]); + data[destIdx++] = (uint)(INDEX_2_OFFSET + _index1[i + OMITTED_BMP_INDEX_1_LENGTH]); } // write the index-2 array values for supplementary code points, // shifted right by INDEX_SHIFT, after adding dataMove for (i = 0; i < _index2Length - index2Offset; i++) { - data[destIdx++] = ((dataMove + _index2[index2Offset + i]) >> INDEX_SHIFT); + data[destIdx++] = (uint)((dataMove + _index2[index2Offset + i]) >> INDEX_SHIFT); } } // write 16-bit data values for (i = 0; i < _dataLength; i++) { - data[destIdx++] = (int)_data[i]; + data[destIdx++] = _data[i]; } return new UnicodeTrie(data, _highStart, _errorValue); diff --git a/src/Avalonia.Base/Utilities/ArrayBuilder.cs b/src/Avalonia.Base/Utilities/ArrayBuilder.cs index 7048659431..60bf2c7586 100644 --- a/src/Avalonia.Base/Utilities/ArrayBuilder.cs +++ b/src/Avalonia.Base/Utilities/ArrayBuilder.cs @@ -101,7 +101,7 @@ namespace Avalonia.Utilities /// /// The array slice. /// The . - public ArraySlice Add(in ReadOnlySlice value) + public ArraySlice Add(in ArraySlice value) { var position = _size; diff --git a/src/Avalonia.Base/Utilities/ArraySlice.cs b/src/Avalonia.Base/Utilities/ArraySlice.cs index f5a9d3a98d..482f807fe0 100644 --- a/src/Avalonia.Base/Utilities/ArraySlice.cs +++ b/src/Avalonia.Base/Utilities/ArraySlice.cs @@ -116,7 +116,7 @@ namespace Avalonia.Utilities /// public static implicit operator ReadOnlySlice(ArraySlice slice) { - return new ReadOnlySlice(slice._data).AsSlice(slice.Start, slice.Length); + return new ReadOnlySlice(slice._data, 0, slice.Length, slice.Start); } /// diff --git a/src/Avalonia.Base/Utilities/BidiDictionary.cs b/src/Avalonia.Base/Utilities/BidiDictionary.cs new file mode 100644 index 0000000000..654fbc9807 --- /dev/null +++ b/src/Avalonia.Base/Utilities/BidiDictionary.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace Avalonia.Utilities +{ + /// + /// A simple bi-directional dictionary. + /// + /// Key type + /// Value type + internal sealed class BidiDictionary where T1 : notnull where T2 : notnull + { + public Dictionary Forward { get; } = new Dictionary(); + + public Dictionary Reverse { get; } = new Dictionary(); + + public void Clear() + { + Forward.Clear(); + Reverse.Clear(); + } + + public void Add(T1 key, T2 value) + { + Forward.Add(key, value); + Reverse.Add(value, key); + } + +#pragma warning disable CS8601 + public bool TryGetValue(T1 key, out T2 value) => Forward.TryGetValue(key, out value); +#pragma warning restore CS8601 + +#pragma warning disable CS8601 + public bool TryGetKey(T2 value, out T1 key) => Reverse.TryGetValue(value, out key); +#pragma warning restore CS8601 + + public bool ContainsKey(T1 key) => Forward.ContainsKey(key); + + public bool ContainsValue(T2 value) => Reverse.ContainsKey(value); + } +} diff --git a/src/Skia/Avalonia.Skia/TextShaperImpl.cs b/src/Skia/Avalonia.Skia/TextShaperImpl.cs index 777e907617..6b0b7bccbb 100644 --- a/src/Skia/Avalonia.Skia/TextShaperImpl.cs +++ b/src/Skia/Avalonia.Skia/TextShaperImpl.cs @@ -85,7 +85,7 @@ namespace Avalonia.Skia var second = glyphInfos[length - 1]; - if (!new Codepoint((int)second.Codepoint).IsBreakChar) + if (!new Codepoint(second.Codepoint).IsBreakChar) { return; } diff --git a/src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs index 6e32d32913..435c7cd89a 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs @@ -85,7 +85,7 @@ namespace Avalonia.Direct2D1.Media var second = glyphInfos[length - 1]; - if (!new Codepoint((int)second.Codepoint).IsBreakChar) + if (!new Codepoint(second.Codepoint).IsBreakChar) { return; } diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiAlgorithmTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiAlgorithmTests.cs index f8a2abc716..5ff2c0e07b 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiAlgorithmTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiAlgorithmTests.cs @@ -27,7 +27,7 @@ namespace Avalonia.Visuals.UnitTests.Media.TextFormatting private bool Run(BiDiTestData testData) { - var bidi = BidiAlgorithm.Instance.Value; + var bidi = new BidiAlgorithm(); // Run the algorithm... ArraySlice resultLevels; diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTests.cs index 1ed33e6132..d2cea45ce1 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiClassTests.cs @@ -30,7 +30,7 @@ namespace Avalonia.Visuals.UnitTests.Media.TextFormatting private bool Run(BiDiClassData t) { - var bidi = BidiAlgorithm.Instance.Value; + var bidi = new BidiAlgorithm(); var bidiData = new BidiData(t.ParagraphLevel); var text = Encoding.UTF32.GetString(MemoryMarshal.Cast(t.CodePoints).ToArray()); @@ -39,9 +39,12 @@ namespace Avalonia.Visuals.UnitTests.Media.TextFormatting bidiData.Append(text.AsMemory()); // Act - bidi.Process(bidiData); + for (int i = 0; i < 10; i++) + { + bidi.Process(bidiData); + } - var resultLevels = bidi.ResolvedLevels; + var resultLevels = bidi.ResolvedLevels; var resultParagraphLevel = bidi.ResolvedParagraphEmbeddingLevel; // Assert diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs index 033e0e2242..3c5a966eb7 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/BiDiTestDataGenerator.cs @@ -129,6 +129,8 @@ namespace Avalonia.Visuals.UnitTests.Media.TextFormatting ParagraphEmbeddingLevel = paragraphEmbeddingLevel, Levels = levels }); + + break; } } } diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs index 4d1941f7c5..1a8d41caa4 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGenerator.cs @@ -19,11 +19,6 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting var trie = GenerateBreakTypeTrie(); UnicodeDataGenerator.GenerateTrieClass("GraphemeBreak", trie); - - using (var stream = File.Create("Generated\\GraphemeBreak.trie")) - { - trie.Save(stream); - } } private static UnicodeTrie GenerateBreakTypeTrie() @@ -38,9 +33,9 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting { foreach (var (start, end, graphemeBreakType) in breakData) { - if (!Enum.TryParse(graphemeBreakType, out var value)) + if (!Enum.TryParse(graphemeBreakType.Replace("_", ""), out var value)) { - continue; + continue; } if (start == end) diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGeneratorTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGeneratorTests.cs index e1e3e14ea7..c9f869cea9 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGeneratorTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakClassTrieGeneratorTests.cs @@ -1,6 +1,10 @@ using System; +using System.Runtime.InteropServices; +using System.Text; using Avalonia.Media.TextFormatting.Unicode; +using Avalonia.Visuals.UnitTests.Media.TextFormatting; using Xunit; +using Xunit.Abstractions; namespace Avalonia.Base.UnitTests.Media.TextFormatting { @@ -10,20 +14,74 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting /// public class GraphemeBreakClassTrieGeneratorTests { - [Theory(Skip = "Only run when we update the trie.")] - [ClassData(typeof(GraphemeBreakTestDataGenerator))] - public void Should_Enumerate(string text, int expectedLength) + private readonly ITestOutputHelper _outputHelper; + + public GraphemeBreakClassTrieGeneratorTests(ITestOutputHelper outputHelper) { - var textMemory = text.AsMemory(); + _outputHelper = outputHelper; + } - var enumerator = new GraphemeEnumerator(textMemory); + [Fact(/*Skip = "Only run when we update the trie."*/)] + public void Should_Enumerate() + { + var generator = new GraphemeBreakTestDataGenerator(); - Assert.True(enumerator.MoveNext()); + foreach (var testData in generator) + { + Assert.True(Run(testData)); + } + } - Assert.Equal(expectedLength, enumerator.Current.Text.Length); + private bool Run(GraphemeBreakData t) + { + var text = Encoding.UTF32.GetString(MemoryMarshal.Cast(t.Codepoints).ToArray()); + var grapheme = Encoding.UTF32.GetString(MemoryMarshal.Cast(t.Grapheme).ToArray()).AsSpan(); + + var enumerator = new GraphemeEnumerator(text.AsMemory()); + + enumerator.MoveNext(); + + var actual = enumerator.Current.Text.Span; + + var pass = true; + + if(actual.Length != grapheme.Length) + { + pass = false; + } + + if (pass) + { + for (int i = 0; i < grapheme.Length; i++) + { + var a = grapheme[i]; + var b = actual[i]; + + if (a != b) + { + pass = false; + + break; + } + } + } + + if (!pass) + { + _outputHelper.WriteLine($"Failed line {t.LineNumber}"); + _outputHelper.WriteLine($" Text: {text}"); + _outputHelper.WriteLine($" Codepoints: {string.Join(" ", t.Codepoints)}"); + _outputHelper.WriteLine($" Grapheme: {string.Join(" ", t.Grapheme)}"); + _outputHelper.WriteLine($" Line: {t.Line}"); + + return false; + } + + + return true; } - [Fact(Skip = "Only run when we update the trie.")] + [Fact(/*Skip = "Only run when we update the trie."*/)] public void Should_Enumerate_Other() { const string text = "ABCDEFGHIJ"; @@ -44,18 +102,10 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting Assert.Equal(10, count); } - [Fact(Skip = "Only run when we update the trie.")] + [Fact(/*Skip = "Only run when we update the trie."*/)] public void Should_Generate_Trie() { GraphemeBreakClassTrieGenerator.Execute(); } - - private class GraphemeBreakTestDataGenerator : TestDataGenerator - { - public GraphemeBreakTestDataGenerator() - : base("auxiliary/GraphemeBreakTest.txt") - { - } - } } } diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs new file mode 100644 index 0000000000..f6616d74a2 --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/GraphemeBreakTestDataGenerator.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using Avalonia.Base.UnitTests.Media.TextFormatting; + +namespace Avalonia.Visuals.UnitTests.Media.TextFormatting +{ + internal class GraphemeBreakTestDataGenerator : IEnumerable + { + private readonly List _testData; + + public GraphemeBreakTestDataGenerator() + { + _testData = ReadData(); + } + + public IEnumerator GetEnumerator() + { + return _testData.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + private static List ReadData() + { + var testData = new List(); + + var url = Path.Combine(UnicodeDataGenerator.Ucd, "auxiliary/GraphemeBreakTest.txt"); + + using (var client = new HttpClient()) + using (var result = client.GetAsync(url).GetAwaiter().GetResult()) + { + if (!result.IsSuccessStatusCode) + { + return testData; + } + + using (var stream = result.Content.ReadAsStreamAsync().GetAwaiter().GetResult()) + using (var reader = new StreamReader(stream)) + { + var lineNumber = 0; + + while (!reader.EndOfStream) + { + var line = reader.ReadLine(); + + lineNumber++; + + if (line == null) + { + break; + } + + if (line.StartsWith("#") || string.IsNullOrEmpty(line)) + { + continue; + } + + var elements = line.Split('#'); + + elements = elements[0].Replace("÷\t", "÷").Trim('÷').Split('÷'); + + var graphemeChars = elements[0].Replace(" × ", " ").Split(' '); + + var codepoints = graphemeChars.Where(x => x != "" && x != "×") + .Select(x => Convert.ToInt32(x, 16)).ToList(); + + var grapheme = codepoints.ToArray(); + + if(elements.Length > 1) + { + var remainingChars = elements[1].Replace(" × ", " ").Split(' '); + + var remaining = remainingChars.Where(x => x != "" && x != "×").Select(x => Convert.ToInt32(x, 16)).ToArray(); + + codepoints.AddRange(remaining); + } + + var data = new GraphemeBreakData + { + Line = line, + LineNumber = lineNumber, + Grapheme = grapheme, + Codepoints = codepoints.ToArray() + }; + + testData.Add(data); + } + } + } + return testData; + } + } + + internal struct GraphemeBreakData + { + public string Line { get; set; } + public int LineNumber { get; set; } + public int[] Grapheme { get; set; } + public int[] Codepoints{ get; set; } + } +} diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs index 1dbfbe4d24..15be1200c8 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/LineBreakEnumuratorTests.cs @@ -134,7 +134,7 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting _outputHelper.WriteLine($"Expected Breaks: {string.Join(" ", breakPoints)}"); _outputHelper.WriteLine($" Actual Breaks: {string.Join(" ", foundBreaks)}"); _outputHelper.WriteLine($" Text: {text}"); - _outputHelper.WriteLine($" Char Props: {string.Join(" ", codePoints.Select(x => new Codepoint(x).LineBreakClass))}"); + _outputHelper.WriteLine($" Char Props: {string.Join(" ", codePoints.Select(x => new Codepoint((uint)x).LineBreakClass))}"); _outputHelper.WriteLine(""); } diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/TestDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/TestDataGenerator.cs deleted file mode 100644 index 33b4c8a269..0000000000 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/TestDataGenerator.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; - -namespace Avalonia.Base.UnitTests.Media.TextFormatting -{ - public abstract class TestDataGenerator : IEnumerable - { - private readonly string _fileName; - private readonly List _testData; - - protected TestDataGenerator(string fileName) - { - _fileName = fileName; - _testData = ReadTestData(); - } - - public IEnumerator GetEnumerator() - { - return _testData.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - private List ReadTestData() - { - var testData = new List(); - - using (var client = new HttpClient()) - { - var url = Path.Combine(UnicodeDataGenerator.Ucd, _fileName); - - using (var result = client.GetAsync(url).GetAwaiter().GetResult()) - { - if (!result.IsSuccessStatusCode) - return testData; - - using (var stream = result.Content.ReadAsStreamAsync().GetAwaiter().GetResult()) - using (var reader = new StreamReader(stream)) - { - while (!reader.EndOfStream) - { - var line = reader.ReadLine(); - - if (line == null) - { - break; - } - - if (line.StartsWith("#") || string.IsNullOrEmpty(line)) - { - continue; - } - - var elements = line.Split('#'); - - elements = elements[0].Replace("÷\t", "÷").Trim('÷').Split('÷'); - - var chars = elements[0].Replace(" × ", " ").Split(' '); - - var codepoints = chars.Where(x => x != "" && x != "×") - .Select(x => Convert.ToInt32(x, 16)).ToArray(); - - var text = string.Join(null, codepoints.Select(char.ConvertFromUtf32)); - - var length = codepoints.Select(x => x > ushort.MaxValue ? 2 : 1).Sum(); - - var data = new object[] { text, length }; - - testData.Add(data); - } - } - } - } - - return testData; - } - } -} diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs index ab6b06c200..a49c8ffa2a 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGenerator.cs @@ -10,22 +10,22 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting { internal static class UnicodeDataGenerator { - public const string Ucd = "https://www.unicode.org/Public/13.0.0/ucd/"; + public const string Ucd = "https://www.unicode.org/Public/14.0.0/ucd/"; - public static UnicodeTrie GenerateBiDiTrie(out BiDiDataEntries biDiDataEntries,out Dictionary biDiData) + public static UnicodeTrie GenerateBiDiTrie(out BiDiDataEntries biDiDataEntries, out Dictionary biDiData) { biDiData = new Dictionary(); - var biDiClassEntries = - UnicodeEnumsGenerator.CreateBiDiClassEnum(); + var bidiClassEntries = + UnicodeEnumsGenerator.CreateBidiClassEnum(); - var biDiClassMappings = CreateTagToIndexMappings(biDiClassEntries); + var bidiClassMappings = CreateTagToIndexMappings(bidiClassEntries); - var biDiClassData = ReadBiDiData(); + var bidiClassData = ReadBiDiData(); - foreach (var (range, name) in biDiClassData) + foreach (var (range, name) in bidiClassData) { - var biDiClass = biDiClassMappings[name]; + var biDiClass = bidiClassMappings[name]; AddBiDiClassRange(biDiData, range, biDiClass); } @@ -56,19 +56,14 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting biDiDataEntries = new BiDiDataEntries() { - PairedBracketTypes = biDiPairedBracketTypeEntries, BiDiClasses = biDiClassEntries + PairedBracketTypes = biDiPairedBracketTypeEntries, BiDiClasses = bidiClassEntries }; var trie = biDiTrieBuilder.Freeze(); - GenerateTrieClass("BiDi", trie); - - using (var stream = File.Create("Generated\\BiDi.trie")) - { - trie.Save(stream); + GenerateTrieClass("Bidi", trie); - return trie; - } + return trie; } public static void GenerateTrieClass(string name, UnicodeTrie trie) @@ -92,6 +87,8 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting writer.Write(" "); + long length = stream.Length; + while (true) { var b = stream.ReadByte(); @@ -100,18 +97,22 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting { break; } - - writer.Write(b.ToString()); - writer.Write(','); + writer.Write(b.ToString()); - if (stream.Position % 100 == 0) + if (stream.Position % 100 > 0 && stream.Position != length) + { + writer.Write(", "); + } + else { + writer.Write(','); writer.Write(Environment.NewLine); - writer.Write(" "); - - continue; + if (stream.Position != length) + { + writer.Write(" "); + } } } @@ -161,12 +162,7 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting GenerateTrieClass("UnicodeData", trie); - using (var stream = File.Create("Generated\\UnicodeData.trie")) - { - trie.Save(stream); - - return trie; - } + return trie; } private static Dictionary GetUnicodeData(IReadOnlyDictionary generalCategoryMappings, @@ -461,9 +457,7 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting public int BracketType { get; set; } public int BiDiClass { get; set; } - } - - + } } internal class UnicodeDataEntries diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGeneratorTests.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGeneratorTests.cs index f3aea83316..688c711f15 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGeneratorTests.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeDataGeneratorTests.cs @@ -22,7 +22,7 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting foreach (var value in unicodeData.Values) { - var data = unicodeDataTrie.Get(value.Codepoint); + var data = unicodeDataTrie.Get((uint)value.Codepoint); Assert.Equal(value.GeneralCategory, GetValue(data, 0, UnicodeData.CATEGORY_MASK)); @@ -35,7 +35,7 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting foreach (var value in biDiData.Values) { - var data = biDiTrie.Get(value.Codepoint); + var data = biDiTrie.Get((uint)value.Codepoint); Assert.Equal(value.Bracket, GetValue(data, 0, UnicodeData.BIDIPAIREDBRACKED_MASK)); diff --git a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs index 10da018eeb..110e57cbd3 100644 --- a/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs +++ b/tests/Avalonia.Base.UnitTests/Media/TextFormatting/UnicodeEnumsGenerator.cs @@ -244,18 +244,18 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting return orderedLineBreakEntries.Values.ToList(); } - public static List CreateBiDiClassEnum() + public static List CreateBidiClassEnum() { var entries = new List { new DataEntry("Left_To_Right", "L", string.Empty) }; ParseDataEntries("# Bidi_Class (bc)", entries); - using (var stream = File.Create("Generated\\BiDiClass.cs")) + using (var stream = File.Create("Generated\\BidiClass.cs")) using (var writer = new StreamWriter(stream)) { writer.WriteLine("namespace Avalonia.Media.TextFormatting.Unicode"); writer.WriteLine("{"); - writer.WriteLine(" public enum BiDiClass"); + writer.WriteLine(" public enum BidiClass"); writer.WriteLine(" {"); foreach (var entry in entries) @@ -277,12 +277,12 @@ namespace Avalonia.Base.UnitTests.Media.TextFormatting ParseDataEntries("# Bidi_Paired_Bracket_Type (bpt)", entries); - using (var stream = File.Create("Generated\\BiDiPairedBracketType.cs")) + using (var stream = File.Create("Generated\\BidiPairedBracketType.cs")) using (var writer = new StreamWriter(stream)) { writer.WriteLine("namespace Avalonia.Media.TextFormatting.Unicode"); writer.WriteLine("{"); - writer.WriteLine(" public enum BiDiPairedBracketType"); + writer.WriteLine(" public enum BidiPairedBracketType"); writer.WriteLine(" {"); foreach (var entry in entries) diff --git a/tests/Avalonia.UnitTests/HarfBuzzTextShaperImpl.cs b/tests/Avalonia.UnitTests/HarfBuzzTextShaperImpl.cs index 4bc30484e9..459ae3a549 100644 --- a/tests/Avalonia.UnitTests/HarfBuzzTextShaperImpl.cs +++ b/tests/Avalonia.UnitTests/HarfBuzzTextShaperImpl.cs @@ -80,7 +80,7 @@ namespace Avalonia.UnitTests var second = glyphInfos[length - 1]; - if (!new Codepoint((int)second.Codepoint).IsBreakChar) + if (!new Codepoint(second.Codepoint).IsBreakChar) { return; } From cebd5b169de369b47aa6490e9c95c1789d84138a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Jun 2022 10:57:29 +0200 Subject: [PATCH 266/393] Added script to run automation tests on macOS. --- .../macos-clean-build-test.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh new file mode 100755 index 0000000000..30a4a79f4a --- /dev/null +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -0,0 +1,8 @@ +# Cleans, builds, and runs integration tests on macOS. +# Can be used by `git bisect run` to automatically find the commit which introduced a problem. +SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +cd "$SCRIPT_DIR"/../.. || exit +git clean -xdf +./build.sh CompileNative +./samples/IntegrationTestApp/bundle.sh +dotnet test tests/Avalonia.IntegrationTests.Appium/ -l "console;verbosity=detailed" From 15c26b9dd55ac83590b79ae61e73db937f580161 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Jun 2022 12:06:21 +0200 Subject: [PATCH 267/393] Use frame size for CenterOwner startup location. --- src/Avalonia.Controls/Window.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 92f74530e2..2dd391945b 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -901,10 +901,10 @@ namespace Avalonia.Controls { if (owner != null) { - // TODO: We really need non-client size here. + var ownerSize = owner.FrameSize ?? owner.ClientSize; var ownerRect = new PixelRect( owner.Position, - PixelSize.FromSize(owner.ClientSize, scaling)); + PixelSize.FromSize(ownerSize, scaling)); Position = ownerRect.CenterRect(rect).Position; } } From bf7f50690f6d0b18516daaba971a44bd17570c33 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Jun 2022 19:06:32 +0200 Subject: [PATCH 268/393] Don't promote layout property values to local values. When DevTools was opened, all layout property values were being promoted to `LocalValue`s because the `_updatingFromControl` flag was not being set during initialization, causing the initial values to be written back out to the control as local values. --- .../ViewModels/ControlLayoutViewModel.cs | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlLayoutViewModel.cs b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlLayoutViewModel.cs index 0c0c005122..a453fef212 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlLayoutViewModel.cs +++ b/src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlLayoutViewModel.cs @@ -30,20 +30,28 @@ namespace Avalonia.Diagnostics.ViewModels if (control is AvaloniaObject ao) { - MarginThickness = ao.GetValue(Layoutable.MarginProperty); - - if (HasPadding) + try { - PaddingThickness = ao.GetValue(Decorator.PaddingProperty); - } + _updatingFromControl = true; + MarginThickness = ao.GetValue(Layoutable.MarginProperty); + + if (HasPadding) + { + PaddingThickness = ao.GetValue(Decorator.PaddingProperty); + } - if (HasBorder) + if (HasBorder) + { + BorderThickness = ao.GetValue(Border.BorderThicknessProperty); + } + + HorizontalAlignment = ao.GetValue(Layoutable.HorizontalAlignmentProperty); + VerticalAlignment = ao.GetValue(Layoutable.VerticalAlignmentProperty); + } + finally { - BorderThickness = ao.GetValue(Border.BorderThicknessProperty); + _updatingFromControl = false; } - - HorizontalAlignment = ao.GetValue(Layoutable.HorizontalAlignmentProperty); - VerticalAlignment = ao.GetValue(Layoutable.VerticalAlignmentProperty); } UpdateSize(); From 1849ca4caa660a172fa16a3e616a58be84d12340 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Tue, 28 Jun 2022 23:50:22 +0300 Subject: [PATCH 269/393] Fixed matrix multiplication order --- .../Rendering/Composition/Server/DrawingContextProxy.cs | 4 ++-- .../Rendering/Composition/Server/ServerVisual.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs index 2fd87f6620..e261507f60 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/DrawingContextProxy.cs @@ -33,7 +33,7 @@ internal class CompositorDrawingContextProxy : IDrawingContextImpl, IDrawingCont set => _visualBrushRenderer.VisualBrushDrawList = value; } - public Matrix PreTransform { get; set; } = Matrix.Identity; + public Matrix PostTransform { get; set; } = Matrix.Identity; public void Dispose() { @@ -44,7 +44,7 @@ internal class CompositorDrawingContextProxy : IDrawingContextImpl, IDrawingCont public Matrix Transform { get => _transform; - set => _impl.Transform = PreTransform * (_transform = value); + set => _impl.Transform = (_transform = value) * PostTransform; } public void Clear(Color color) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs index 06f087258b..3b36dfb87e 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs @@ -41,7 +41,7 @@ namespace Avalonia.Rendering.Composition.Server Root!.RenderedVisuals++; var transform = GlobalTransformMatrix; - canvas.PreTransform = MatrixUtils.ToMatrix(transform); + canvas.PostTransform = MatrixUtils.ToMatrix(transform); canvas.Transform = Matrix.Identity; if (Opacity != 1) canvas.PushOpacity(Opacity); @@ -56,7 +56,7 @@ namespace Avalonia.Rendering.Composition.Server RenderCore(canvas, currentTransformedClip); // Hack to force invalidation of SKMatrix - canvas.PreTransform = MatrixUtils.ToMatrix(transform); + canvas.PostTransform = MatrixUtils.ToMatrix(transform); canvas.Transform = Matrix.Identity; if (OpacityMaskBrush != null) From f6506f19e83d6f8456a86d749324b18bb1cba4ee Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 29 Jun 2022 23:57:03 +0300 Subject: [PATCH 270/393] Fixed Ref finalizer --- src/Avalonia.Base/Utilities/Ref.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Utilities/Ref.cs b/src/Avalonia.Base/Utilities/Ref.cs index 7209f02720..95a1c23883 100644 --- a/src/Avalonia.Base/Utilities/Ref.cs +++ b/src/Avalonia.Base/Utilities/Ref.cs @@ -159,7 +159,7 @@ namespace Avalonia.Utilities ~Ref() { - _counter?.Release(); + Dispose(); } public T Item From b4512e0da8f2334b1a1b2826e600f2386a30a4af Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 30 Jun 2022 00:05:10 +0300 Subject: [PATCH 271/393] Clear the draw list before letting go of the visual --- src/Avalonia.Base/Visual.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Visual.cs b/src/Avalonia.Base/Visual.cs index 7db218d2df..716b5f261d 100644 --- a/src/Avalonia.Base/Visual.cs +++ b/src/Avalonia.Base/Visual.cs @@ -495,7 +495,12 @@ namespace Avalonia DisableTransitions(); OnDetachedFromVisualTree(e); - CompositionVisual = null; + if (CompositionVisual != null) + { + CompositionVisual.DrawList = null; + CompositionVisual = null; + } + DetachedFromVisualTree?.Invoke(this, e); e.Root?.Renderer?.AddDirty(this); From 2edc2ec425c4b1373e08204d7ab01448ca48bca7 Mon Sep 17 00:00:00 2001 From: Lobster Uberlord Date: Thu, 23 Jun 2022 02:42:15 +0700 Subject: [PATCH 272/393] Prevent input focus leaving the TextBox on first click --- src/Web/Avalonia.Web.Blazor/AvaloniaView.razor | 3 ++- src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor index 68662bd931..b501db16d3 100644 --- a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor +++ b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor @@ -5,7 +5,8 @@ @onpointerdown="OnPointerDown" @onpointerup="OnPointerUp" @onpointermove="OnPointerMove" - @onpointercancel="OnPointerCancel"> + @onpointercancel="OnPointerCancel" + @onfocus="OnFocus"> diff --git a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs index b575bc6dbb..d42529985b 100644 --- a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs +++ b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs @@ -37,6 +37,7 @@ namespace Avalonia.Web.Blazor private const SKColorType ColorType = SKColorType.Rgba8888; private bool _initialised; + private bool _inputElementFocused; [Inject] private IJSRuntime Js { get; set; } = null!; @@ -221,6 +222,16 @@ namespace Avalonia.Web.Blazor _topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyUp, e.Code, e.Key, GetModifiers(e)); } + private void OnFocus(FocusEventArgs e) + { + // if focus has unexpectedly moved from the input element to the container element, + // shift it back to the input element + if (_inputElementFocused && _inputHelper is not null) + { + _inputHelper.Focus(); + } + } + private void OnInput(ChangeEventArgs e) { if (e.Value != null) @@ -374,10 +385,12 @@ namespace Avalonia.Web.Blazor if (active) { _inputHelper.Show(); + _inputElementFocused = true; _inputHelper.Focus(); } else { + _inputElementFocused = false; _inputHelper.Hide(); } } From 508fad9d2c333fdca885dbb652665fd994f07d2f Mon Sep 17 00:00:00 2001 From: Lobster Uberlord Date: Wed, 15 Jun 2022 17:27:16 +0700 Subject: [PATCH 273/393] Enable use of Skia Raster backend for HTML canvas in Blazor To enable the raster backend set CustomGpuFactory to null in the existing SkiaOptions, by default Avalonia will use the GPU/GL Skia backend. --- samples/ControlCatalog.Web/App.razor.cs | 1 + .../Avalonia.Web.Blazor/AvaloniaView.razor.cs | 57 ++++++++---- .../BlazorSkiaRasterSurface.cs | 91 +++++++++++++++++++ .../Avalonia.Web.Blazor/BlazorSkiaSurface.cs | 2 +- .../Avalonia.Web.Blazor/IBlazorSkiaSurface.cs | 9 ++ .../RazorViewTopLevelImpl.cs | 7 +- 6 files changed, 149 insertions(+), 18 deletions(-) create mode 100644 src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs create mode 100644 src/Web/Avalonia.Web.Blazor/IBlazorSkiaSurface.cs diff --git a/samples/ControlCatalog.Web/App.razor.cs b/samples/ControlCatalog.Web/App.razor.cs index c0b7ddbe1e..560e8079a6 100644 --- a/samples/ControlCatalog.Web/App.razor.cs +++ b/samples/ControlCatalog.Web/App.razor.cs @@ -11,6 +11,7 @@ public partial class App { ControlCatalog.Pages.EmbedSample.Implementation = new EmbedSampleWeb(); }) + //.With(new SkiaOptions { CustomGpuFactory = null }) // uncomment to disable GPU/GL rendering .SetupWithSingleViewLifetime(); base.OnParametersSet(); diff --git a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs index b575bc6dbb..0e5580ebe4 100644 --- a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs +++ b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs @@ -37,6 +37,7 @@ namespace Avalonia.Web.Blazor private const SKColorType ColorType = SKColorType.Rgba8888; private bool _initialised; + private bool _useGL; [Inject] private IJSRuntime Js { get; set; } = null!; @@ -261,25 +262,44 @@ namespace Avalonia.Web.Blazor _interop = await SKHtmlCanvasInterop.ImportAsync(Js, _htmlCanvas, OnRenderFrame); Console.WriteLine("Interop created"); - _jsGlInfo = _interop.InitGL(); - - Console.WriteLine("jsglinfo created - init gl"); + + var skiaOptions = AvaloniaLocator.Current.GetService(); + _useGL = skiaOptions?.CustomGpuFactory != null; - // create the SkiaSharp context - if (_context == null) + if (_useGL) + { + _jsGlInfo = _interop.InitGL(); + Console.WriteLine("jsglinfo created - init gl"); + } + else { - Console.WriteLine("create glcontext"); - _glInterface = GRGlInterface.Create(); - _context = GRContext.CreateGl(_glInterface); - - var options = AvaloniaLocator.Current.GetService(); - // bump the default resource cache limit - _context.SetResourceCacheLimit(options?.MaxGpuResourceSizeBytes ?? 32 * 1024 * 1024); - Console.WriteLine("glcontext created and resource limit set"); + var rasterInitialized = _interop.InitRaster(); + Console.WriteLine("raster initialized: {0}", rasterInitialized); } - _topLevelImpl.SetSurface(_context, _jsGlInfo, ColorType, - new PixelSize((int)_canvasSize.Width, (int)_canvasSize.Height), _dpi); + if (_useGL) + { + // create the SkiaSharp context + if (_context == null) + { + Console.WriteLine("create glcontext"); + _glInterface = GRGlInterface.Create(); + _context = GRContext.CreateGl(_glInterface); + + + // bump the default resource cache limit + _context.SetResourceCacheLimit(skiaOptions?.MaxGpuResourceSizeBytes ?? 32 * 1024 * 1024); + Console.WriteLine("glcontext created and resource limit set"); + } + + _topLevelImpl.SetSurface(_context, _jsGlInfo!, ColorType, + new PixelSize((int)_canvasSize.Width, (int)_canvasSize.Height), _dpi); + } + else + { + _topLevelImpl.SetSurface(ColorType, + new PixelSize((int)_canvasSize.Width, (int)_canvasSize.Height), _dpi, _interop.PutImageData); + } _interop.SetCanvasSize((int)(_canvasSize.Width * _dpi), (int)(_canvasSize.Height * _dpi)); @@ -301,7 +321,12 @@ namespace Avalonia.Web.Blazor private void OnRenderFrame() { - if (_canvasSize.Width <= 0 || _canvasSize.Height <= 0 || _dpi <= 0 || _jsGlInfo == null) + if (_useGL && (_jsGlInfo == null)) + { + Console.WriteLine("nothing to render"); + return; + } + if (_canvasSize.Width <= 0 || _canvasSize.Height <= 0 || _dpi <= 0) { Console.WriteLine("nothing to render"); return; diff --git a/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs b/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs new file mode 100644 index 0000000000..a286affe04 --- /dev/null +++ b/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs @@ -0,0 +1,91 @@ +using System.Runtime.InteropServices; +using Avalonia.Controls.Platform.Surfaces; +using Avalonia.Platform; +using Avalonia.Skia; +using SkiaSharp; + +namespace Avalonia.Web.Blazor +{ + internal class BlazorSkiaRasterSurface : IBlazorSkiaSurface, IFramebufferPlatformSurface, IDisposable + { + public SKColorType ColorType { get; set; } + + public PixelSize Size { get; set; } + + public double Scaling { get; set; } + + private FramebufferData? _fbData; + private readonly Action _blitCallback; + private readonly Action _onDisposeAction; + + public BlazorSkiaRasterSurface( + SKColorType colorType, PixelSize size, double scaling, Action blitCallback) + { + ColorType = colorType; + Size = size; + Scaling = scaling; + _blitCallback = blitCallback; + _onDisposeAction = Blit; + } + + public void Dispose() + { + _fbData?.Dispose(); + _fbData = null; + } + + public ILockedFramebuffer Lock() + { + var bytesPerPixel = 4; // TODO: derive from ColorType + var dpi = Scaling * 96.0; + var width = (int)(Size.Width * Scaling); + var height = (int)(Size.Height * Scaling); + + if (_fbData is null || _fbData?.Size.Width != width || _fbData?.Size.Height != height) + { + _fbData?.Dispose(); + _fbData = new FramebufferData(width, height, bytesPerPixel); + } + + var pixelFormat = ColorType.ToPixelFormat(); + var data = _fbData.Value; + return new LockedFramebuffer( + data.Address, data.Size, data.RowBytes, + new Vector(dpi, dpi), pixelFormat, _onDisposeAction); + } + + private void Blit() + { + if (_fbData != null) + { + var data = _fbData.Value; + _blitCallback(data.Address, new SKSizeI(data.Size.Width, data.Size.Height)); + } + } + + private readonly struct FramebufferData + { + private readonly byte[]? _data; + private readonly GCHandle _dataHandle; + + public PixelSize Size { get; } + + public int RowBytes { get; } + + public IntPtr Address => _dataHandle.AddrOfPinnedObject(); + + public FramebufferData(int width, int height, int bytesPerPixel) + { + Size = new PixelSize(width, height); + RowBytes = width * bytesPerPixel; + _data = new byte[width * height * bytesPerPixel]; + _dataHandle = GCHandle.Alloc(_data, GCHandleType.Pinned); + } + + public void Dispose() + { + _dataHandle.Free(); + } + } + } +} diff --git a/src/Web/Avalonia.Web.Blazor/BlazorSkiaSurface.cs b/src/Web/Avalonia.Web.Blazor/BlazorSkiaSurface.cs index 512309cfe3..fb49df338b 100644 --- a/src/Web/Avalonia.Web.Blazor/BlazorSkiaSurface.cs +++ b/src/Web/Avalonia.Web.Blazor/BlazorSkiaSurface.cs @@ -3,7 +3,7 @@ using SkiaSharp; namespace Avalonia.Web.Blazor { - internal class BlazorSkiaSurface + internal class BlazorSkiaSurface : IBlazorSkiaSurface { public BlazorSkiaSurface(GRContext context, SKHtmlCanvasInterop.GLInfo glInfo, SKColorType colorType, PixelSize size, double scaling, GRSurfaceOrigin origin) { diff --git a/src/Web/Avalonia.Web.Blazor/IBlazorSkiaSurface.cs b/src/Web/Avalonia.Web.Blazor/IBlazorSkiaSurface.cs new file mode 100644 index 0000000000..5463893e27 --- /dev/null +++ b/src/Web/Avalonia.Web.Blazor/IBlazorSkiaSurface.cs @@ -0,0 +1,9 @@ +namespace Avalonia.Web.Blazor +{ + internal interface IBlazorSkiaSurface + { + public PixelSize Size { get; set; } + + public double Scaling { get; set; } + } +} diff --git a/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs b/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs index a8a1a970dc..e240f1554e 100644 --- a/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs +++ b/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs @@ -16,7 +16,7 @@ namespace Avalonia.Web.Blazor internal class RazorViewTopLevelImpl : ITopLevelImplWithTextInputMethod, ITopLevelImplWithNativeControlHost { private Size _clientSize; - private BlazorSkiaSurface? _currentSurface; + private IBlazorSkiaSurface? _currentSurface; private IInputRoot? _inputRoot; private readonly Stopwatch _sw = Stopwatch.StartNew(); private readonly AvaloniaView _avaloniaView; @@ -40,6 +40,11 @@ namespace Avalonia.Web.Blazor new BlazorSkiaSurface(context, glInfo, colorType, size, scaling, GRSurfaceOrigin.BottomLeft); } + internal void SetSurface(SKColorType colorType, PixelSize size, double scaling, Action blitCallback) + { + _currentSurface = new BlazorSkiaRasterSurface(colorType, size, scaling, blitCallback); + } + public void SetClientSize(SKSize size, double dpi) { var newSize = new Size(size.Width, size.Height); From 2b1eba8c7cb2253dd5791351c69c579daaafe6b5 Mon Sep 17 00:00:00 2001 From: Tako <53405089+Takoooooo@users.noreply.github.com> Date: Thu, 30 Jun 2022 14:09:28 +0300 Subject: [PATCH 274/393] Fix leak in the InternalSelectionModel --- src/Avalonia.Controls/Selection/InternalSelectionModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Selection/InternalSelectionModel.cs b/src/Avalonia.Controls/Selection/InternalSelectionModel.cs index d92ffb0d1a..d0715e402d 100644 --- a/src/Avalonia.Controls/Selection/InternalSelectionModel.cs +++ b/src/Avalonia.Controls/Selection/InternalSelectionModel.cs @@ -168,7 +168,7 @@ namespace Avalonia.Controls.Selection { if (_writableSelectedItems is INotifyCollectionChanged incc) { - incc.CollectionChanged += OnSelectedItemsCollectionChanged; + incc.CollectionChanged -= OnSelectedItemsCollectionChanged; } } From 77dca2c5356b544e57dab77ca563885e00989f0f Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 30 Jun 2022 15:53:07 +0300 Subject: [PATCH 275/393] VerifyAccess --- src/Avalonia.Base/Rendering/Composition/Compositor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Avalonia.Base/Rendering/Composition/Compositor.cs b/src/Avalonia.Base/Rendering/Composition/Compositor.cs index 28c81dfb91..1bdae44cb9 100644 --- a/src/Avalonia.Base/Rendering/Composition/Compositor.cs +++ b/src/Avalonia.Base/Rendering/Composition/Compositor.cs @@ -62,6 +62,7 @@ namespace Avalonia.Rendering.Composition /// A task that completes when sent changes are applied and rendered on the render thread public Task RequestCommitAsync() { + Dispatcher.UIThread.VerifyAccess(); var batch = new Batch(); using (var writer = new BatchStreamWriter(batch.Changes, _batchMemoryPool, _batchObjectPool)) @@ -126,6 +127,7 @@ namespace Avalonia.Rendering.Composition internal void RegisterForSerialization(CompositionObject compositionObject) { + Dispatcher.UIThread.VerifyAccess(); _objectsForSerialization.Add(compositionObject); QueueImplicitBatchCommit(); } From 5c6370aa5600f91ae7077258f503ee5f6ea619bf Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 29 Jun 2022 00:43:45 +0200 Subject: [PATCH 276/393] Don't make ResourceDictionary inherit... ...from `AvaloniaDictionary`. --- .../Controls/ResourceDictionary.cs | 119 ++++++++++++++---- 1 file changed, 98 insertions(+), 21 deletions(-) diff --git a/src/Avalonia.Base/Controls/ResourceDictionary.cs b/src/Avalonia.Base/Controls/ResourceDictionary.cs index 3af14daa83..77863e5101 100644 --- a/src/Avalonia.Base/Controls/ResourceDictionary.cs +++ b/src/Avalonia.Base/Controls/ResourceDictionary.cs @@ -1,38 +1,45 @@ using System; +using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; +using System.Linq; using Avalonia.Collections; -using Avalonia.Metadata; - -#nullable enable namespace Avalonia.Controls { /// /// An indexed dictionary of resources. /// - public class ResourceDictionary : AvaloniaDictionary, IResourceDictionary + public class ResourceDictionary : IResourceDictionary { + private Dictionary? _inner; private IResourceHost? _owner; private AvaloniaList? _mergedDictionaries; /// /// Initializes a new instance of the class. /// - public ResourceDictionary() - { - CollectionChanged += OnCollectionChanged; - } + public ResourceDictionary() { } /// /// Initializes a new instance of the class. /// - public ResourceDictionary(IResourceHost owner) - : this() + public ResourceDictionary(IResourceHost owner) => Owner = owner; + + public int Count => _inner?.Count ?? 0; + + public object? this[object key] { - Owner = owner; + get => _inner?[key]; + set + { + Inner[key] = value; + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); + } } + public ICollection Keys => (ICollection?)_inner?.Keys ?? Array.Empty(); + public ICollection Values => (ICollection?)_inner?.Values ?? Array.Empty(); + public IResourceHost? Owner { get => _owner; @@ -80,7 +87,7 @@ namespace Avalonia.Controls { get { - if (Count > 0) + if (_inner?.Count > 0) { return true; } @@ -100,11 +107,43 @@ namespace Avalonia.Controls } } + bool ICollection>.IsReadOnly => false; + + private Dictionary Inner => _inner ??= new(); + public event EventHandler? OwnerChanged; + public void Add(object key, object? value) + { + Inner.Add(key, value); + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); + } + + public void Clear() + { + if (_inner?.Count > 0) + { + _inner.Clear(); + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); + } + } + + public bool ContainsKey(object key) => _inner?.ContainsKey(key) ?? false; + + public bool Remove(object key) + { + if (_inner?.Remove(key) == true) + { + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); + return true; + } + + return false; + } + public bool TryGetResource(object key, out object? value) { - if (TryGetValue(key, out value)) + if (_inner is not null && _inner.TryGetValue(key, out value)) { return true; } @@ -120,9 +159,52 @@ namespace Avalonia.Controls } } + value = null; return false; } + public bool TryGetValue(object key, out object? value) + { + if (_inner is not null) + return _inner.TryGetValue(key, out value); + value = null; + return false; + } + + + void ICollection>.Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + bool ICollection>.Contains(KeyValuePair item) + { + return (_inner as ICollection>)?.Contains(item) ?? false; + } + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + (_inner as ICollection>)?.CopyTo(array, arrayIndex); + } + + bool ICollection>.Remove(KeyValuePair item) + { + if ((_inner as ICollection>)?.Remove(item) == true) + { + Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); + return true; + } + + return false; + } + + public IEnumerator> GetEnumerator() + { + return _inner?.GetEnumerator() ?? Enumerable.Empty>().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + void IResourceProvider.AddOwner(IResourceHost owner) { owner = owner ?? throw new ArgumentNullException(nameof(owner)); @@ -134,7 +216,7 @@ namespace Avalonia.Controls Owner = owner; - var hasResources = Count > 0; + var hasResources = _inner?.Count > 0; if (_mergedDictionaries is object) { @@ -159,7 +241,7 @@ namespace Avalonia.Controls { Owner = null; - var hasResources = Count > 0; + var hasResources = _inner?.Count > 0; if (_mergedDictionaries is object) { @@ -176,10 +258,5 @@ namespace Avalonia.Controls } } } - - private void OnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) - { - Owner?.NotifyHostedResourcesChanged(ResourcesChangedEventArgs.Empty); - } } } From c26173c4fe8e39b03a961666a94ebf74092f63af Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Jul 2022 16:44:22 +0200 Subject: [PATCH 277/393] Added failing test for #7381. --- .../Rendering/SceneGraph/SceneBuilderTests.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs index 879de9fca5..502575702a 100644 --- a/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs +++ b/tests/Avalonia.Base.UnitTests/Rendering/SceneGraph/SceneBuilderTests.cs @@ -594,6 +594,69 @@ namespace Avalonia.Base.UnitTests.Rendering.SceneGraph } } + [Fact] + public void Should_Update_When_Control_Moved_Causing_Layout_Change() + { + using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) + { + Decorator moveFrom; + Decorator moveTo; + Canvas moveMe; + var tree = new TestRoot + { + Width = 100, + Height = 100, + Child = new DockPanel + { + Children = + { + (moveFrom = new Decorator + { + Child = moveMe = new Canvas + { + Width = 100, + Height = 100, + }, + }), + (moveTo = new Decorator()), + } + } + }; + + tree.Measure(Size.Infinity); + tree.Arrange(new Rect(tree.DesiredSize)); + + var scene = new Scene(tree); + var sceneBuilder = new SceneBuilder(); + sceneBuilder.UpdateAll(scene); + + var moveFromNode = (VisualNode)scene.FindNode(moveFrom); + var moveToNode = (VisualNode)scene.FindNode(moveTo); + + Assert.Equal(1, moveFromNode.Children.Count); + Assert.Same(moveMe, moveFromNode.Children[0].Visual); + Assert.Empty(moveToNode.Children); + + moveFrom.Child = null; + moveTo.Child = moveMe; + tree.LayoutManager.ExecuteLayoutPass(); + + scene = scene.CloneScene(); + moveFromNode = (VisualNode)scene.FindNode(moveFrom); + moveToNode = (VisualNode)scene.FindNode(moveTo); + + moveFromNode.SortChildren(scene); + moveToNode.SortChildren(scene); + sceneBuilder.Update(scene, moveFrom); + sceneBuilder.Update(scene, moveTo); + sceneBuilder.Update(scene, moveMe); + + Assert.Empty(moveFromNode.Children); + Assert.Equal(1, moveToNode.Children.Count); + Assert.Same(moveMe, moveToNode.Children[0].Visual); + } + } + [Fact] public void Should_Update_When_Control_Made_Invisible() { From cfe572f30bb40e749ecbb84cacc9477a35aa86e3 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Jul 2022 16:56:53 +0200 Subject: [PATCH 278/393] Remove node from parent when reparented. When a control was move from one parent container to another, and that move caused the new parent container to be laid out in a different position, a code path was taken which resulted in the `VisualNode` being present under both the old and new containers. Ensure that the node is removed from its old parent in this case. Fixes #7381 Fixes #6103 (probably) --- src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs b/src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs index 5dc426ab06..e4d5a1ca68 100644 --- a/src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs +++ b/src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs @@ -158,6 +158,7 @@ namespace Avalonia.Rendering.SceneGraph if (result != null && result.Parent != parent) { Deindex(scene, result); + ((VisualNode?)result.Parent)?.RemoveChild(result); result = null; } From b4b869a42902431f40766ec0ed276cf2c2db6b18 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 01:22:14 -0400 Subject: [PATCH 279/393] Fix after event were renamed --- samples/ControlCatalog/Pages/PointersPage.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog/Pages/PointersPage.xaml.cs b/samples/ControlCatalog/Pages/PointersPage.xaml.cs index 977cee3d58..b463cf364d 100644 --- a/samples/ControlCatalog/Pages/PointersPage.xaml.cs +++ b/samples/ControlCatalog/Pages/PointersPage.xaml.cs @@ -20,15 +20,15 @@ public class PointersPage : UserControl border1.PointerReleased += Border_PointerReleased; border1.PointerCaptureLost += Border_PointerCaptureLost; border1.PointerMoved += Border_PointerUpdated; - border1.PointerEnter += Border_PointerUpdated; - border1.PointerLeave += Border_PointerUpdated; + border1.PointerEntered += Border_PointerUpdated; + border1.PointerExited += Border_PointerUpdated; border2.PointerPressed += Border_PointerPressed; border2.PointerReleased += Border_PointerReleased; border2.PointerCaptureLost += Border_PointerCaptureLost; border2.PointerMoved += Border_PointerUpdated; - border2.PointerEnter += Border_PointerUpdated; - border2.PointerLeave += Border_PointerUpdated; + border2.PointerEntered += Border_PointerUpdated; + border2.PointerExited += Border_PointerUpdated; } private void Border_PointerUpdated(object sender, PointerEventArgs e) From 17562c16bd25f3b325ff23e4380aecc0c877cc3d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 03:43:08 -0400 Subject: [PATCH 280/393] Fixes after review --- samples/ControlCatalog/Pages/PointerCanvas.cs | 22 +++++- .../ControlCatalog/Pages/PointersPage.xaml | 1 + .../ControlCatalog/Pages/PointersPage.xaml.cs | 6 +- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 75 ++++++++++++------- 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/samples/ControlCatalog/Pages/PointerCanvas.cs b/samples/ControlCatalog/Pages/PointerCanvas.cs index b815a573f2..5843b13a0c 100644 --- a/samples/ControlCatalog/Pages/PointerCanvas.cs +++ b/samples/ControlCatalog/Pages/PointerCanvas.cs @@ -19,6 +19,7 @@ public class PointerCanvas : Control private IDisposable? _statusUpdated; private Dictionary _pointers = new(); private PointerPointProperties? _lastProperties; + private PointerUpdateKind? _lastNonOtherUpdateKind; class PointerPoints { struct CanvasPoint @@ -128,10 +129,11 @@ public class PointerCanvas : Control _statusUpdated = DispatcherTimer.Run(() => { - if (_stopwatch.Elapsed.TotalSeconds > 1) + if (_stopwatch.Elapsed.TotalMilliseconds > 250) { Status = $@"Events per second: {(_events / _stopwatch.Elapsed.TotalSeconds)} PointerUpdateKind: {_lastProperties?.PointerUpdateKind} +Last PointerUpdateKind != Other: {_lastNonOtherUpdateKind} IsLeftButtonPressed: {_lastProperties?.IsLeftButtonPressed} IsRightButtonPressed: {_lastProperties?.IsRightButtonPressed} IsMiddleButtonPressed: {_lastProperties?.IsMiddleButtonPressed} @@ -162,21 +164,27 @@ Twist: {_lastProperties?.Twist}"; void HandleEvent(PointerEventArgs e) { _events++; + if (_threadSleep != 0) { Thread.Sleep(_threadSleep); } InvalidateVisual(); + var lastPointer = e.GetCurrentPoint(this); + _lastProperties = lastPointer.Properties; + + if (_lastProperties.PointerUpdateKind != PointerUpdateKind.Other) + { + _lastNonOtherUpdateKind = _lastProperties.PointerUpdateKind; + } + if (e.RoutedEvent == PointerReleasedEvent && e.Pointer.Type == PointerType.Touch) { _pointers.Remove(e.Pointer.Id); return; } - var lastPointer = e.GetCurrentPoint(this); - _lastProperties = lastPointer.Properties; - if (e.Pointer.Type != PointerType.Pen || lastPointer.Properties.Pressure > 0) { @@ -218,4 +226,10 @@ Twist: {_lastProperties?.Twist}"; HandleEvent(e); base.OnPointerReleased(e); } + + protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) + { + _lastProperties = null; + base.OnPointerCaptureLost(e); + } } diff --git a/samples/ControlCatalog/Pages/PointersPage.xaml b/samples/ControlCatalog/Pages/PointersPage.xaml index 1281ec77b6..c39106f29e 100644 --- a/samples/ControlCatalog/Pages/PointersPage.xaml +++ b/samples/ControlCatalog/Pages/PointersPage.xaml @@ -19,6 +19,7 @@ diff --git a/samples/ControlCatalog/Pages/PointersPage.xaml.cs b/samples/ControlCatalog/Pages/PointersPage.xaml.cs index b463cf364d..6fc468e37f 100644 --- a/samples/ControlCatalog/Pages/PointersPage.xaml.cs +++ b/samples/ControlCatalog/Pages/PointersPage.xaml.cs @@ -35,7 +35,8 @@ public class PointersPage : UserControl { var textBlock = (TextBlock)((Border)sender).Child; var position = e.GetPosition((Border)sender); - textBlock.Text = @$"Captured: {e.Pointer.Captured == sender} + textBlock.Text = @$"Type: {e.Pointer.Type} +Captured: {e.Pointer.Captured == sender} PointerId: {e.Pointer.Id} Position: {(int)position.X} {(int)position.Y}"; e.Handled = true; @@ -44,7 +45,8 @@ Position: {(int)position.X} {(int)position.Y}"; private void Border_PointerCaptureLost(object sender, PointerCaptureLostEventArgs e) { var textBlock = (TextBlock)((Border)sender).Child; - textBlock.Text = @$"Captured: {e.Pointer.Captured == sender} + textBlock.Text = @$"Type: {e.Pointer.Type} +Captured: {e.Pointer.Captured == sender} PointerId: {e.Pointer.Id} Position: ??? ???"; e.Handled = true; diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 861110bf9a..2ce4d7d1f0 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -746,7 +746,6 @@ namespace Avalonia.Win32 { if (GetPointerPenInfoHistory(info.pointerId, ref historyCount, s_historyPenInfos)) { - uint timestamp = 0; for (int i = historyCount - 1; i >= 1; i--) { var historyPenInfo = s_historyPenInfos[i]; @@ -830,7 +829,7 @@ namespace Avalonia.Win32 timestamp = info.dwTime; } - modifiers |= GetInputModifiers(info.dwKeyStates); + modifiers |= GetInputModifiers(info.pointerFlags); } private RawPointerPoint CreateRawPointerPoint(POINTER_INFO pointerInfo) @@ -871,48 +870,40 @@ namespace Avalonia.Win32 private static RawPointerEventType GetEventType(WindowsMessage message, POINTER_INFO info) { - if (message == WindowsMessage.WM_POINTERUPDATE) + var isTouch = info.pointerType == PointerInputType.PT_TOUCH; + if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED)) { - return info.pointerType == PointerInputType.PT_TOUCH - ? RawPointerEventType.TouchUpdate - : RawPointerEventType.Move; + return isTouch ? RawPointerEventType.TouchCancel : RawPointerEventType.LeaveWindow; } - switch (info.pointerType) + + var eventType = ToEventType(info.ButtonChangeType, isTouch); + if (eventType == RawPointerEventType.LeftButtonDown && + message == WindowsMessage.WM_NCPOINTERDOWN) { - case PointerInputType.PT_TOUCH: - if (info.pointerFlags.HasFlag(PointerFlags.POINTER_FLAG_CANCELED)) - { - return RawPointerEventType.TouchCancel; - } - return message == WindowsMessage.WM_POINTERDOWN || message == WindowsMessage.WM_NCPOINTERDOWN - ? RawPointerEventType.TouchBegin - : RawPointerEventType.TouchEnd; - default: - var eventType = ToEventType(info.ButtonChangeType); - if (eventType == RawPointerEventType.LeftButtonDown && - message == WindowsMessage.WM_NCPOINTERDOWN) - { - eventType = RawPointerEventType.NonClientLeftButtonDown; - } - return eventType; + eventType = RawPointerEventType.NonClientLeftButtonDown; } + + return eventType; } - private static RawPointerEventType ToEventType(PointerButtonChangeType type) + private static RawPointerEventType ToEventType(PointerButtonChangeType type, bool isTouch) { return type switch { - PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN => RawPointerEventType.LeftButtonDown, + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN when isTouch => RawPointerEventType.TouchBegin, + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_DOWN when !isTouch => RawPointerEventType.LeftButtonDown, PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_DOWN => RawPointerEventType.RightButtonDown, PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_DOWN => RawPointerEventType.MiddleButtonDown, PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_DOWN => RawPointerEventType.XButton1Down, PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_DOWN => RawPointerEventType.XButton2Down, - PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP => RawPointerEventType.LeftButtonUp, + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP when isTouch => RawPointerEventType.TouchEnd, + PointerButtonChangeType.POINTER_CHANGE_FIRSTBUTTON_UP when !isTouch => RawPointerEventType.LeftButtonUp, PointerButtonChangeType.POINTER_CHANGE_SECONDBUTTON_UP => RawPointerEventType.RightButtonUp, PointerButtonChangeType.POINTER_CHANGE_THIRDBUTTON_UP => RawPointerEventType.MiddleButtonUp, PointerButtonChangeType.POINTER_CHANGE_FOURTHBUTTON_UP => RawPointerEventType.XButton1Up, PointerButtonChangeType.POINTER_CHANGE_FIFTHBUTTON_UP => RawPointerEventType.XButton2Up, + _ when isTouch => RawPointerEventType.TouchUpdate, _ => RawPointerEventType.Move }; } @@ -1000,5 +991,37 @@ namespace Avalonia.Win32 return modifiers; } + + private static RawInputModifiers GetInputModifiers(PointerFlags flags) + { + var modifiers = WindowsKeyboardDevice.Instance.Modifiers; + + if (flags.HasAllFlags(PointerFlags.POINTER_FLAG_FIRSTBUTTON)) + { + modifiers |= RawInputModifiers.LeftMouseButton; + } + + if (flags.HasAllFlags(PointerFlags.POINTER_FLAG_SECONDBUTTON)) + { + modifiers |= RawInputModifiers.RightMouseButton; + } + + if (flags.HasAllFlags(PointerFlags.POINTER_FLAG_THIRDBUTTON)) + { + modifiers |= RawInputModifiers.MiddleMouseButton; + } + + if (flags.HasAllFlags(PointerFlags.POINTER_FLAG_FOURTHBUTTON)) + { + modifiers |= RawInputModifiers.XButton1MouseButton; + } + + if (flags.HasAllFlags(PointerFlags.POINTER_FLAG_FIFTHBUTTON)) + { + modifiers |= RawInputModifiers.XButton2MouseButton; + } + + return modifiers; + } } } From 1c8b26bcde086be143bb25140e11f3ed97562469 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 03:46:28 -0400 Subject: [PATCH 281/393] Fix YTilt --- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 2ce4d7d1f0..a2f9b7886a 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -864,7 +864,7 @@ namespace Avalonia.Win32 Pressure = info.pressure / 1024f, Twist = info.rotation, XTilt = info.tiltX, - YTilt = info.tiltX + YTilt = info.tiltY }; } From 5b77b7d24bab22929c38f5303cd5bd34262ff474 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sat, 2 Jul 2022 13:55:09 +0300 Subject: [PATCH 282/393] UseComposition -> UseCompositor --- samples/ControlCatalog.NetCore/Program.cs | 2 +- src/Avalonia.Headless.Vnc/HeadlessVncPlatformExtensions.cs | 2 +- src/Avalonia.Headless/AvaloniaHeadlessPlatform.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index df7ae67ef4..7423428a0a 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -56,7 +56,7 @@ namespace ControlCatalog.NetCore .UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = true, - UseComposition = true + UseCompositor = true }) .AfterSetup(_ => { diff --git a/src/Avalonia.Headless.Vnc/HeadlessVncPlatformExtensions.cs b/src/Avalonia.Headless.Vnc/HeadlessVncPlatformExtensions.cs index 02a1e57701..cc7d5ef30d 100644 --- a/src/Avalonia.Headless.Vnc/HeadlessVncPlatformExtensions.cs +++ b/src/Avalonia.Headless.Vnc/HeadlessVncPlatformExtensions.cs @@ -22,7 +22,7 @@ namespace Avalonia return builder .UseHeadless(new AvaloniaHeadlessPlatformOptions { - UseComposition = true, + UseCompositor = true, UseHeadlessDrawing = false }) .AfterSetup(_ => diff --git a/src/Avalonia.Headless/AvaloniaHeadlessPlatform.cs b/src/Avalonia.Headless/AvaloniaHeadlessPlatform.cs index d957b99747..fe9283b26f 100644 --- a/src/Avalonia.Headless/AvaloniaHeadlessPlatform.cs +++ b/src/Avalonia.Headless/AvaloniaHeadlessPlatform.cs @@ -73,7 +73,7 @@ namespace Avalonia.Headless .Bind().ToSingleton() .Bind().ToConstant(new HeadlessWindowingPlatform()) .Bind().ToSingleton(); - if (opts.UseComposition) + if (opts.UseCompositor) Compositor = new Compositor(AvaloniaLocator.Current.GetRequiredService(), null); } @@ -89,7 +89,7 @@ namespace Avalonia.Headless public class AvaloniaHeadlessPlatformOptions { - public bool UseComposition { get; set; } = true; + public bool UseCompositor { get; set; } = true; public bool UseHeadlessDrawing { get; set; } = true; } From 5000a4ffe35699233e1bd7039a9e380718e93994 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 18:17:35 -0400 Subject: [PATCH 283/393] Do not enable MouseInPointerEnabled automatically and remove EnableWmPointerEvents option --- .editorconfig | 2 +- samples/ControlCatalog.NetCore/Program.cs | 1 - src/Windows/Avalonia.Win32/Win32Platform.cs | 10 +---- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 42 ++++++++++--------- src/Windows/Avalonia.Win32/WindowImpl.cs | 20 ++++----- 5 files changed, 33 insertions(+), 42 deletions(-) diff --git a/.editorconfig b/.editorconfig index cb589a5ce1..30edee1633 100644 --- a/.editorconfig +++ b/.editorconfig @@ -21,7 +21,7 @@ csharp_new_line_before_finally = true csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_between_query_expression_clauses = true -trim_trailing_whitespace = true +# trim_trailing_whitespace = true # Indentation preferences csharp_indent_block_contents = true diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index d6a297858d..13751b56b5 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -115,7 +115,6 @@ namespace ControlCatalog.NetCore }) .With(new Win32PlatformOptions { - EnableWmPointerEvents = true }) .UseSkia() .AfterSetup(builder => diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index aa597d6809..8f6993c040 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -68,17 +68,9 @@ namespace Avalonia /// /// Multitouch allows a surface (a touchpad or touchscreen) to recognize the presence of more than one point of contact with the surface at the same time. /// - [Obsolete("Multitouch is always enabled")] + [Obsolete("Multitouch is always enabled on supported Windows versions")] public bool? EnableMultitouch { get; set; } = true; - /// - /// Enables Win8+ WM_POINTER events support. The default value is false. - /// - /// - /// Required for extended Pen and Touch support. - /// - public bool? EnableWmPointerEvents { get; set; } = false; - /// /// Embeds popups to the window when set to true. The default value is false. /// diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index a2f9b7886a..4c7b9a0348 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -84,7 +84,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_DESTROY: { UiaCoreProviderApi.UiaReturnRawElementProvider(_hwnd, IntPtr.Zero, IntPtr.Zero, null); - + // We need to release IMM context and state to avoid leaks. if (Imm32InputMethod.Current.HWND == _hwnd) { @@ -110,9 +110,9 @@ namespace Avalonia.Win32 var newDisplayRect = Marshal.PtrToStructure(lParam); _scaling = dpi / 96.0; ScalingChanged?.Invoke(_scaling); - + using (SetResizeReason(PlatformResizeReason.DpiChange)) - { + { SetWindowPos(hWnd, IntPtr.Zero, newDisplayRect.left, @@ -180,7 +180,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONDOWN: case WindowsMessage.WM_XBUTTONDOWN: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -213,7 +213,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MBUTTONUP: case WindowsMessage.WM_XBUTTONUP: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -241,12 +241,16 @@ namespace Avalonia.Win32 } // Mouse capture is lost case WindowsMessage.WM_CANCELMODE: - _mouseDevice.Capture(null); + if (!IsMouseInPointerEnabled) + { + _mouseDevice.Capture(null); + } + break; case WindowsMessage.WM_MOUSEMOVE: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -273,7 +277,7 @@ namespace Avalonia.Win32 timestamp, _owner, RawPointerEventType.Move, - DipFromLParam(lParam), + DipFromLParam(lParam), GetMouseModifiers(wParam)); break; @@ -281,7 +285,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_MOUSEWHEEL: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -290,14 +294,14 @@ namespace Avalonia.Win32 timestamp, _owner, PointToClient(PointFromLParam(lParam)), - new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta), + new Vector(0, (ToInt32(wParam) >> 16) / wheelDelta), GetMouseModifiers(wParam)); break; } case WindowsMessage.WM_MOUSEHWHEEL: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -306,14 +310,14 @@ namespace Avalonia.Win32 timestamp, _owner, PointToClient(PointFromLParam(lParam)), - new Vector(-(ToInt32(wParam) >> 16) / wheelDelta, 0), + new Vector(-(ToInt32(wParam) >> 16) / wheelDelta, 0), GetMouseModifiers(wParam)); break; } case WindowsMessage.WM_MOUSELEAVE: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -323,7 +327,7 @@ namespace Avalonia.Win32 timestamp, _owner, RawPointerEventType.LeaveWindow, - new Point(-1, -1), + new Point(-1, -1), WindowsKeyboardDevice.Instance.Modifiers); break; } @@ -333,7 +337,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCMBUTTONDOWN: case WindowsMessage.WM_NCXBUTTONDOWN: { - if (_wmPointerEnabled) + if (IsMouseInPointerEnabled) { break; } @@ -598,7 +602,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_GETMINMAXINFO: { MINMAXINFO mmi = Marshal.PtrToStructure(lParam); - + _maxTrackSize = mmi.ptMaxTrackSize; if (_minSize.Width > 0) @@ -682,7 +686,7 @@ namespace Avalonia.Win32 if (_managedDrag.PreprocessInputEvent(ref e)) return UnmanagedMethods.DefWindowProc(hWnd, msg, wParam, lParam); #endif - + if(shouldTakeFocus) { SetFocus(_hwnd); @@ -915,11 +919,11 @@ namespace Avalonia.Win32 if (langid == _langid && Imm32InputMethod.Current.HWND == Hwnd) { return; - } + } _langid = langid; Imm32InputMethod.Current.SetLanguageAndWindow(this, Hwnd, hkl); - + } private static int ToInt32(IntPtr ptr) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 95dac19d04..31f30a6e47 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -74,12 +74,12 @@ namespace Avalonia.Win32 private readonly ManagedDeferredRendererLock _rendererLock; private readonly FramebufferManager _framebuffer; private readonly IGlPlatformSurface _gl; + private readonly bool _wmPointerEnabled; private Win32NativeControlHost _nativeControlHost; private WndProc _wndProcDelegate; private string _className; private IntPtr _hwnd; - private bool _wmPointerEnabled; private IInputRoot _owner; private WindowProperties _windowProperties; private bool _trackingMouse;//ToDo - there is something missed. Needs investigation @Steven Kirk @@ -100,10 +100,10 @@ namespace Avalonia.Win32 private bool _ignoreWmChar; private const int MaxPointerHistorySize = 512; - private readonly static PooledList s_intermediatePointsPooledList = new(); - private readonly static POINTER_TOUCH_INFO[] s_historyTouchInfos = new POINTER_TOUCH_INFO[MaxPointerHistorySize]; - private readonly static POINTER_PEN_INFO[] s_historyPenInfos = new POINTER_PEN_INFO[MaxPointerHistorySize]; - private readonly static POINTER_INFO[] s_historyInfos = new POINTER_INFO[MaxPointerHistorySize]; + private static readonly PooledList s_intermediatePointsPooledList = new(); + private static readonly POINTER_TOUCH_INFO[] s_historyTouchInfos = new POINTER_TOUCH_INFO[MaxPointerHistorySize]; + private static readonly POINTER_PEN_INFO[] s_historyPenInfos = new POINTER_PEN_INFO[MaxPointerHistorySize]; + private static readonly POINTER_INFO[] s_historyInfos = new POINTER_INFO[MaxPointerHistorySize]; public WindowImpl() { @@ -138,13 +138,7 @@ namespace Avalonia.Win32 egl.Display is AngleWin32EglDisplay angleDisplay && angleDisplay.PlatformApi == AngleOptions.PlatformApi.DirectX11; - _wmPointerEnabled = Win32Platform.Options.EnableWmPointerEvents - ?? Win32Platform.WindowsVersion >= PlatformConstants.Windows8; - - if (_wmPointerEnabled && !IsMouseInPointerEnabled()) - { - EnableMouseInPointer(true); - } + _wmPointerEnabled = Win32Platform.WindowsVersion >= PlatformConstants.Windows8; CreateWindow(); _framebuffer = new FramebufferManager(_hwnd); @@ -300,6 +294,8 @@ namespace Avalonia.Win32 protected IntPtr Hwnd => _hwnd; + private bool IsMouseInPointerEnabled => _wmPointerEnabled && IsMouseInPointerEnabled(); + public void SetTransparencyLevelHint(WindowTransparencyLevel transparencyLevel) { TransparencyLevel = EnableBlur(transparencyLevel); From 0e78f8afdad62455bb1b50153e813def5fe638a5 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 19:34:50 -0400 Subject: [PATCH 284/393] Pen support for Browser backend --- .../Avalonia.Web.Blazor/AvaloniaView.razor.cs | 143 ++++++++---------- .../RazorViewTopLevelImpl.cs | 29 +++- 2 files changed, 81 insertions(+), 91 deletions(-) diff --git a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs index b575bc6dbb..c76c0453db 100644 --- a/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs +++ b/src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.JSInterop; using SkiaSharp; +using HTMLPointerEventArgs = Microsoft.AspNetCore.Components.Web.PointerEventArgs; namespace Avalonia.Web.Blazor { @@ -57,120 +58,85 @@ namespace Avalonia.Web.Blazor return _nativeControlHost ?? throw new InvalidOperationException("Blazor View wasn't initialized yet"); } - private void OnPointerCancel(Microsoft.AspNetCore.Components.Web.PointerEventArgs e) + private void OnPointerCancel(HTMLPointerEventArgs e) { if (e.PointerType == "touch") { - _topLevelImpl.RawTouchEvent(RawPointerEventType.TouchCancel, new Point(e.ClientX, e.ClientY), + _topLevelImpl.RawPointerEvent(RawPointerEventType.TouchCancel, e.PointerType, GetPointFromEventArgs(e), GetModifiers(e), e.PointerId); } } - private void OnPointerMove(Microsoft.AspNetCore.Components.Web.PointerEventArgs e) + private void OnPointerMove(HTMLPointerEventArgs e) { - if (e.PointerType == "touch") + var type = e.PointerType switch { - _topLevelImpl.RawTouchEvent(RawPointerEventType.TouchUpdate, new Point(e.ClientX, e.ClientY), - GetModifiers(e), e.PointerId); - } - else - { - _topLevelImpl.RawMouseEvent(RawPointerEventType.Move, new Point(e.ClientX, e.ClientY), GetModifiers(e)); - } + "touch" => RawPointerEventType.TouchUpdate, + _ => RawPointerEventType.Move + }; + + _topLevelImpl.RawPointerEvent(type, e.PointerType, GetPointFromEventArgs(e), GetModifiers(e), e.PointerId); } - private void OnPointerUp(Microsoft.AspNetCore.Components.Web.PointerEventArgs e) + private void OnPointerUp(HTMLPointerEventArgs e) { - if (e.PointerType == "touch") + var type = e.PointerType switch { - _topLevelImpl.RawTouchEvent(RawPointerEventType.TouchEnd, new Point(e.ClientX, e.ClientY), - GetModifiers(e), e.PointerId); - } - else - { - RawPointerEventType type = default; - - switch (e.Button) + "touch" => RawPointerEventType.TouchEnd, + _ => e.Button switch { - case 0: - type = RawPointerEventType.LeftButtonUp; - break; - - case 1: - type = RawPointerEventType.MiddleButtonUp; - break; - - case 2: - type = RawPointerEventType.RightButtonUp; - break; + 0 => RawPointerEventType.LeftButtonUp, + 1 => RawPointerEventType.MiddleButtonUp, + 2 => RawPointerEventType.RightButtonUp, + 3 => RawPointerEventType.XButton1Up, + 4 => RawPointerEventType.XButton2Up, + // 5 => Pen eraser button, + _ => RawPointerEventType.Move } + }; - _topLevelImpl.RawMouseEvent(type, new Point(e.ClientX, e.ClientY), GetModifiers(e)); - } + _topLevelImpl.RawPointerEvent(type, e.PointerType, GetPointFromEventArgs(e), GetModifiers(e), e.PointerId); } - private void OnPointerDown(Microsoft.AspNetCore.Components.Web.PointerEventArgs e) + private void OnPointerDown(HTMLPointerEventArgs e) { - if (e.PointerType == "touch") - { - _topLevelImpl.RawTouchEvent(RawPointerEventType.TouchBegin, new Point(e.ClientX, e.ClientY), - GetModifiers(e), e.PointerId); - } - else + var type = e.PointerType switch { - RawPointerEventType type = default; - - switch (e.Button) + "touch" => RawPointerEventType.TouchBegin, + _ => e.Button switch { - case 0: - type = RawPointerEventType.LeftButtonDown; - break; - - case 1: - type = RawPointerEventType.MiddleButtonDown; - break; - - case 2: - type = RawPointerEventType.RightButtonDown; - break; + 0 => RawPointerEventType.LeftButtonDown, + 1 => RawPointerEventType.MiddleButtonDown, + 2 => RawPointerEventType.RightButtonDown, + 3 => RawPointerEventType.XButton1Down, + 4 => RawPointerEventType.XButton2Down, + // 5 => Pen eraser button, + _ => RawPointerEventType.Move } + }; - _topLevelImpl.RawMouseEvent(type, new Point(e.ClientX, e.ClientY), GetModifiers(e)); - } + _topLevelImpl.RawPointerEvent(type, e.PointerType, GetPointFromEventArgs(e), GetModifiers(e), e.PointerId); } - private void OnWheel(WheelEventArgs e) + private static RawPointerPoint GetPointFromEventArgs(HTMLPointerEventArgs args) { - _topLevelImpl.RawMouseWheelEvent(new Point(e.ClientX, e.ClientY), - new Vector(-(e.DeltaX / 50), -(e.DeltaY / 50)), GetModifiers(e)); + return new RawPointerPoint + { + Position = new Point(args.ClientX, args.ClientY), + Pressure = args.Pressure, + XTilt = args.TiltX, + YTilt = args.TiltY + // Twist = args.Twist - read from JS code directly when + }; } - private static RawInputModifiers GetModifiers(WheelEventArgs e) + private void OnWheel(WheelEventArgs e) { - var modifiers = RawInputModifiers.None; - - if (e.CtrlKey) - modifiers |= RawInputModifiers.Control; - if (e.AltKey) - modifiers |= RawInputModifiers.Alt; - if (e.ShiftKey) - modifiers |= RawInputModifiers.Shift; - if (e.MetaKey) - modifiers |= RawInputModifiers.Meta; - - if ((e.Buttons & 1L) == 1) - modifiers |= RawInputModifiers.LeftMouseButton; - - if ((e.Buttons & 2L) == 2) - modifiers |= RawInputModifiers.RightMouseButton; - - if ((e.Buttons & 4L) == 4) - modifiers |= RawInputModifiers.MiddleMouseButton; - - return modifiers; + _topLevelImpl.RawMouseWheelEvent( new Point(e.ClientX, e.ClientY), + new Vector(-(e.DeltaX / 50), -(e.DeltaY / 50)), GetModifiers(e)); } - private static RawInputModifiers GetModifiers(Microsoft.AspNetCore.Components.Web.PointerEventArgs e) + private static RawInputModifiers GetModifiers(MouseEventArgs e) { var modifiers = RawInputModifiers.None; @@ -187,10 +153,19 @@ namespace Avalonia.Web.Blazor modifiers |= RawInputModifiers.LeftMouseButton; if ((e.Buttons & 2L) == 2) - modifiers |= RawInputModifiers.RightMouseButton; + modifiers |= e.Type == "pen" ? RawInputModifiers.PenBarrelButton : RawInputModifiers.RightMouseButton; if ((e.Buttons & 4L) == 4) modifiers |= RawInputModifiers.MiddleMouseButton; + + if ((e.Buttons & 8L) == 8) + modifiers |= RawInputModifiers.XButton1MouseButton; + + if ((e.Buttons & 16L) == 16) + modifiers |= RawInputModifiers.XButton2MouseButton; + + if ((e.Buttons & 32L) == 32) + modifiers |= RawInputModifiers.PenEraser; return modifiers; } diff --git a/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs b/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs index a8a1a970dc..ba81d1b084 100644 --- a/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs +++ b/src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs @@ -21,6 +21,7 @@ namespace Avalonia.Web.Blazor private readonly Stopwatch _sw = Stopwatch.StartNew(); private readonly AvaloniaView _avaloniaView; private readonly TouchDevice _touchDevice; + private readonly PenDevice _penDevice; private string _currentCursor = CssCursor.Default; public RazorViewTopLevelImpl(AvaloniaView avaloniaView) @@ -29,6 +30,7 @@ namespace Avalonia.Web.Blazor TransparencyLevel = WindowTransparencyLevel.None; AcrylicCompensationLevels = new AcrylicPlatformCompensationLevels(1, 1, 1); _touchDevice = new TouchDevice(); + _penDevice = new PenDevice(); } public ulong Timestamp => (ulong)_sw.ElapsedMilliseconds; @@ -67,20 +69,33 @@ namespace Avalonia.Web.Blazor } } - public void RawTouchEvent(RawPointerEventType type, Point p, RawInputModifiers modifiers, long touchPointId) + public void RawPointerEvent( + RawPointerEventType eventType, string pointerType, + RawPointerPoint p, RawInputModifiers modifiers, long touchPointId) { - if (_inputRoot is { }) + if (_inputRoot is { } + && Input is { } input) { - Input?.Invoke(new RawTouchEventArgs(_touchDevice, Timestamp, _inputRoot, type, p, modifiers, touchPointId)); + var device = GetPointerDevice(pointerType); + var args = device is TouchDevice ? + new RawTouchEventArgs(device, Timestamp, _inputRoot, eventType, p, modifiers, touchPointId) : + new RawPointerEventArgs(device, Timestamp, _inputRoot, eventType, p, modifiers) + { + RawPointerId = touchPointId + }; + + input.Invoke(args); } } - public void RawMouseEvent(RawPointerEventType type, Point p, RawInputModifiers modifiers) + private IPointerDevice GetPointerDevice(string pointerType) { - if (_inputRoot is { }) + return pointerType switch { - Input?.Invoke(new RawPointerEventArgs(MouseDevice, Timestamp, _inputRoot, type, p, modifiers)); - } + "touch" => _touchDevice, + "pen" => _penDevice, + _ => MouseDevice + }; } public void RawMouseWheelEvent(Point p, Vector v, RawInputModifiers modifiers) From 6c2b145189115f557e64941d75b571606e76b9ca Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 2 Jul 2022 19:52:39 -0400 Subject: [PATCH 285/393] Remove DottedLineFocusAdorner --- .../Controls/FocusAdorner.xaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml b/src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml index e6577497da..91bf71ed4d 100644 --- a/src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml @@ -19,16 +19,4 @@ - - - From aa5dc3e0f59e673bb089707008ad94c1da807112 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 2 Jul 2022 23:01:37 +0200 Subject: [PATCH 286/393] Added class selector style benchmarks. --- .../Styling/Style_ClassSelector.cs | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/Avalonia.Benchmarks/Styling/Style_ClassSelector.cs diff --git a/tests/Avalonia.Benchmarks/Styling/Style_ClassSelector.cs b/tests/Avalonia.Benchmarks/Styling/Style_ClassSelector.cs new file mode 100644 index 0000000000..f242e95966 --- /dev/null +++ b/tests/Avalonia.Benchmarks/Styling/Style_ClassSelector.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Avalonia.Controls; +using Avalonia.Styling; +using BenchmarkDotNet.Attributes; + +#nullable enable + +namespace Avalonia.Benchmarks.Styling +{ + [MemoryDiagnoser] + public class Style_ClassSelector + { + private Style _style = null!; + + public Style_ClassSelector() + { + RuntimeHelpers.RunClassConstructor(typeof(TestClass).TypeHandle); + } + + [GlobalSetup] + public void Setup() + { + _style = new Style(x => x.OfType().Class("foo")) + { + Setters = { new Setter(TestClass.StringProperty, "foo") } + }; + } + + [Benchmark(OperationsPerInvoke = 50)] + public void Apply() + { + var target = new TestClass(); + + target.BeginBatchUpdate(); + + for (var i = 0; i < 50; ++i) + _style.TryAttach(target, null); + + target.EndBatchUpdate(); + } + + [Benchmark(OperationsPerInvoke = 50)] + public void Apply_Toggle() + { + var target = new TestClass(); + + target.BeginBatchUpdate(); + + for (var i = 0; i < 50; ++i) + _style.TryAttach(target, null); + + target.EndBatchUpdate(); + + target.Classes.Add("foo"); + target.Classes.Remove("foo"); + } + + [Benchmark(OperationsPerInvoke = 50)] + public void Apply_Detach() + { + var target = new TestClass(); + + target.BeginBatchUpdate(); + + for (var i = 0; i < 50; ++i) + _style.TryAttach(target, null); + + target.EndBatchUpdate(); + + target.DetachStyles(); + } + + private class TestClass : Control + { + public static readonly StyledProperty StringProperty = + AvaloniaProperty.Register("String"); + public void DetachStyles() => InvalidateStyles(); + } + + private class TestClass2 : Control + { + } + } +} From e63aa46458022a4a8974afe1eb1792ec7d1968c3 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 3 Jul 2022 00:14:04 +0200 Subject: [PATCH 287/393] Add a more efficient way to listen to classes changes. Improves the situation in e.g. #8389 drastically. --- src/Avalonia.Base/Controls/Classes.cs | 53 ++++++++++++++++++- .../Controls/IClassesChangedListener.cs | 14 +++++ .../Styling/Activators/StyleClassActivator.cs | 26 ++++----- .../Styling/TypeNameAndClassSelector.cs | 3 +- .../Styling/SelectorTests_Template.cs | 5 +- tests/Avalonia.LeakTests/ControlTests.cs | 2 +- 6 files changed, 80 insertions(+), 23 deletions(-) create mode 100644 src/Avalonia.Base/Controls/IClassesChangedListener.cs diff --git a/src/Avalonia.Base/Controls/Classes.cs b/src/Avalonia.Base/Controls/Classes.cs index 50605661fa..e64209c3cb 100644 --- a/src/Avalonia.Base/Controls/Classes.cs +++ b/src/Avalonia.Base/Controls/Classes.cs @@ -14,6 +14,8 @@ namespace Avalonia.Controls /// public class Classes : AvaloniaList, IPseudoClasses { + private List? _listeners; + /// /// Initializes a new instance of the class. /// @@ -39,6 +41,11 @@ namespace Avalonia.Controls { } + /// + /// Gets the number of listeners subscribed to this collection for unit testing purposes. + /// + internal int ListenerCount => _listeners?.Count ?? 0; + /// /// Parses a classes string. /// @@ -62,6 +69,7 @@ namespace Avalonia.Controls if (!Contains(name)) { base.Add(name); + NotifyChanged(); } } @@ -89,6 +97,7 @@ namespace Avalonia.Controls } base.AddRange(c); + NotifyChanged(); } /// @@ -103,6 +112,8 @@ namespace Avalonia.Controls RemoveAt(i); } } + + NotifyChanged(); } /// @@ -122,6 +133,7 @@ namespace Avalonia.Controls if (!Contains(name)) { base.Insert(index, name); + NotifyChanged(); } } @@ -154,6 +166,7 @@ namespace Avalonia.Controls if (toInsert != null) { base.InsertRange(index, toInsert); + NotifyChanged(); } } @@ -169,7 +182,14 @@ namespace Avalonia.Controls public override bool Remove(string name) { ThrowIfPseudoclass(name, "removed"); - return base.Remove(name); + + if (base.Remove(name)) + { + NotifyChanged(); + return true; + } + + return false; } /// @@ -197,6 +217,7 @@ namespace Avalonia.Controls if (toRemove != null) { base.RemoveAll(toRemove); + NotifyChanged(); } } @@ -214,6 +235,7 @@ namespace Avalonia.Controls var name = this[index]; ThrowIfPseudoclass(name, "removed"); base.RemoveAt(index); + NotifyChanged(); } /// @@ -224,6 +246,7 @@ namespace Avalonia.Controls public override void RemoveRange(int index, int count) { base.RemoveRange(index, count); + NotifyChanged(); } /// @@ -255,6 +278,7 @@ namespace Avalonia.Controls } base.AddRange(source); + NotifyChanged(); } /// @@ -263,13 +287,38 @@ namespace Avalonia.Controls if (!Contains(name)) { base.Add(name); + NotifyChanged(); } } /// bool IPseudoClasses.Remove(string name) { - return base.Remove(name); + if (base.Remove(name)) + { + NotifyChanged(); + return true; + } + + return false; + } + + internal void AddListener(IClassesChangedListener listener) + { + (_listeners ??= new()).Add(listener); + } + + internal void RemoveListener(IClassesChangedListener listener) + { + _listeners?.Remove(listener); + } + + private void NotifyChanged() + { + if (_listeners is null) + return; + foreach (var listener in _listeners) + listener.Changed(); } private void ThrowIfPseudoclass(string name, string operation) diff --git a/src/Avalonia.Base/Controls/IClassesChangedListener.cs b/src/Avalonia.Base/Controls/IClassesChangedListener.cs new file mode 100644 index 0000000000..b4de893c97 --- /dev/null +++ b/src/Avalonia.Base/Controls/IClassesChangedListener.cs @@ -0,0 +1,14 @@ +namespace Avalonia.Controls +{ + /// + /// Internal interface for listening to changes in in a more + /// performant manner than subscribing to CollectionChanged. + /// + internal interface IClassesChangedListener + { + /// + /// Notifies the listener that the collection has changed. + /// + void Changed(); + } +} diff --git a/src/Avalonia.Base/Styling/Activators/StyleClassActivator.cs b/src/Avalonia.Base/Styling/Activators/StyleClassActivator.cs index 98d3f16a0a..3f70ff50b3 100644 --- a/src/Avalonia.Base/Styling/Activators/StyleClassActivator.cs +++ b/src/Avalonia.Base/Styling/Activators/StyleClassActivator.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using Avalonia.Collections; +using Avalonia.Controls; #nullable enable @@ -10,21 +11,17 @@ namespace Avalonia.Styling.Activators /// An which is active when a set of classes match those on a /// control. /// - internal sealed class StyleClassActivator : StyleActivatorBase + internal sealed class StyleClassActivator : StyleActivatorBase, IClassesChangedListener { private readonly IList _match; - private readonly IAvaloniaReadOnlyList _classes; - private NotifyCollectionChangedEventHandler? _classesChangedHandler; + private readonly Classes _classes; - public StyleClassActivator(IAvaloniaReadOnlyList classes, IList match) + public StyleClassActivator(Classes classes, IList match) { _classes = classes; _match = match; } - private NotifyCollectionChangedEventHandler ClassesChangedHandler => - _classesChangedHandler ??= ClassesChanged; - public static bool AreClassesMatching(IReadOnlyList classes, IList toMatch) { int remainingMatches = toMatch.Count; @@ -55,23 +52,20 @@ namespace Avalonia.Styling.Activators return remainingMatches == 0; } - protected override void Initialize() + void IClassesChangedListener.Changed() { PublishNext(IsMatching()); - _classes.CollectionChanged += ClassesChangedHandler; } - protected override void Deinitialize() + protected override void Initialize() { - _classes.CollectionChanged -= ClassesChangedHandler; + PublishNext(IsMatching()); + _classes.AddListener(this); } - private void ClassesChanged(object? sender, NotifyCollectionChangedEventArgs e) + protected override void Deinitialize() { - if (e.Action != NotifyCollectionChangedAction.Move) - { - PublishNext(IsMatching()); - } + _classes.RemoveListener(this); } private bool IsMatching() => AreClassesMatching(_classes, _match); diff --git a/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs b/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs index 24d5d6bbbf..d52c8c7d5c 100644 --- a/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs +++ b/src/Avalonia.Base/Styling/TypeNameAndClassSelector.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Avalonia.Controls; using Avalonia.Styling.Activators; #nullable enable @@ -125,7 +126,7 @@ namespace Avalonia.Styling { if (subscribe) { - var observable = new StyleClassActivator(control.Classes, _classes.Value); + var observable = new StyleClassActivator((Classes)control.Classes, _classes.Value); return new SelectorMatch(observable); } diff --git a/tests/Avalonia.Base.UnitTests/Styling/SelectorTests_Template.cs b/tests/Avalonia.Base.UnitTests/Styling/SelectorTests_Template.cs index 8b4c988037..176fa07f19 100644 --- a/tests/Avalonia.Base.UnitTests/Styling/SelectorTests_Template.cs +++ b/tests/Avalonia.Base.UnitTests/Styling/SelectorTests_Template.cs @@ -142,14 +142,13 @@ namespace Avalonia.Base.UnitTests.Styling var border = (Border)target.Object.VisualChildren.Single(); var selector = default(Selector).OfType(templatedControl.Object.GetType()).Class("foo").Template().OfType(); var activator = selector.Match(border).Activator; - var inccDebug = (INotifyCollectionChangedDebug)styleable.Object.Classes; using (activator.Subscribe(_ => { })) { - Assert.Single(inccDebug.GetCollectionChangedSubscribers()); + Assert.Equal(1, ((Classes)styleable.Object.Classes).ListenerCount); } - Assert.Null(inccDebug.GetCollectionChangedSubscribers()); + Assert.Equal(0, ((Classes)styleable.Object.Classes).ListenerCount); } private void BuildVisualTree(Mock templatedControl) where T : class, IVisual diff --git a/tests/Avalonia.LeakTests/ControlTests.cs b/tests/Avalonia.LeakTests/ControlTests.cs index 8c05f2a0a7..8651409af1 100644 --- a/tests/Avalonia.LeakTests/ControlTests.cs +++ b/tests/Avalonia.LeakTests/ControlTests.cs @@ -313,7 +313,7 @@ namespace Avalonia.LeakTests // The TextBox should have subscriptions to its Classes collection from the // default theme. - Assert.NotEmpty(((INotifyCollectionChangedDebug)textBox.Classes).GetCollectionChangedSubscribers()); + Assert.NotEqual(0, textBox.Classes.ListenerCount); // Clear the content and ensure the TextBox is removed. window.Content = null; From 1408e521991d0b66cd3d4151da2918a900d058a5 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Mon, 4 Jul 2022 09:07:44 +0200 Subject: [PATCH 288/393] Add IAddChild support --- .../AvaloniaXamlIlLanguage.cs | 6 ++- .../Avalonia.Markup.Xaml.Loader/xamlil.github | 2 +- .../Avalonia.Markup.Xaml.csproj | 1 + src/Markup/Avalonia.Markup.Xaml/IAddChild.cs | 12 +++++ .../Xaml/BasicTests.cs | 51 +++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml/IAddChild.cs diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 8ed94f6b20..54eac8f59e 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -41,7 +41,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions }, WhitespaceSignificantCollectionAttributes = { - typeSystem.GetType("Avalonia.Metadata.WhitespaceSignificantCollectionAttribute") + typeSystem.GetType("Avalonia.Metadata.WhitespaceSignificantCollectionAttribute") }, TrimSurroundingWhitespaceAttributes = { @@ -56,7 +56,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions XmlNamespaceInfoProvider = typeSystem.GetType("Avalonia.Markup.Xaml.XamlIl.Runtime.IAvaloniaXamlIlXmlNamespaceInfoProvider"), - DeferredContentPropertyAttributes = {typeSystem.GetType("Avalonia.Metadata.TemplateContentAttribute")}, + DeferredContentPropertyAttributes = { typeSystem.GetType("Avalonia.Metadata.TemplateContentAttribute") }, DeferredContentExecutorCustomizationDefaultTypeParameter = typeSystem.GetType("Avalonia.Controls.IControl"), DeferredContentExecutorCustomizationTypeParameterDeferredContentAttributePropertyNames = new List { @@ -70,6 +70,8 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions }, InnerServiceProviderFactoryMethod = runtimeHelpers.FindMethod(m => m.Name == "CreateInnerServiceProviderV1"), + IAddChild = typeSystem.GetType("Avalonia.Markup.Xaml.IAddChild"), + IAddChildOfT = typeSystem.GetType("Avalonia.Markup.Xaml.IAddChild`1") }; rv.CustomAttributeResolver = new AttributeResolver(typeSystem, rv); diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github index daaac590e0..a4e6be2d14 160000 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github @@ -1 +1 @@ -Subproject commit daaac590e078967b78045f74c38ef046d00d8582 +Subproject commit a4e6be2d1407abec4f35fcb208848830ce513ead diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj index 30d321426f..c35cbc35c0 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj +++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Markup/Avalonia.Markup.Xaml/IAddChild.cs b/src/Markup/Avalonia.Markup.Xaml/IAddChild.cs new file mode 100644 index 0000000000..993eb6142d --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml/IAddChild.cs @@ -0,0 +1,12 @@ +namespace Avalonia.Markup.Xaml +{ + public interface IAddChild + { + void AddChild(object child); + } + + public interface IAddChild : IAddChild + { + void AddChild(T child); + } +} diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs index f12785a7ce..bed5f19ecb 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs @@ -958,6 +958,29 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml Assert.Equal("Foo", toolTip.Content); } + [Fact] + public void AddChild_Child_Is_Set() + { + var xaml = @"Foo"; + + var target = AvaloniaRuntimeXamlLoader.Parse(xaml); + + Assert.NotNull(target); + Assert.Equal("Foo", target.Child); + } + + [Fact] + public void AddChildOfT_Child_Is_Set() + { + var xaml = @"Foo"; + + var target = AvaloniaRuntimeXamlLoader.Parse(xaml); + + Assert.NotNull(target); + Assert.Null(target.Child); + Assert.Equal("Foo", target.Text); + } + private class SelectedItemsViewModel : INotifyPropertyChanged { public string[] Items { get; set; } @@ -977,6 +1000,34 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml } } } + + public class ObjectWithAddChild : IAddChild + { + public object Child { get; set; } + + void IAddChild.AddChild(object child) + { + Child = child; + } + } + + public class ObjectWithAddChildOfT : IAddChild + { + public string Text { get; set; } + + public object Child { get; set; } + + void IAddChild.AddChild(object child) + { + Child = child; + } + + void IAddChild.AddChild(string child) + { + Text = child; + } + } + public class BasicTestsAttachedPropertyHolder { public static AvaloniaProperty FooProperty = From 5dc768aa13435f4f126dae6e2d778df9f66b0da1 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Mon, 4 Jul 2022 12:11:34 +0200 Subject: [PATCH 289/393] Add some xml comments --- src/Avalonia.Controls/RichTextBlock.cs | 71 +++++++++++--------------- src/Avalonia.Controls/TextBlock.cs | 2 - 2 files changed, 31 insertions(+), 42 deletions(-) diff --git a/src/Avalonia.Controls/RichTextBlock.cs b/src/Avalonia.Controls/RichTextBlock.cs index 1411d715ec..2b84113497 100644 --- a/src/Avalonia.Controls/RichTextBlock.cs +++ b/src/Avalonia.Controls/RichTextBlock.cs @@ -14,19 +14,13 @@ using Avalonia.Utilities; namespace Avalonia.Controls { /// - /// A control that displays a block of text. + /// A control that displays a block of formatted text. /// public class RichTextBlock : TextBlock, IInlineHost { public static readonly StyledProperty IsTextSelectionEnabledProperty = AvaloniaProperty.Register(nameof(IsTextSelectionEnabled), false); - public static readonly DirectProperty CaretIndexProperty = - AvaloniaProperty.RegisterDirect( - nameof(CaretIndex), - o => o.CaretIndex, - (o, v) => o.CaretIndex = v); - public static readonly DirectProperty SelectionStartProperty = AvaloniaProperty.RegisterDirect( nameof(SelectionStart), @@ -67,7 +61,6 @@ namespace Avalonia.Controls nameof(CopyingToClipboard), RoutingStrategies.Bubble); private bool _canCopy; - private int _caretIndex; private int _selectionStart; private int _selectionEnd; @@ -86,31 +79,28 @@ namespace Avalonia.Controls InlineHost = this }; } - + + /// + /// Gets or sets the brush that highlights selected text. + /// public IBrush? SelectionBrush { get => GetValue(SelectionBrushProperty); set => SetValue(SelectionBrushProperty, value); } + /// + /// Gets or sets a value that defines the brush used for selected text. + /// public IBrush? SelectionForegroundBrush { get => GetValue(SelectionForegroundBrushProperty); set => SetValue(SelectionForegroundBrushProperty, value); } - public int CaretIndex - { - get => _caretIndex; - set - { - if(SetAndRaise(CaretIndexProperty, ref _caretIndex, value)) - { - SelectionStart = SelectionEnd = value; - } - } - } - + /// + /// Gets or sets a character index for the beginning of the current selection. + /// public int SelectionStart { get => _selectionStart; @@ -119,37 +109,36 @@ namespace Avalonia.Controls if (SetAndRaise(SelectionStartProperty, ref _selectionStart, value)) { RaisePropertyChanged(SelectedTextProperty, "", ""); - - if (SelectionEnd == value && CaretIndex != value) - { - CaretIndex = value; - } } } } + /// + /// Gets or sets a character index for the end of the current selection. + /// public int SelectionEnd { get => _selectionEnd; set { - if(SetAndRaise(SelectionEndProperty, ref _selectionEnd, value)) + if (SetAndRaise(SelectionEndProperty, ref _selectionEnd, value)) { RaisePropertyChanged(SelectedTextProperty, "", ""); - - if (SelectionStart == value && CaretIndex != value) - { - CaretIndex = value; - } } } } + /// + /// Gets the content of the current selection. + /// public string SelectedText { get => GetSelection(); } + /// + /// Gets or sets a value that indicates whether text selection is enabled, either through user action or calling selection-related API. + /// public bool IsTextSelectionEnabled { get => GetValue(IsTextSelectionEnabledProperty); @@ -181,6 +170,9 @@ namespace Avalonia.Controls remove => RemoveHandler(CopyingToClipboardEvent, value); } + /// + /// Copies the current selection to the Clipboard. + /// public async void Copy() { if (_canCopy || !IsTextSelectionEnabled) @@ -259,7 +251,6 @@ namespace Avalonia.Controls SelectionEnd = SelectionStart; } - protected override string? GetText() { return _text ?? Inlines.Text; @@ -344,13 +335,13 @@ namespace Avalonia.Controls bool Match(List gestures) => gestures.Any(g => g.Matches(e)); if (Match(keymap.Copy)) - { + { Copy(); - + handled = true; } - e.Handled = handled; + e.Handled = handled; } protected override void OnPointerPressed(PointerPressedEventArgs e) @@ -367,14 +358,14 @@ namespace Avalonia.Controls { var point = e.GetPosition(this); - var clickToSelect = e.KeyModifiers.HasFlag(KeyModifiers.Shift); + var clickToSelect = e.KeyModifiers.HasFlag(KeyModifiers.Shift); - var oldIndex = CaretIndex; + var oldIndex = SelectionStart; var hit = TextLayout.HitTestPoint(point); var index = hit.TextPosition; - SetAndRaise(CaretIndexProperty, ref _caretIndex, index); + SelectionStart = SelectionEnd = index; #pragma warning disable CS0618 // Type or member is obsolete switch (e.ClickCount) @@ -460,7 +451,7 @@ namespace Avalonia.Controls caretIndex >= firstSelection && caretIndex <= lastSelection; if (!didClickInSelection) { - CaretIndex = SelectionEnd = SelectionStart = caretIndex; + SelectionStart = SelectionEnd = caretIndex; } } diff --git a/src/Avalonia.Controls/TextBlock.cs b/src/Avalonia.Controls/TextBlock.cs index 27f7fc28b3..52261d1c76 100644 --- a/src/Avalonia.Controls/TextBlock.cs +++ b/src/Avalonia.Controls/TextBlock.cs @@ -1,11 +1,9 @@ using System; -using System.Collections.Generic; using Avalonia.Automation.Peers; using Avalonia.Controls.Documents; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Media.TextFormatting; -using Avalonia.Metadata; using Avalonia.Utilities; namespace Avalonia.Controls From 37a1a5553de73c48c80b61347f7273641d4a6891 Mon Sep 17 00:00:00 2001 From: Lobster Uberlord Date: Mon, 4 Jul 2022 19:16:25 +0700 Subject: [PATCH 290/393] Use Marshal.AllocHGlobal to allocate frame buffer --- src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs b/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs index a286affe04..603a792de3 100644 --- a/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs +++ b/src/Web/Avalonia.Web.Blazor/BlazorSkiaRasterSurface.cs @@ -65,26 +65,22 @@ namespace Avalonia.Web.Blazor private readonly struct FramebufferData { - private readonly byte[]? _data; - private readonly GCHandle _dataHandle; - public PixelSize Size { get; } public int RowBytes { get; } - public IntPtr Address => _dataHandle.AddrOfPinnedObject(); + public IntPtr Address { get; } public FramebufferData(int width, int height, int bytesPerPixel) { Size = new PixelSize(width, height); RowBytes = width * bytesPerPixel; - _data = new byte[width * height * bytesPerPixel]; - _dataHandle = GCHandle.Alloc(_data, GCHandleType.Pinned); + Address = Marshal.AllocHGlobal(width * height * bytesPerPixel); } public void Dispose() { - _dataHandle.Free(); + Marshal.FreeHGlobal(Address); } } } From 49aad04861f19c02ddc6a0780750ad29cc474c3b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Mon, 4 Jul 2022 08:56:47 -0400 Subject: [PATCH 291/393] Apply target's TemplatedParent to a Flyout and Tooltip, when it's opened (#8412) * Apply target's TemplatedParent to a Flyout and Tooltip, when it's opened * Add flyout and tooltip leak tests * Fix Flyout_Is_Freed --- src/Avalonia.Controls/Flyouts/FlyoutBase.cs | 1 + src/Avalonia.Controls/Primitives/Popup.cs | 17 +-- .../Primitives/TemplatedControl.cs | 10 +- src/Avalonia.Controls/ToolTip.cs | 5 +- tests/Avalonia.LeakTests/ControlTests.cs | 105 +++++++++++++++ .../Data/TemplateBindingTests.cs | 127 ++++++++++++++++++ 6 files changed, 242 insertions(+), 23 deletions(-) diff --git a/src/Avalonia.Controls/Flyouts/FlyoutBase.cs b/src/Avalonia.Controls/Flyouts/FlyoutBase.cs index 4801fa69f0..1504d2b25f 100644 --- a/src/Avalonia.Controls/Flyouts/FlyoutBase.cs +++ b/src/Avalonia.Controls/Flyouts/FlyoutBase.cs @@ -223,6 +223,7 @@ namespace Avalonia.Controls.Primitives { Popup.PlacementTarget = Target = placementTarget; ((ISetLogicalParent)Popup).SetParent(placementTarget); + Popup.SetValue(StyledElement.TemplatedParentProperty, placementTarget.TemplatedParent); } if (Popup.Child == null) diff --git a/src/Avalonia.Controls/Primitives/Popup.cs b/src/Avalonia.Controls/Primitives/Popup.cs index 95e5e25c42..1501d97470 100644 --- a/src/Avalonia.Controls/Primitives/Popup.cs +++ b/src/Avalonia.Controls/Primitives/Popup.cs @@ -860,22 +860,7 @@ namespace Avalonia.Controls.Primitives { if (control != null) { - var templatedParent = TemplatedParent; - - if (control.TemplatedParent == null) - { - control.SetValue(TemplatedParentProperty, templatedParent); - } - - control.ApplyTemplate(); - - if (!(control is IPresenter) && control.TemplatedParent == templatedParent) - { - foreach (IControl child in control.VisualChildren) - { - SetTemplatedParentAndApplyChildTemplates(child); - } - } + TemplatedControl.ApplyTemplatedParent(control, TemplatedParent); } } diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index db029d38c0..4403bfce51 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -285,7 +285,7 @@ namespace Avalonia.Controls.Primitives Logger.TryGet(LogEventLevel.Verbose, LogArea.Control)?.Log(this, "Creating control template"); var (child, nameScope) = template.Build(this); - ApplyTemplatedParent(child); + ApplyTemplatedParent(child, this); ((ISetLogicalParent)child).SetParent(this); VisualChildren.Add(child); @@ -387,18 +387,18 @@ namespace Avalonia.Controls.Primitives /// Sets the TemplatedParent property for the created template children. /// /// The control. - private void ApplyTemplatedParent(IControl control) + internal static void ApplyTemplatedParent(IStyledElement control, ITemplatedControl? templatedParent) { - control.SetValue(TemplatedParentProperty, this); + control.SetValue(TemplatedParentProperty, templatedParent); var children = control.LogicalChildren; var count = children.Count; for (var i = 0; i < count; i++) { - if (children[i] is IControl child) + if (children[i] is IStyledElement child) { - ApplyTemplatedParent(child); + ApplyTemplatedParent(child, templatedParent); } } } diff --git a/src/Avalonia.Controls/ToolTip.cs b/src/Avalonia.Controls/ToolTip.cs index 91c93c87c8..bb18bf4c64 100644 --- a/src/Avalonia.Controls/ToolTip.cs +++ b/src/Avalonia.Controls/ToolTip.cs @@ -271,8 +271,9 @@ namespace Avalonia.Controls _popupHost = OverlayPopupHost.CreatePopupHost(control, null); _popupHost.SetChild(this); ((ISetLogicalParent)_popupHost).SetParent(control); - - _popupHost.ConfigurePosition(control, GetPlacement(control), + ApplyTemplatedParent(this, control.TemplatedParent); + + _popupHost.ConfigurePosition(control, GetPlacement(control), new Point(GetHorizontalOffset(control), GetVerticalOffset(control))); WindowManagerAddShadowHintChanged(_popupHost, false); diff --git a/tests/Avalonia.LeakTests/ControlTests.cs b/tests/Avalonia.LeakTests/ControlTests.cs index 8c05f2a0a7..6fb7b1448c 100644 --- a/tests/Avalonia.LeakTests/ControlTests.cs +++ b/tests/Avalonia.LeakTests/ControlTests.cs @@ -7,6 +7,7 @@ using System.Reactive.Disposables; using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Presenters; +using Avalonia.Controls.Primitives; using Avalonia.Controls.Shapes; using Avalonia.Controls.Templates; using Avalonia.Data; @@ -877,6 +878,110 @@ namespace Avalonia.LeakTests } } + [Fact] + public void ToolTip_Is_Freed() + { + using (Start()) + { + Func run = () => + { + var window = new Window(); + var source = new Button + { + Template = new FuncControlTemplate public string? DefaultExtension { get; set; } - /// - /// Gets or sets the initial location where the file open picker looks for files to present to the user. - /// - public IStorageFolder? SuggestedStartLocation { get; set; } - /// /// Gets or sets the collection of valid file types that the user can choose to assign to a file. /// diff --git a/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs b/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs index de90da30b2..df9fa8fd35 100644 --- a/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs +++ b/src/Avalonia.Base/Platform/Storage/FolderPickerOpenOptions.cs @@ -3,20 +3,10 @@ /// /// Options class for method. /// -public class FolderPickerOpenOptions +public class FolderPickerOpenOptions : PickerOptions { - /// - /// Gets or sets the text that appears in the title bar of a folder dialog. - /// - public string? Title { get; set; } - /// /// Gets or sets an option indicating whether open picker allows users to select multiple folders. /// public bool AllowMultiple { get; set; } - - /// - /// Gets or sets the initial location where the file open picker looks for files to present to the user. - /// - public IStorageFolder? SuggestedStartLocation { get; set; } } diff --git a/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs b/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs index 65811b7fbd..d21c950862 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageBookmarkItem.cs @@ -17,5 +17,4 @@ public interface IStorageBookmarkFile : IStorageFile, IStorageBookmarkItem [NotClientImplementable] public interface IStorageBookmarkFolder : IStorageFolder, IStorageBookmarkItem { - } diff --git a/src/Avalonia.Base/Platform/Storage/IStorageFile.cs b/src/Avalonia.Base/Platform/Storage/IStorageFile.cs index 2f12514e50..965caf8216 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageFile.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageFile.cs @@ -14,7 +14,7 @@ public interface IStorageFile : IStorageItem /// Returns true, if file is readable. /// bool CanOpenRead { get; } - + /// /// Opens a stream for read access. /// @@ -24,9 +24,9 @@ public interface IStorageFile : IStorageItem /// Returns true, if file is writeable. /// bool CanOpenWrite { get; } - + /// /// Opens stream for writing to the file. /// Task OpenWrite(); -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs b/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs index 83b316bc3b..25b9f01a92 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageFolder.cs @@ -8,5 +8,4 @@ namespace Avalonia.Platform.Storage; [NotClientImplementable] public interface IStorageFolder : IStorageItem { - -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Platform/Storage/IStorageItem.cs b/src/Avalonia.Base/Platform/Storage/IStorageItem.cs index 078311a286..8513ebc7d9 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageItem.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageItem.cs @@ -27,7 +27,7 @@ public interface IStorageItem : IDisposable /// Browser and iOS backends might return relative uris. /// bool TryGetUri([NotNullWhen(true)] out Uri? uri); - + /// /// Gets the basic properties of the current item. /// @@ -37,7 +37,7 @@ public interface IStorageItem : IDisposable /// Returns true is item can be bookmarked and reused later. /// bool CanBookmark { get; } - + /// /// Saves items to a bookmark. /// diff --git a/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs b/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs index 32fb148790..0f5cf931d9 100644 --- a/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs +++ b/src/Avalonia.Base/Platform/Storage/IStorageProvider.cs @@ -11,7 +11,7 @@ public interface IStorageProvider /// Returns true if it's possible to open file picker on the current platform. /// bool CanOpen { get; } - + /// /// Opens file picker dialog. /// @@ -22,7 +22,7 @@ public interface IStorageProvider /// Returns true if it's possible to open save file picker on the current platform. /// bool CanSave { get; } - + /// /// Opens save file picker dialog. /// @@ -33,13 +33,13 @@ public interface IStorageProvider /// Returns true if it's possible to open folder picker on the current platform. /// bool CanPickFolder { get; } - + /// /// Opens folder picker dialog. /// /// Array of selected or empty collection if user canceled the dialog. Task> OpenFolderPickerAsync(FolderPickerOpenOptions options); - + /// /// Open from the bookmark ID. /// diff --git a/src/Avalonia.Base/Platform/Storage/PickerOptions.cs b/src/Avalonia.Base/Platform/Storage/PickerOptions.cs new file mode 100644 index 0000000000..6f97916a26 --- /dev/null +++ b/src/Avalonia.Base/Platform/Storage/PickerOptions.cs @@ -0,0 +1,17 @@ +namespace Avalonia.Platform.Storage; + +/// +/// Common options for , and methods. +/// +public class PickerOptions +{ + /// + /// Gets or sets the text that appears in the title bar of a folder dialog. + /// + public string? Title { get; set; } + + /// + /// Gets or sets the initial location where the file open picker looks for files to present to the user. + /// + public IStorageFolder? SuggestedStartLocation { get; set; } +} diff --git a/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs b/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs index 41b9bfa941..a63973ccf8 100644 --- a/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs +++ b/src/Avalonia.Base/Platform/Storage/StorageItemProperties.cs @@ -16,7 +16,7 @@ public class StorageItemProperties DateCreated = dateCreated; DateModified = dateModified; } - + /// /// Gets the size of the file in bytes. /// @@ -40,4 +40,4 @@ public class StorageItemProperties /// Can be null if property is not available. /// public DateTimeOffset? DateModified { get; } -} \ No newline at end of file +} From 6370ae38de78ab9c4bafa343e8870ee6d531b49c Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 5 Jul 2022 21:58:26 -0400 Subject: [PATCH 309/393] Switch to TemplateBinding in ColorPicker where possible --- .../Themes/Fluent/ColorPicker.xaml | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index 878d7819eb..46d627b3a1 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -49,31 +49,31 @@ + Color="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + ColorModel="{Binding ColorModel, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + ColorSpectrumComponents="{TemplateBinding ColorSpectrumComponents}" + ColorSpectrumShape="{TemplateBinding ColorSpectrumShape}" + HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + IsAlphaEnabled="{TemplateBinding IsAlphaEnabled}" + IsAlphaVisible="{TemplateBinding IsAlphaVisible}" + IsColorComponentsVisible="{TemplateBinding IsColorComponentsVisible}" + IsColorPaletteVisible="{TemplateBinding IsColorPaletteVisible}" + IsColorPreviewVisible="{TemplateBinding IsColorPreviewVisible}" + IsColorSpectrumVisible="{TemplateBinding IsColorSpectrumVisible}" + IsColorSpectrumSliderVisible="{TemplateBinding IsColorSpectrumSliderVisible}" + IsComponentTextInputVisible="{TemplateBinding IsComponentTextInputVisible}" + IsHexInputVisible="{TemplateBinding IsHexInputVisible}" + MaxHue="{TemplateBinding MaxHue}" + MaxSaturation="{TemplateBinding MaxSaturation}" + MaxValue="{TemplateBinding MaxValue}" + MinHue="{TemplateBinding MinHue}" + MinSaturation="{TemplateBinding MinSaturation}" + MinValue="{TemplateBinding MinValue}" + PaletteColors="{TemplateBinding PaletteColors}" + PaletteColumnCount="{TemplateBinding PaletteColumnCount}" + Palette="{TemplateBinding Palette}" + SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + ShowAccentColors="{TemplateBinding ShowAccentColors}" /> From a24720816f593e24bda2dd58ff6b6a56cdb23fd1 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 5 Jul 2022 22:12:18 -0400 Subject: [PATCH 310/393] Standardize ColorControl resource names This follows the Fluent standard where the resource is prefixed with the control itself --- .../Themes/Default/ColorPreviewer.xaml | 18 +++++------ .../Themes/Default/ColorSlider.xaml | 4 +-- .../Themes/Default/Default.xaml | 2 +- .../Themes/Fluent/ColorPicker.xaml | 2 +- .../Themes/Fluent/ColorPreviewer.xaml | 18 +++++------ .../Themes/Fluent/ColorSlider.xaml | 4 +-- .../Themes/Fluent/ColorView.xaml | 30 +++++++++---------- .../Themes/Fluent/Fluent.xaml | 2 +- 8 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml index 24242fc251..6ac0982408 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml @@ -9,8 +9,8 @@ - 80 - 40 + 80 + 40 + + + + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 867e0f223f..9e795d81a2 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -13,6 +13,8 @@ + + 48 30 @@ -90,29 +92,26 @@ - - + + - - - + CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource BottomCornerRadiusFilterConverter}}" + Background="Transparent" + BorderBrush="Transparent" + BorderThickness="0,1,0,0" /> Date: Tue, 5 Jul 2022 23:32:35 -0400 Subject: [PATCH 312/393] Add code to hide the tab strip when only one tab is visible --- .../ColorView/ColorView.cs | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index 8fb80980d5..bea982b7ea 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -4,9 +4,11 @@ using System.Collections.ObjectModel; using System.Globalization; using Avalonia.Controls.Converters; using Avalonia.Controls.Metadata; +using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Media; using Avalonia.Threading; +using Avalonia.VisualTree; namespace Avalonia.Controls { @@ -82,19 +84,19 @@ namespace Avalonia.Controls if (_tabControl != null && _tabControl.Items != null) { - // Determine if any item is visible - bool isAnyItemVisible = false; + // Determine the number of visible tab items + int numVisibleItems = 0; foreach (var item in _tabControl.Items) { if (item is Control control && control.IsVisible) { - isAnyItemVisible = true; - break; + numVisibleItems++; } } - if (isAnyItemVisible) + // Verify the selection + if (numVisibleItems > 0) { object? selectedItem = null; @@ -140,6 +142,23 @@ namespace Avalonia.Controls _tabControl.IsVisible = false; } + // Hide the "tab strip" if there is only one tab + // This allows, for example, to view only the palette + /* + var itemsPresenter = _tabControl.FindDescendantOfType(); + if (itemsPresenter != null) + { + if (numVisibleItems == 1) + { + itemsPresenter.IsVisible = false; + } + else + { + itemsPresenter.IsVisible = true; + } + } + */ + // Note that if externally the SelectedIndex is set to 4 or something // outside the valid range, the TabControl will ignore it and replace it // with a valid SelectedIndex. This however is not propagated back through From 0c81cb24801b7c7761c0b00f0675c8ff08754822 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Thu, 9 Jun 2022 10:56:45 +0200 Subject: [PATCH 313/393] fix: DBus Null annotations --- Avalonia.sln | 1 + .../Avalonia.FreeDesktop.csproj | 4 ++ src/Avalonia.FreeDesktop/DBusCallQueue.cs | 20 +++----- src/Avalonia.FreeDesktop/DBusHelper.cs | 4 +- .../DBusIme/DBusTextInputMethodBase.cs | 46 ++++++++++--------- .../DBusIme/Fcitx/FcitxDBus.cs | 28 +++++------ .../DBusIme/Fcitx/FcitxICWrapper.cs | 31 +++++++------ .../DBusIme/Fcitx/FcitxX11TextInputMethod.cs | 38 ++++++++------- .../DBusIme/IBus/IBusDBus.cs | 38 +++++++-------- .../DBusIme/IBus/IBusX11TextInputMethod.cs | 30 ++++++++---- .../DBusIme/X11DBusImeHelper.cs | 2 +- src/Avalonia.FreeDesktop/DBusMenu.cs | 16 +++---- src/Avalonia.FreeDesktop/DBusMenuExporter.cs | 36 +++++++-------- src/Avalonia.FreeDesktop/DBusRequest.cs | 2 +- .../LinuxMountedVolumeInfoProvider.cs | 2 +- .../Avalonia.SourceGenerator.csproj | 1 + .../Output/DrmOutput.cs | 2 +- .../IsExternalInit.cs | 0 18 files changed, 161 insertions(+), 140 deletions(-) rename src/{Avalonia.SourceGenerator => Shared}/IsExternalInit.cs (100%) diff --git a/Avalonia.sln b/Avalonia.sln index 25c7daf080..8d2479a663 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -38,6 +38,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A689DEF5-D50F-4975-8B72-124C9EB54066}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + src\Shared\IsExternalInit.cs = src\Shared\IsExternalInit.cs src\Shared\ModuleInitializer.cs = src\Shared\ModuleInitializer.cs src\Shared\SourceGeneratorAttributes.cs = src\Shared\SourceGeneratorAttributes.cs EndProjectSection diff --git a/src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj b/src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj index a5cb207223..3b1c6cc7b1 100644 --- a/src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj +++ b/src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj @@ -5,6 +5,10 @@ enable + + + + diff --git a/src/Avalonia.FreeDesktop/DBusCallQueue.cs b/src/Avalonia.FreeDesktop/DBusCallQueue.cs index 5cd748be02..e7c07dcbf9 100644 --- a/src/Avalonia.FreeDesktop/DBusCallQueue.cs +++ b/src/Avalonia.FreeDesktop/DBusCallQueue.cs @@ -8,10 +8,9 @@ namespace Avalonia.FreeDesktop { private readonly Func _errorHandler; - class Item + record Item(Func Callback) { - public Func Callback; - public Action OnFinish; + public Action? OnFinish; } private Queue _q = new Queue(); private bool _processing; @@ -23,19 +22,15 @@ namespace Avalonia.FreeDesktop public void Enqueue(Func cb) { - _q.Enqueue(new Item - { - Callback = cb - }); + _q.Enqueue(new Item(cb)); Process(); } public Task EnqueueAsync(Func cb) { var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - _q.Enqueue(new Item + _q.Enqueue(new Item(cb) { - Callback = cb, OnFinish = e => { if (e == null) @@ -51,13 +46,12 @@ namespace Avalonia.FreeDesktop public Task EnqueueAsync(Func> cb) { var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); - _q.Enqueue(new Item - { - Callback = async () => + _q.Enqueue(new Item(async () => { var res = await cb(); tcs.TrySetResult(res); - }, + }) + { OnFinish = e => { if (e != null) diff --git a/src/Avalonia.FreeDesktop/DBusHelper.cs b/src/Avalonia.FreeDesktop/DBusHelper.cs index 7204e51dbd..9f9d75b411 100644 --- a/src/Avalonia.FreeDesktop/DBusHelper.cs +++ b/src/Avalonia.FreeDesktop/DBusHelper.cs @@ -17,7 +17,7 @@ namespace Avalonia.FreeDesktop private readonly object _lock = new(); private SynchronizationContext? _ctx; - public override void Post(SendOrPostCallback d, object state) + public override void Post(SendOrPostCallback d, object? state) { lock (_lock) { @@ -29,7 +29,7 @@ namespace Avalonia.FreeDesktop } } - public override void Send(SendOrPostCallback d, object state) + public override void Send(SendOrPostCallback d, object? state) { lock (_lock) { diff --git a/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs b/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs index 864c579319..eef865d458 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Reflection; using System.Threading.Tasks; -using Avalonia.FreeDesktop.DBusIme.Fcitx; using Avalonia.Input.Raw; using Avalonia.Input.TextInput; using Avalonia.Logging; @@ -26,7 +24,7 @@ namespace Avalonia.FreeDesktop.DBusIme return (im, im); } } - + internal abstract class DBusTextInputMethodBase : IX11InputMethodControl, ITextInputMethodImpl { private List _disposables = new List(); @@ -34,7 +32,7 @@ namespace Avalonia.FreeDesktop.DBusIme protected Connection Connection { get; } private readonly string[] _knownNames; private bool _connecting; - private string _currentName; + private string? _currentName; private DBusCallQueue _queue; private bool _controlActive, _windowActive; private bool? _imeActive; @@ -42,9 +40,9 @@ namespace Avalonia.FreeDesktop.DBusIme private PixelRect? _lastReportedRect; private double _scaling = 1; private PixelPoint _windowPosition; - + protected bool IsConnected => _currentName != null; - + public DBusTextInputMethodBase(Connection connection, params string[] knownNames) { _queue = new DBusCallQueue(QueueOnError); @@ -58,18 +56,18 @@ namespace Avalonia.FreeDesktop.DBusIme foreach (var name in _knownNames) _disposables.Add(await Connection.ResolveServiceOwnerAsync(name, OnNameChange)); } - + protected abstract Task Connect(string name); protected string GetAppName() => - Application.Current.Name ?? Assembly.GetEntryAssembly()?.GetName()?.Name ?? "Avalonia"; - + Application.Current?.Name ?? Assembly.GetEntryAssembly()?.GetName()?.Name ?? "Avalonia"; + private async void OnNameChange(ServiceOwnerChangedEventArgs args) { if (args.NewOwner != null && _currentName == null) { _onlineNamesQueue.Enqueue(args.ServiceName); - if(!_connecting) + if (!_connecting) { _connecting = true; try @@ -98,25 +96,25 @@ namespace Avalonia.FreeDesktop.DBusIme _connecting = false; } } - + } - + // IME has crashed if (args.NewOwner == null && args.ServiceName == _currentName) { _currentName = null; - foreach(var s in _disposables) + foreach (var s in _disposables) s.Dispose(); _disposables.Clear(); - + OnDisconnected(); Reset(); - + // Watch again Watch(); } } - + protected virtual Task Disconnect() { return Task.CompletedTask; @@ -124,7 +122,7 @@ namespace Avalonia.FreeDesktop.DBusIme protected virtual void OnDisconnected() { - + } protected virtual void Reset() @@ -149,10 +147,14 @@ namespace Avalonia.FreeDesktop.DBusIme OnDisconnected(); _currentName = null; } - + protected void Enqueue(Func cb) => _queue.Enqueue(cb); - protected void AddDisposable(IDisposable d) => _disposables.Add(d); + protected void AddDisposable(IDisposable? d) + { + if(d is { }) + _disposables.Add(d); + } public void Dispose() { @@ -198,7 +200,7 @@ namespace Avalonia.FreeDesktop.DBusIme UpdateActive(); } - void ITextInputMethodImpl.SetClient(ITextInputMethodClient client) + void ITextInputMethodImpl.SetClient(ITextInputMethodClient? client) { _controlActive = client is { }; UpdateActive(); @@ -225,7 +227,7 @@ namespace Avalonia.FreeDesktop.DBusIme } } - private Action _onCommit; + private Action? _onCommit; event Action IX11InputMethodControl.Commit { add => _onCommit += value; @@ -234,7 +236,7 @@ namespace Avalonia.FreeDesktop.DBusIme protected void FireCommit(string s) => _onCommit?.Invoke(s); - private Action _onForward; + private Action? _onForward; event Action IX11InputMethodControl.ForwardKey { add => _onForward += value; diff --git a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxDBus.cs b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxDBus.cs index 7ce2339763..06afacaa29 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxDBus.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxDBus.cs @@ -31,15 +31,15 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx Task SetSurroundingTextPositionAsync(uint Cursor, uint Anchor); Task DestroyICAsync(); Task ProcessKeyEventAsync(uint Keyval, uint Keycode, uint State, int Type, uint Time); - Task WatchEnableIMAsync(Action handler, Action onError = null); - Task WatchCloseIMAsync(Action handler, Action onError = null); - Task WatchCommitStringAsync(Action handler, Action onError = null); - Task WatchCurrentIMAsync(Action<(string name, string uniqueName, string langCode)> handler, Action onError = null); - Task WatchUpdatePreeditAsync(Action<(string str, int cursorpos)> handler, Action onError = null); - Task WatchUpdateFormattedPreeditAsync(Action<((string, int)[] str, int cursorpos)> handler, Action onError = null); - Task WatchUpdateClientSideUIAsync(Action<(string auxup, string auxdown, string preedit, string candidateword, string imname, int cursorpos)> handler, Action onError = null); - Task WatchForwardKeyAsync(Action<(uint keyval, uint state, int type)> handler, Action onError = null); - Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchar)> handler, Action onError = null); + Task WatchEnableIMAsync(Action handler, Action? onError = null); + Task WatchCloseIMAsync(Action handler, Action? onError = null); + Task WatchCommitStringAsync(Action handler, Action? onError = null); + Task WatchCurrentIMAsync(Action<(string name, string uniqueName, string langCode)> handler, Action? onError = null); + Task WatchUpdatePreeditAsync(Action<(string str, int cursorpos)> handler, Action? onError = null); + Task WatchUpdateFormattedPreeditAsync(Action<((string, int)[] str, int cursorpos)> handler, Action? onError = null); + Task WatchUpdateClientSideUIAsync(Action<(string auxup, string auxdown, string preedit, string candidateword, string imname, int cursorpos)> handler, Action? onError = null); + Task WatchForwardKeyAsync(Action<(uint keyval, uint state, int type)> handler, Action? onError = null); + Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchar)> handler, Action? onError = null); } [DBusInterface("org.fcitx.Fcitx.InputContext1")] @@ -54,11 +54,11 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx Task SetSurroundingTextPositionAsync(uint Cursor, uint Anchor); Task DestroyICAsync(); Task ProcessKeyEventAsync(uint Keyval, uint Keycode, uint State, bool Type, uint Time); - Task WatchCommitStringAsync(Action handler, Action onError = null); - Task WatchCurrentIMAsync(Action<(string name, string uniqueName, string langCode)> handler, Action onError = null); - Task WatchUpdateFormattedPreeditAsync(Action<((string, int)[] str, int cursorpos)> handler, Action onError = null); - Task WatchForwardKeyAsync(Action<(uint keyval, uint state, bool type)> handler, Action onError = null); - Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchar)> handler, Action onError = null); + Task WatchCommitStringAsync(Action handler, Action? onError = null); + Task WatchCurrentIMAsync(Action<(string name, string uniqueName, string langCode)> handler, Action? onError = null); + Task WatchUpdateFormattedPreeditAsync(Action<((string, int)[] str, int cursorpos)> handler, Action? onError = null); + Task WatchForwardKeyAsync(Action<(uint keyval, uint state, bool type)> handler, Action? onError = null); + Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchar)> handler, Action? onError = null); } [DBusInterface("org.fcitx.Fcitx.InputMethod1")] diff --git a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxICWrapper.cs b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxICWrapper.cs index a03ea213aa..6c503edb41 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxICWrapper.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxICWrapper.cs @@ -5,8 +5,8 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx { internal class FcitxICWrapper { - private readonly IFcitxInputContext1 _modern; - private readonly IFcitxInputContext _old; + private readonly IFcitxInputContext1? _modern; + private readonly IFcitxInputContext? _old; public FcitxICWrapper(IFcitxInputContext old) { @@ -18,34 +18,37 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx _modern = modern; } - public Task FocusInAsync() => _old?.FocusInAsync() ?? _modern.FocusInAsync(); + public Task FocusInAsync() => _old?.FocusInAsync() ?? _modern?.FocusInAsync() ?? Task.CompletedTask; - public Task FocusOutAsync() => _old?.FocusOutAsync() ?? _modern.FocusOutAsync(); + public Task FocusOutAsync() => _old?.FocusOutAsync() ?? _modern?.FocusOutAsync() ?? Task.CompletedTask; - public Task ResetAsync() => _old?.ResetAsync() ?? _modern.ResetAsync(); + public Task ResetAsync() => _old?.ResetAsync() ?? _modern?.ResetAsync() ?? Task.CompletedTask; public Task SetCursorRectAsync(int x, int y, int w, int h) => - _old?.SetCursorRectAsync(x, y, w, h) ?? _modern.SetCursorRectAsync(x, y, w, h); - public Task DestroyICAsync() => _old?.DestroyICAsync() ?? _modern.DestroyICAsync(); + _old?.SetCursorRectAsync(x, y, w, h) ?? _modern?.SetCursorRectAsync(x, y, w, h) ?? Task.CompletedTask; + public Task DestroyICAsync() => _old?.DestroyICAsync() ?? _modern?.DestroyICAsync() ?? Task.CompletedTask; public async Task ProcessKeyEventAsync(uint keyVal, uint keyCode, uint state, int type, uint time) { if(_old!=null) return await _old.ProcessKeyEventAsync(keyVal, keyCode, state, type, time) != 0; - return await _modern.ProcessKeyEventAsync(keyVal, keyCode, state, type > 0, time); + return await (_modern?.ProcessKeyEventAsync(keyVal, keyCode, state, type > 0, time) ?? Task.FromResult(false)); } - public Task WatchCommitStringAsync(Action handler) => - _old?.WatchCommitStringAsync(handler) ?? _modern.WatchCommitStringAsync(handler); + public Task WatchCommitStringAsync(Action handler) => + _old?.WatchCommitStringAsync(handler) + ?? _modern?.WatchCommitStringAsync(handler) + ?? Task.FromResult(default(IDisposable?)); - public Task WatchForwardKeyAsync(Action<(uint keyval, uint state, int type)> handler) + public Task WatchForwardKeyAsync(Action<(uint keyval, uint state, int type)> handler) { return _old?.WatchForwardKeyAsync(handler) - ?? _modern.WatchForwardKeyAsync(ev => - handler((ev.keyval, ev.state, ev.type ? 1 : 0))); + ?? _modern?.WatchForwardKeyAsync(ev => + handler((ev.keyval, ev.state, ev.type ? 1 : 0))) + ?? Task.FromResult(default(IDisposable?)); } public Task SetCapacityAsync(uint flags) => - _old?.SetCapacityAsync(flags) ?? _modern.SetCapabilityAsync(flags); + _old?.SetCapacityAsync(flags) ?? _modern?.SetCapabilityAsync(flags) ?? Task.CompletedTask; } } diff --git a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxX11TextInputMethod.cs b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxX11TextInputMethod.cs index 0b85965de7..791431dfa7 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxX11TextInputMethod.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxX11TextInputMethod.cs @@ -12,7 +12,7 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx { internal class FcitxX11TextInputMethod : DBusTextInputMethodBase { - private FcitxICWrapper _context; + private FcitxICWrapper? _context; private FcitxCapabilityFlags? _lastReportedFlags; public FcitxX11TextInputMethod(Connection connection) : base(connection, @@ -49,7 +49,7 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx return true; } - protected override Task Disconnect() => _context.DestroyICAsync(); + protected override Task Disconnect() => _context?.DestroyICAsync() ?? Task.CompletedTask; protected override void OnDisconnected() => _context = null; @@ -60,18 +60,18 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx } protected override Task SetCursorRectCore(PixelRect cursorRect) => - _context.SetCursorRectAsync(cursorRect.X, cursorRect.Y, Math.Max(1, cursorRect.Width), - Math.Max(1, cursorRect.Height)); - - protected override Task SetActiveCore(bool active) - { - if (active) - return _context.FocusInAsync(); - else - return _context.FocusOutAsync(); - } + _context?.SetCursorRectAsync(cursorRect.X, cursorRect.Y, Math.Max(1, cursorRect.Width), + Math.Max(1, cursorRect.Height)) + ?? Task.CompletedTask; + + protected override Task SetActiveCore(bool active)=> (active + ? _context?.FocusInAsync() + : _context?.FocusOutAsync()) + ?? Task.CompletedTask; + - protected override Task ResetContextCore() => _context.ResetAsync(); + protected override Task ResetContextCore() => _context?.ResetAsync() + ?? Task.CompletedTask; protected override async Task HandleKeyCore(RawKeyEventArgs args, int keyVal, int keyCode) { @@ -88,9 +88,15 @@ namespace Avalonia.FreeDesktop.DBusIme.Fcitx var type = args.Type == RawKeyEventType.KeyDown ? FcitxKeyEventType.FCITX_PRESS_KEY : FcitxKeyEventType.FCITX_RELEASE_KEY; - - return await _context.ProcessKeyEventAsync((uint)keyVal, (uint)keyCode, (uint)state, (int)type, - (uint)args.Timestamp).ConfigureAwait(false); + if (_context is { }) + { + return await _context.ProcessKeyEventAsync((uint)keyVal, (uint)keyCode, (uint)state, (int)type, + (uint)args.Timestamp).ConfigureAwait(false); + } + else + { + return false; + } } public override void SetOptions(TextInputOptions options) => diff --git a/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusDBus.cs b/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusDBus.cs index 26c0d249f3..4ef034adb9 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusDBus.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusDBus.cs @@ -22,25 +22,25 @@ namespace Avalonia.FreeDesktop.DBusIme.IBus Task GetEngineAsync(); Task DestroyAsync(); Task SetSurroundingTextAsync(object Text, uint CursorPos, uint AnchorPos); - Task WatchCommitTextAsync(Action cb, Action onError = null); - Task WatchForwardKeyEventAsync(Action<(uint keyval, uint keycode, uint state)> handler, Action onError = null); - Task WatchRequireSurroundingTextAsync(Action handler, Action onError = null); - Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchars)> handler, Action onError = null); - Task WatchUpdatePreeditTextAsync(Action<(object text, uint cursorPos, bool visible)> handler, Action onError = null); - Task WatchShowPreeditTextAsync(Action handler, Action onError = null); - Task WatchHidePreeditTextAsync(Action handler, Action onError = null); - Task WatchUpdateAuxiliaryTextAsync(Action<(object text, bool visible)> handler, Action onError = null); - Task WatchShowAuxiliaryTextAsync(Action handler, Action onError = null); - Task WatchHideAuxiliaryTextAsync(Action handler, Action onError = null); - Task WatchUpdateLookupTableAsync(Action<(object table, bool visible)> handler, Action onError = null); - Task WatchShowLookupTableAsync(Action handler, Action onError = null); - Task WatchHideLookupTableAsync(Action handler, Action onError = null); - Task WatchPageUpLookupTableAsync(Action handler, Action onError = null); - Task WatchPageDownLookupTableAsync(Action handler, Action onError = null); - Task WatchCursorUpLookupTableAsync(Action handler, Action onError = null); - Task WatchCursorDownLookupTableAsync(Action handler, Action onError = null); - Task WatchRegisterPropertiesAsync(Action handler, Action onError = null); - Task WatchUpdatePropertyAsync(Action handler, Action onError = null); + Task WatchCommitTextAsync(Action cb, Action? onError = null); + Task WatchForwardKeyEventAsync(Action<(uint keyval, uint keycode, uint state)> handler, Action? onError = null); + Task WatchRequireSurroundingTextAsync(Action handler, Action? onError = null); + Task WatchDeleteSurroundingTextAsync(Action<(int offset, uint nchars)> handler, Action? onError = null); + Task WatchUpdatePreeditTextAsync(Action<(object text, uint cursorPos, bool visible)> handler, Action? onError = null); + Task WatchShowPreeditTextAsync(Action handler, Action? onError = null); + Task WatchHidePreeditTextAsync(Action handler, Action? onError = null); + Task WatchUpdateAuxiliaryTextAsync(Action<(object text, bool visible)> handler, Action? onError = null); + Task WatchShowAuxiliaryTextAsync(Action handler, Action? onError = null); + Task WatchHideAuxiliaryTextAsync(Action handler, Action? onError = null); + Task WatchUpdateLookupTableAsync(Action<(object table, bool visible)> handler, Action? onError = null); + Task WatchShowLookupTableAsync(Action handler, Action? onError = null); + Task WatchHideLookupTableAsync(Action handler, Action? onError = null); + Task WatchPageUpLookupTableAsync(Action handler, Action? onError = null); + Task WatchPageDownLookupTableAsync(Action handler, Action? onError = null); + Task WatchCursorUpLookupTableAsync(Action handler, Action? onError = null); + Task WatchCursorDownLookupTableAsync(Action handler, Action? onError = null); + Task WatchRegisterPropertiesAsync(Action handler, Action? onError = null); + Task WatchUpdatePropertyAsync(Action handler, Action? onError = null); } diff --git a/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusX11TextInputMethod.cs b/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusX11TextInputMethod.cs index 1397eaa57b..2324ca44a7 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusX11TextInputMethod.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/IBus/IBusX11TextInputMethod.cs @@ -9,7 +9,7 @@ namespace Avalonia.FreeDesktop.DBusIme.IBus { internal class IBusX11TextInputMethod : DBusTextInputMethodBase { - private IIBusInputContext _context; + private IIBusInputContext? _context; public IBusX11TextInputMethod(Connection connection) : base(connection, "org.freedesktop.portal.IBus") @@ -53,16 +53,16 @@ namespace Avalonia.FreeDesktop.DBusIme.IBus private void OnCommitText(object wtf) { // Hello darkness, my old friend - var prop = wtf.GetType().GetField("Item3"); - if (prop != null) + if (wtf.GetType().GetField("Item3") is { } prop) { - var text = (string)prop.GetValue(wtf); + var text = prop.GetValue(wtf) as string; if (!string.IsNullOrEmpty(text)) - FireCommit(text); + FireCommit(text!); } } - protected override Task Disconnect() => _context.DestroyAsync(); + protected override Task Disconnect() => _context?.DestroyAsync() + ?? Task.CompletedTask; protected override void OnDisconnected() { @@ -71,13 +71,15 @@ namespace Avalonia.FreeDesktop.DBusIme.IBus } protected override Task SetCursorRectCore(PixelRect rect) - => _context.SetCursorLocationAsync(rect.X, rect.Y, rect.Width, rect.Height); + => _context?.SetCursorLocationAsync(rect.X, rect.Y, rect.Width, rect.Height) + ?? Task.CompletedTask; protected override Task SetActiveCore(bool active) - => active ? _context.FocusInAsync() : _context.FocusOutAsync(); + => (active ? _context?.FocusInAsync() : _context?.FocusOutAsync()) + ?? Task.CompletedTask; protected override Task ResetContextCore() - => _context.ResetAsync(); + => _context?.ResetAsync() ?? Task.CompletedTask; protected override Task HandleKeyCore(RawKeyEventArgs args, int keyVal, int keyCode) { @@ -94,7 +96,15 @@ namespace Avalonia.FreeDesktop.DBusIme.IBus if (args.Type == RawKeyEventType.KeyUp) state |= IBusModifierMask.ReleaseMask; - return _context.ProcessKeyEventAsync((uint)keyVal, (uint)keyCode, (uint)state); + if(_context is { }) + { + return _context.ProcessKeyEventAsync((uint)keyVal, (uint)keyCode, (uint)state); + } + else + { + return Task.FromResult(false); + } + } public override void SetOptions(TextInputOptions options) diff --git a/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs b/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs index 7f71ecf0ff..86978c8b60 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs @@ -17,7 +17,7 @@ namespace Avalonia.FreeDesktop.DBusIme new DBusInputMethodFactory(_ => new IBusX11TextInputMethod(conn)) }; - static Func DetectInputMethod() + static Func? DetectInputMethod() { foreach (var name in new[] { "AVALONIA_IM_MODULE", "GTK_IM_MODULE", "QT_IM_MODULE" }) { diff --git a/src/Avalonia.FreeDesktop/DBusMenu.cs b/src/Avalonia.FreeDesktop/DBusMenu.cs index 7180345386..3a1c65e7c9 100644 --- a/src/Avalonia.FreeDesktop/DBusMenu.cs +++ b/src/Avalonia.FreeDesktop/DBusMenu.cs @@ -28,18 +28,18 @@ namespace Avalonia.FreeDesktop.DBusMenu Task EventGroupAsync((int id, string eventId, object data, uint timestamp)[] events); Task AboutToShowAsync(int Id); Task<(int[] updatesNeeded, int[] idErrors)> AboutToShowGroupAsync(int[] Ids); - Task WatchItemsPropertiesUpdatedAsync(Action<((int, IDictionary)[] updatedProps, (int, string[])[] removedProps)> handler, Action onError = null); - Task WatchLayoutUpdatedAsync(Action<(uint revision, int parent)> handler, Action onError = null); - Task WatchItemActivationRequestedAsync(Action<(int id, uint timestamp)> handler, Action onError = null); + Task WatchItemsPropertiesUpdatedAsync(Action<((int, IDictionary)[] updatedProps, (int, string[])[] removedProps)> handler, Action? onError = null); + Task WatchLayoutUpdatedAsync(Action<(uint revision, int parent)> handler, Action? onError = null); + Task WatchItemActivationRequestedAsync(Action<(int id, uint timestamp)> handler, Action? onError = null); } [Dictionary] class DBusMenuProperties { public uint Version { get; set; } = default (uint); - public string TextDirection { get; set; } = default (string); - public string Status { get; set; } = default (string); - public string[] IconThemePath { get; set; } = default (string[]); + public string? TextDirection { get; set; } = default (string); + public string? Status { get; set; } = default (string); + public string[]? IconThemePath { get; set; } = default (string[]); } @@ -50,7 +50,7 @@ namespace Avalonia.FreeDesktop.DBusMenu Task UnregisterWindowAsync(uint WindowId); Task<(string service, ObjectPath menuObjectPath)> GetMenuForWindowAsync(uint WindowId); Task<(uint, string, ObjectPath)[]> GetMenusAsync(); - Task WatchWindowRegisteredAsync(Action<(uint windowId, string service, ObjectPath menuObjectPath)> handler, Action onError = null); - Task WatchWindowUnregisteredAsync(Action handler, Action onError = null); + Task WatchWindowRegisteredAsync(Action<(uint windowId, string service, ObjectPath menuObjectPath)> handler, Action? onError = null); + Task WatchWindowUnregisteredAsync(Action handler, Action? onError = null); } } diff --git a/src/Avalonia.FreeDesktop/DBusMenuExporter.cs b/src/Avalonia.FreeDesktop/DBusMenuExporter.cs index 206c24ad5e..c0511420a6 100644 --- a/src/Avalonia.FreeDesktop/DBusMenuExporter.cs +++ b/src/Avalonia.FreeDesktop/DBusMenuExporter.cs @@ -17,7 +17,7 @@ namespace Avalonia.FreeDesktop { public class DBusMenuExporter { - public static ITopLevelNativeMenuExporter TryCreateTopLevelNativeMenu(IntPtr xid) + public static ITopLevelNativeMenuExporter? TryCreateTopLevelNativeMenu(IntPtr xid) { if (DBusHelper.Connection == null) return null; @@ -37,10 +37,10 @@ namespace Avalonia.FreeDesktop { private readonly Connection _dbus; private readonly uint _xid; - private IRegistrar _registrar; + private IRegistrar? _registrar; private bool _disposed; private uint _revision = 1; - private NativeMenu _menu; + private NativeMenu? _menu; private readonly Dictionary _idsToItems = new Dictionary(); private readonly Dictionary _itemsToIds = new Dictionary(); private readonly HashSet _menus = new HashSet(); @@ -73,10 +73,10 @@ namespace Avalonia.FreeDesktop if (_appMenu) { await _dbus.RegisterObjectAsync(this); - _registrar = DBusHelper.Connection.CreateProxy( + _registrar = DBusHelper.Connection?.CreateProxy( "com.canonical.AppMenu.Registrar", "/com/canonical/AppMenu/Registrar"); - if (!_disposed) + if (!_disposed && _registrar is { }) await _registrar.RegisterWindowAsync(_xid, ObjectPath); } else @@ -109,9 +109,9 @@ namespace Avalonia.FreeDesktop public bool IsNativeMenuExported { get; private set; } - public event EventHandler OnIsNativeMenuExportedChanged; + public event EventHandler? OnIsNativeMenuExportedChanged; - public void SetNativeMenu(NativeMenu menu) + public void SetNativeMenu(NativeMenu? menu) { if (menu == null) menu = new NativeMenu(); @@ -153,7 +153,7 @@ namespace Avalonia.FreeDesktop Dispatcher.UIThread.Post(DoLayoutReset, DispatcherPriority.Background); } - private (NativeMenuItemBase item, NativeMenu menu) GetMenu(int id) + private (NativeMenuItemBase? item, NativeMenu? menu) GetMenu(int id) { if (id == 0) return (null, _menu); @@ -161,7 +161,7 @@ namespace Avalonia.FreeDesktop return (item, (item as NativeMenuItem)?.Menu); } - private void EnsureSubscribed(NativeMenu menu) + private void EnsureSubscribed(NativeMenu? menu) { if(menu!=null && _menus.Add(menu)) ((INotifyCollectionChanged)menu.Items).CollectionChanged += OnMenuItemsChanged; @@ -180,12 +180,12 @@ namespace Avalonia.FreeDesktop return id; } - private void OnMenuItemsChanged(object sender, NotifyCollectionChangedEventArgs e) + private void OnMenuItemsChanged(object? sender, NotifyCollectionChangedEventArgs e) { QueueReset(); } - private void OnItemPropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) + private void OnItemPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { QueueReset(); } @@ -216,7 +216,7 @@ namespace Avalonia.FreeDesktop "type", "label", "enabled", "visible", "shortcut", "toggle-type", "children-display", "toggle-state", "icon-data" }; - object GetProperty((NativeMenuItemBase item, NativeMenu menu) i, string name) + object? GetProperty((NativeMenuItemBase? item, NativeMenu? menu) i, string name) { var (it, menu) = i; @@ -302,7 +302,7 @@ namespace Avalonia.FreeDesktop } private List> _reusablePropertyList = new List>(); - KeyValuePair[] GetProperties((NativeMenuItemBase item, NativeMenu menu) i, string[] names) + KeyValuePair[] GetProperties((NativeMenuItemBase? item, NativeMenu? menu) i, string[] names) { if (names?.Length > 0 != true) names = AllProperties; @@ -336,7 +336,7 @@ namespace Avalonia.FreeDesktop return Task.FromResult(rv); } - (int, KeyValuePair[], object[]) GetLayout(NativeMenuItemBase item, NativeMenu menu, int depth, string[] propertyNames) + (int, KeyValuePair[], object[]) GetLayout(NativeMenuItemBase? item, NativeMenu? menu, int depth, string[] propertyNames) { var id = item == null ? 0 : GetId(item); var props = GetProperties((item, menu), propertyNames); @@ -414,22 +414,22 @@ namespace Avalonia.FreeDesktop private event Action<((int, IDictionary)[] updatedProps, (int, string[])[] removedProps)> ItemsPropertiesUpdated { add { } remove { } } - private event Action<(uint revision, int parent)> LayoutUpdated; + private event Action<(uint revision, int parent)>? LayoutUpdated; private event Action<(int id, uint timestamp)> ItemActivationRequested { add { } remove { } } private event Action PropertiesChanged { add { } remove { } } - async Task IDBusMenu.WatchItemsPropertiesUpdatedAsync(Action<((int, IDictionary)[] updatedProps, (int, string[])[] removedProps)> handler, Action onError) + async Task IDBusMenu.WatchItemsPropertiesUpdatedAsync(Action<((int, IDictionary)[] updatedProps, (int, string[])[] removedProps)> handler, Action? onError) { ItemsPropertiesUpdated += handler; return Disposable.Create(() => ItemsPropertiesUpdated -= handler); } - async Task IDBusMenu.WatchLayoutUpdatedAsync(Action<(uint revision, int parent)> handler, Action onError) + async Task IDBusMenu.WatchLayoutUpdatedAsync(Action<(uint revision, int parent)> handler, Action? onError) { LayoutUpdated += handler; return Disposable.Create(() => LayoutUpdated -= handler); } - async Task IDBusMenu.WatchItemActivationRequestedAsync(Action<(int id, uint timestamp)> handler, Action onError) + async Task IDBusMenu.WatchItemActivationRequestedAsync(Action<(int id, uint timestamp)> handler, Action? onError) { ItemActivationRequested+= handler; return Disposable.Create(() => ItemActivationRequested -= handler); diff --git a/src/Avalonia.FreeDesktop/DBusRequest.cs b/src/Avalonia.FreeDesktop/DBusRequest.cs index 940a476916..d84905324f 100644 --- a/src/Avalonia.FreeDesktop/DBusRequest.cs +++ b/src/Avalonia.FreeDesktop/DBusRequest.cs @@ -11,6 +11,6 @@ namespace Avalonia.FreeDesktop internal interface IRequest : IDBusObject { Task CloseAsync(); - Task WatchResponseAsync(Action<(uint response, IDictionary results)> handler, Action onError = null); + Task WatchResponseAsync(Action<(uint response, IDictionary results)> handler, Action? onError = null); } } diff --git a/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs b/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs index d68c02bfd6..b69ea68a76 100644 --- a/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs +++ b/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs @@ -10,7 +10,7 @@ namespace Avalonia.FreeDesktop public IDisposable Listen(ObservableCollection mountedDrives) { Contract.Requires(mountedDrives != null); - return new LinuxMountedVolumeInfoListener(ref mountedDrives); + return new LinuxMountedVolumeInfoListener(ref mountedDrives!); } } } diff --git a/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj b/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj index 97e58f8a64..b5c955a8a6 100644 --- a/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj +++ b/src/Avalonia.SourceGenerator/Avalonia.SourceGenerator.csproj @@ -11,6 +11,7 @@ all + diff --git a/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs b/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs index ee4125101c..46a985c0e8 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs @@ -133,7 +133,7 @@ namespace Avalonia.LinuxFramebuffer.Output var device = gbm_create_device(card.Fd); _gbmTargetSurface = gbm_surface_create(device, modeInfo.Resolution.Width, modeInfo.Resolution.Height, GbmColorFormats.GBM_FORMAT_XRGB8888, GbmBoFlags.GBM_BO_USE_SCANOUT | GbmBoFlags.GBM_BO_USE_RENDERING); - if(_gbmTargetSurface == null) + if(_gbmTargetSurface == IntPtr.Zero) throw new InvalidOperationException("Unable to create GBM surface"); _eglDisplay = new EglDisplay(new EglInterface(eglGetProcAddress), false, 0x31D7, device, null); diff --git a/src/Avalonia.SourceGenerator/IsExternalInit.cs b/src/Shared/IsExternalInit.cs similarity index 100% rename from src/Avalonia.SourceGenerator/IsExternalInit.cs rename to src/Shared/IsExternalInit.cs From b63b84860ca69e453b0c719873be381a1dba7099 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Wed, 6 Jul 2022 09:58:36 +0200 Subject: [PATCH 314/393] fix(DataGrid): CS8073 The result of the expression is always 'true' --- src/Avalonia.Controls.DataGrid/DataGrid.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/DataGrid.cs b/src/Avalonia.Controls.DataGrid/DataGrid.cs index aaac3f8f9c..d42468f47e 100644 --- a/src/Avalonia.Controls.DataGrid/DataGrid.cs +++ b/src/Avalonia.Controls.DataGrid/DataGrid.cs @@ -5990,15 +5990,14 @@ namespace Avalonia.Controls /// The formatted string. private string FormatClipboardContent(DataGridRowClipboardEventArgs e) { - StringBuilder text = new StringBuilder(); - for (int cellIndex = 0; cellIndex < e.ClipboardRowContent.Count; cellIndex++) - { - DataGridClipboardCellContent cellContent = e.ClipboardRowContent[cellIndex]; - if (cellContent != null) - { - text.Append(cellContent.Content); - } - if (cellIndex < e.ClipboardRowContent.Count - 1) + var text = new StringBuilder(); + var clipboardRowContent = e.ClipboardRowContent; + var numberOfItem = clipboardRowContent.Count; + for (int cellIndex = 0; cellIndex < numberOfItem; cellIndex++) + { + var cellContent = clipboardRowContent[cellIndex]; + text.Append(cellContent.Content); + if (cellIndex < numberOfItem - 1) { text.Append('\t'); } From 407f761201a287e22bc34f086f7491d7632b42c4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 12:34:38 +0100 Subject: [PATCH 315/393] add windows task --- azure-pipelines-integrationtests.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 94a80eef44..4f3ac57e73 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -6,10 +6,16 @@ trigger: - master -pool: - name: 'AvaloniaMacPool' -steps: -- script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh - displayName: 'run integration tests' +- job: Mac + pool: + name: 'AvaloniaMacPool' + steps: + - script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh + displayName: 'run integration tests' + + +- job: Windows + pool: + vmImage: 'windows-2022' From 03b0fcb4549af35d142dcf9cb408fc49b6032e7d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 12:40:42 +0100 Subject: [PATCH 316/393] add windows integration tests --- azure-pipelines-integrationtests.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 4f3ac57e73..05872803b4 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -6,7 +6,7 @@ trigger: - master - +jobs: - job: Mac pool: name: 'AvaloniaMacPool' @@ -19,3 +19,20 @@ trigger: - job: Windows pool: vmImage: 'windows-2022' + + steps: + - task: Windows Application Driver@0 + inputs: + OperationType: 'Start' + AgentResolution: '1080p' + displayName: 'Start WinAppDriver' + + - task: DotNetCoreCLI@2 + inputs: + command: 'test' + projects: 'tests/Avalonia.IntegrationTests.Appium/' + + - task: Windows Application Driver@0 + inputs: + OperationType: 'Stop' + displayName: 'Stop WinAppDriver' From 7b12c76e1d79a8948bd1868018c1a829be1a5175 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 13:21:48 +0100 Subject: [PATCH 317/393] build test app first. --- azure-pipelines-integrationtests.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 05872803b4..941dd01249 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -21,16 +21,26 @@ jobs: vmImage: 'windows-2022' steps: + - task: UseDotNet@2 + displayName: 'Use .NET Core SDK 6.0.202' + inputs: + version: 6.0.202 + - task: Windows Application Driver@0 inputs: OperationType: 'Start' AgentResolution: '1080p' displayName: 'Start WinAppDriver' + + - task: DotNetCoreCLI@2 + inputs: + command: 'build' + projects: 'samples/IntegrationTestApp/IntegrationTestApp.csproj' - task: DotNetCoreCLI@2 inputs: command: 'test' - projects: 'tests/Avalonia.IntegrationTests.Appium/' + projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj' - task: Windows Application Driver@0 inputs: From 0bb62fa8092421d6bf2f72479041f6bc93fffe34 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 13:39:03 +0100 Subject: [PATCH 318/393] use 4k res on windows tests --- azure-pipelines-integrationtests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 941dd01249..c3f6292703 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -29,7 +29,7 @@ jobs: - task: Windows Application Driver@0 inputs: OperationType: 'Start' - AgentResolution: '1080p' + AgentResolution: '4K' displayName: 'Start WinAppDriver' - task: DotNetCoreCLI@2 From 230166d0bc894dc802dc85fc25ef19452caa414c Mon Sep 17 00:00:00 2001 From: Lubomir Tetak Date: Wed, 6 Jul 2022 14:54:33 +0200 Subject: [PATCH 319/393] EffectiveViewportChangedListeners thread safety improved --- src/Avalonia.Base/Layout/LayoutManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Base/Layout/LayoutManager.cs b/src/Avalonia.Base/Layout/LayoutManager.cs index fc988a8d6c..dd2db9304d 100644 --- a/src/Avalonia.Base/Layout/LayoutManager.cs +++ b/src/Avalonia.Base/Layout/LayoutManager.cs @@ -340,7 +340,7 @@ namespace Avalonia.Layout { for (var i = 0; i < count; ++i) { - var l = _effectiveViewportChangedListeners[i]; + var l = listeners[i]; if (!l.Listener.IsAttachedToVisualTree) { @@ -352,7 +352,7 @@ namespace Avalonia.Layout if (viewport != l.Viewport) { l.Listener.EffectiveViewportChanged(new EffectiveViewportChangedEventArgs(viewport)); - _effectiveViewportChangedListeners[i] = new EffectiveViewportChangedListener(l.Listener, viewport); + l.Viewport = viewport; } } } @@ -404,7 +404,7 @@ namespace Avalonia.Layout } } - private readonly struct EffectiveViewportChangedListener + private struct EffectiveViewportChangedListener { public EffectiveViewportChangedListener(ILayoutable listener, Rect viewport) { @@ -413,7 +413,7 @@ namespace Avalonia.Layout } public ILayoutable Listener { get; } - public Rect Viewport { get; } + public Rect Viewport { get; set; } } } } From c034525d29dd2d6e4c95aebf17751ccfc6332c0e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 14:40:46 +0100 Subject: [PATCH 320/393] win32, keep window size at all scale settings when entering and exiting fs mode. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 82f1fa7a3e..259f5c996b 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -870,7 +870,14 @@ namespace Avalonia.Win32 if (fullscreen) { GetWindowRect(_hwnd, out var windowRect); - _savedWindowInfo.WindowRect = windowRect; + GetClientRect(_hwnd, out var clientRect); + + clientRect.left += windowRect.left; + clientRect.right += windowRect.left; + clientRect.top += windowRect.top; + clientRect.bottom += windowRect.top; + + _savedWindowInfo.WindowRect = clientRect; var current = GetStyle(); var currentEx = GetExtendedStyle(); @@ -907,10 +914,10 @@ namespace Avalonia.Win32 SetExtendedStyle(_savedWindowInfo.ExStyle, false); // On restore, resize to the previous saved rect size. - var new_rect = _savedWindowInfo.WindowRect.ToPixelRect(); + var newClientRect = _savedWindowInfo.WindowRect.ToPixelRect(); - SetWindowPos(_hwnd, IntPtr.Zero, new_rect.X, new_rect.Y, new_rect.Width, - new_rect.Height, + SetWindowPos(_hwnd, IntPtr.Zero, newClientRect.X, newClientRect.Y, newClientRect.Width, + newClientRect.Height, SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED); UpdateWindowProperties(_windowProperties, true); From 84a4de5c070f9dde1e0e752194f51c76daa978d3 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 16:43:50 +0100 Subject: [PATCH 321/393] make splitview not culture sensitive. --- src/Avalonia.Controls/SplitView.cs | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/SplitView.cs b/src/Avalonia.Controls/SplitView.cs index 532cb1d329..caefad4af7 100644 --- a/src/Avalonia.Controls/SplitView.cs +++ b/src/Avalonia.Controls/SplitView.cs @@ -431,18 +431,40 @@ namespace Avalonia.Controls } } + private string GetPsuedoClass(SplitViewDisplayMode mode) + { + return mode switch + { + SplitViewDisplayMode.Inline => "inline", + SplitViewDisplayMode.CompactInline => "compactinline", + SplitViewDisplayMode.Overlay => "overlay", + SplitViewDisplayMode.CompactOverlay => "compactoverlay", + _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null) + }; + } + + private string GetPsuedoClass(SplitViewPanePlacement placement) + { + return placement switch + { + SplitViewPanePlacement.Left => "left", + SplitViewPanePlacement.Right => "right", + _ => throw new ArgumentOutOfRangeException(nameof(placement), placement, null) + }; + } + private void OnPanePlacementChanged(AvaloniaPropertyChangedEventArgs e) { - var oldState = e.OldValue!.ToString()!.ToLower(); - var newState = e.NewValue!.ToString()!.ToLower(); + var oldState = GetPsuedoClass(e.GetOldValue()); + var newState = GetPsuedoClass(e.GetNewValue()); PseudoClasses.Remove($":{oldState}"); PseudoClasses.Add($":{newState}"); } private void OnDisplayModeChanged(AvaloniaPropertyChangedEventArgs e) { - var oldState = e.OldValue!.ToString()!.ToLower(); - var newState = e.NewValue!.ToString()!.ToLower(); + var oldState = GetPsuedoClass(e.GetOldValue()); + var newState = GetPsuedoClass(e.GetNewValue()); PseudoClasses.Remove($":{oldState}"); PseudoClasses.Add($":{newState}"); From b7a3bce6f99202fce9128c9824d3157e91c6d615 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 17:21:41 +0100 Subject: [PATCH 322/393] fix compiler warning. --- src/Avalonia.Controls/SplitView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/SplitView.cs b/src/Avalonia.Controls/SplitView.cs index caefad4af7..f560251e53 100644 --- a/src/Avalonia.Controls/SplitView.cs +++ b/src/Avalonia.Controls/SplitView.cs @@ -469,7 +469,7 @@ namespace Avalonia.Controls PseudoClasses.Remove($":{oldState}"); PseudoClasses.Add($":{newState}"); - var (closedPaneWidth, paneColumnGridLength) = (SplitViewDisplayMode)e.NewValue switch + var (closedPaneWidth, paneColumnGridLength) = e.GetNewValue() switch { SplitViewDisplayMode.Overlay => (0, new GridLength(0, GridUnitType.Pixel)), SplitViewDisplayMode.CompactOverlay => (CompactPaneLength, new GridLength(CompactPaneLength, GridUnitType.Pixel)), From cc2d791f3683ae77c21ba8d7b9ece37ac8852a7e Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Wed, 6 Jul 2022 19:45:01 +0200 Subject: [PATCH 323/393] Update samples/Sandbox/MainWindow.axaml Co-authored-by: Max Katz --- samples/Sandbox/MainWindow.axaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/samples/Sandbox/MainWindow.axaml b/samples/Sandbox/MainWindow.axaml index a834e3fef3..6929f192c7 100644 --- a/samples/Sandbox/MainWindow.axaml +++ b/samples/Sandbox/MainWindow.axaml @@ -1,19 +1,4 @@ - - - - This is a - TextBlock - with several - Span elements, - - using a variety of styles - . - - - - - From 45ae4221dc8cf2f40a92c4d57dbdca7a3aacdd64 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 6 Jul 2022 20:58:36 +0100 Subject: [PATCH 324/393] correct spelling. --- src/Avalonia.Controls/SplitView.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/SplitView.cs b/src/Avalonia.Controls/SplitView.cs index f560251e53..c344dd795d 100644 --- a/src/Avalonia.Controls/SplitView.cs +++ b/src/Avalonia.Controls/SplitView.cs @@ -431,7 +431,7 @@ namespace Avalonia.Controls } } - private string GetPsuedoClass(SplitViewDisplayMode mode) + private string GetPseudoClass(SplitViewDisplayMode mode) { return mode switch { @@ -443,7 +443,7 @@ namespace Avalonia.Controls }; } - private string GetPsuedoClass(SplitViewPanePlacement placement) + private string GetPseudoClass(SplitViewPanePlacement placement) { return placement switch { @@ -455,16 +455,16 @@ namespace Avalonia.Controls private void OnPanePlacementChanged(AvaloniaPropertyChangedEventArgs e) { - var oldState = GetPsuedoClass(e.GetOldValue()); - var newState = GetPsuedoClass(e.GetNewValue()); + var oldState = GetPseudoClass(e.GetOldValue()); + var newState = GetPseudoClass(e.GetNewValue()); PseudoClasses.Remove($":{oldState}"); PseudoClasses.Add($":{newState}"); } private void OnDisplayModeChanged(AvaloniaPropertyChangedEventArgs e) { - var oldState = GetPsuedoClass(e.GetOldValue()); - var newState = GetPsuedoClass(e.GetNewValue()); + var oldState = GetPseudoClass(e.GetOldValue()); + var newState = GetPseudoClass(e.GetNewValue()); PseudoClasses.Remove($":{oldState}"); PseudoClasses.Add($":{newState}"); From 22971f56cb3eabc56d87d94ac8059aed78977aab Mon Sep 17 00:00:00 2001 From: Lubomir Tetak Date: Thu, 7 Jul 2022 10:20:30 +0200 Subject: [PATCH 325/393] EffectiveViewportChangedListeners must be reference type --- src/Avalonia.Base/Layout/LayoutManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Layout/LayoutManager.cs b/src/Avalonia.Base/Layout/LayoutManager.cs index 91358adc05..b9ca6bfbd7 100644 --- a/src/Avalonia.Base/Layout/LayoutManager.cs +++ b/src/Avalonia.Base/Layout/LayoutManager.cs @@ -414,7 +414,7 @@ namespace Avalonia.Layout } } - private struct EffectiveViewportChangedListener + private class EffectiveViewportChangedListener { public EffectiveViewportChangedListener(ILayoutable listener, Rect viewport) { From 1812540ad9c722bb995e1cc2a9b60ca1b269cc8b Mon Sep 17 00:00:00 2001 From: Lubomir Tetak Date: Thu, 7 Jul 2022 10:44:19 +0200 Subject: [PATCH 326/393] unit test --- ...ayoutableTests_EffectiveViewportChanged.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_EffectiveViewportChanged.cs b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_EffectiveViewportChanged.cs index 7c1a525002..a58d28004f 100644 --- a/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_EffectiveViewportChanged.cs +++ b/tests/Avalonia.Base.UnitTests/Layout/LayoutableTests_EffectiveViewportChanged.cs @@ -312,6 +312,30 @@ namespace Avalonia.Base.UnitTests.Layout }); } + [Fact] + public async Task Event_Unsubscribed_While_Inside_Callback() + { + await RunOnUIThread.Execute(async () => + { + var root = CreateRoot(); + var target = new Canvas(); + var raised = 0; + + void OnTargetOnEffectiveViewportChanged(object s, EffectiveViewportChangedEventArgs e) + { + target.EffectiveViewportChanged -= OnTargetOnEffectiveViewportChanged; + ++raised; + } + target.EffectiveViewportChanged += OnTargetOnEffectiveViewportChanged; + + root.Child = target; + + await ExecuteInitialLayoutPass(root); + + Assert.Equal(1, raised); + }); + } + private TestRoot CreateRoot() => new TestRoot { Width = 1200, Height = 900 }; private Task ExecuteInitialLayoutPass(TestRoot root) From 6483b5edc778e8fbeb1a0c29d55c150f9d60965e Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Thu, 7 Jul 2022 10:46:06 +0200 Subject: [PATCH 327/393] Add Has method to IPseudoClasses --- src/Avalonia.Base/Controls/IPseudoClasses.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Avalonia.Base/Controls/IPseudoClasses.cs b/src/Avalonia.Base/Controls/IPseudoClasses.cs index eda521727f..45013ee069 100644 --- a/src/Avalonia.Base/Controls/IPseudoClasses.cs +++ b/src/Avalonia.Base/Controls/IPseudoClasses.cs @@ -19,5 +19,12 @@ namespace Avalonia.Controls /// /// The pseudoclass name. bool Remove(string name); + + /// + /// Returns whether a pseudoclass is present in the collection. + /// + /// The pseudoclass name. + /// Whether the pseudoclass is present. + bool Has(string name); } } From f80cf2d355f813d9294523984c6323398b4ef65d Mon Sep 17 00:00:00 2001 From: daniel mayost Date: Thu, 7 Jul 2022 23:01:38 +0300 Subject: [PATCH 328/393] add base.OnAttachedToVisualTree(e) call to repeater --- src/Avalonia.Controls/Repeater/ItemsRepeater.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs index 3f42d95deb..ae663defd3 100644 --- a/src/Avalonia.Controls/Repeater/ItemsRepeater.cs +++ b/src/Avalonia.Controls/Repeater/ItemsRepeater.cs @@ -421,6 +421,7 @@ namespace Avalonia.Controls protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { + base.OnAttachedToVisualTree(e); InvalidateMeasure(); _viewportManager.ResetScrollers(); } From 012d3763693d332e05c12e6ba6ae0e06cf3b72e4 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 7 Jul 2022 20:48:37 -0400 Subject: [PATCH 329/393] Standardize converters --- .../Themes/Default/ColorPreviewer.xaml | 16 +++----- .../Themes/Default/ColorSlider.xaml | 22 ++++------- .../Themes/Default/ColorSpectrum.xaml | 31 ++++++--------- .../Themes/Default/Default.xaml | 14 ++++++- .../Themes/Fluent/ColorPicker.xaml | 13 +++---- .../Themes/Fluent/ColorPreviewer.xaml | 16 +++----- .../Themes/Fluent/ColorSlider.xaml | 22 ++++------- .../Themes/Fluent/ColorSpectrum.xaml | 31 ++++++--------- .../Themes/Fluent/ColorView.xaml | 39 +++++++++---------- .../Themes/Fluent/Fluent.xaml | 14 ++++++- 10 files changed, 101 insertions(+), 117 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml index 6ac0982408..ad07da2b16 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml @@ -1,14 +1,10 @@  - - - - + 80 40 @@ -36,11 +32,11 @@ Grid.Column="0" CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" Tag="-2" - Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColor}, ConverterParameter='-2'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='-2'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='-1'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='1'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='2'}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSlider.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSlider.xaml index bf2f632fd8..729c5be313 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSlider.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSlider.xaml @@ -1,13 +1,7 @@  - - - - - diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml index 8d77f8d3c1..84a94486c8 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml @@ -1,14 +1,10 @@  - - - - + 80 40 @@ -36,11 +32,11 @@ Grid.Column="0" CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" Tag="-2" - Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColor}, ConverterParameter='-2'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='-2'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='-1'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='1'}" /> + Background="{TemplateBinding HsvColor, Converter={StaticResource AccentColorConverter}, ConverterParameter='2'}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSlider.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSlider.xaml index bb6e026f9e..594a2c694f 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSlider.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorSlider.xaml @@ -1,13 +1,7 @@  - - - - - @@ -255,8 +252,8 @@ - @@ -363,12 +360,12 @@ Grid.Column="0" Content="RGB" CornerRadius="4,0,0,4" - IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBool}, ConverterParameter={x:Static local:ColorModel.Rgba}, Mode=TwoWay}" /> + IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Rgba}, Mode=TwoWay}" /> + IsChecked="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Hsva}, Mode=TwoWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Rgba}, Mode=OneWay}"/> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Hsva}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Rgba}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Hsva}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Rgba}, Mode=OneWay}" /> + IsVisible="{TemplateBinding ColorModel, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static controls:ColorModel.Hsva}, Mode=OneWay}" /> + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converters="using:Avalonia.Controls.Converters"> + + + + + + + + + + + From 38bdb8a7b34051e4898aa9c0a1dc3a3fff25ae52 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 7 Jul 2022 20:53:21 -0400 Subject: [PATCH 330/393] Remove unused code --- .../ColorPicker/ColorPicker.cs | 8 +------- src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs index d34a91d1bb..39369bcbdb 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Controls +namespace Avalonia.Controls { /// /// Presents a color for user editing using a spectrum, palette and component sliders within a drop down. diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index bea982b7ea..89f1afb1ac 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -28,7 +28,6 @@ namespace Avalonia.Controls private TextBox? _hexTextBox; private TabControl? _tabControl; - private ObservableCollection _paletteColors = new ObservableCollection(); private ColorToHexConverter colorToHexConverter = new ColorToHexConverter(); protected bool ignorePropertyChanged = false; From 443977b85d1985dadf9f5248b4ca7f194503ab76 Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 7 Jul 2022 21:10:02 -0400 Subject: [PATCH 331/393] Specify TargetType and DataType in most templates --- .../Themes/Default/ColorPreviewer.xaml | 2 +- .../Themes/Default/ColorSlider.xaml | 4 ++-- .../Themes/Default/ColorSpectrum.xaml | 2 +- .../Themes/Fluent/ColorPicker.xaml | 2 +- .../Themes/Fluent/ColorPreviewer.xaml | 2 +- .../Themes/Fluent/ColorSlider.xaml | 4 ++-- .../Themes/Fluent/ColorSpectrum.xaml | 2 +- .../Themes/Fluent/ColorView.xaml | 10 ++++++---- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml index ad07da2b16..3a4efaa42a 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml @@ -13,7 +13,7 @@ - + - + @@ -93,7 +93,7 @@ - + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml index 95af16d12e..0e57f6b483 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorSpectrum.xaml @@ -6,7 +6,7 @@ - + + + +"; + + var contentControl = AvaloniaRuntimeXamlLoader.Parse(xaml); + contentControl.Measure(new Size(10, 10)); + + var result = contentControl.GetTemplateChildren().OfType().First(); + + Assert.Equal("Hello", result.Content); + } + } + [Fact] public void Binds_To_Source() { From 142b878984db2f3be0977b4073a83ff3247ab2f0 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 8 Jul 2022 01:05:25 -0400 Subject: [PATCH 335/393] Fix special case of compiled binding with Path child --- .../XamlIlBindingPathHelper.cs | 8 +++-- .../CompiledBindingExtensionTests.cs | 35 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index dd809956cd..8a115bf8fc 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -47,7 +47,11 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions return startTypeResolver(); } - if (bindingPathAssignment.Values[0] is ParsedBindingPathNode bindingPathNode) + if (bindingPathAssignment.Values[0] is XamlIlBindingPathNode pathNode) + { + bindingResultType = pathNode.BindingResultType; + } + else if (bindingPathAssignment.Values[0] is ParsedBindingPathNode bindingPathNode) { var transformed = TransformBindingPath( context, @@ -63,7 +67,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions } else { - throw new InvalidOperationException(); + throw new InvalidOperationException("Invalid state of Path property"); } } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index e6df80f17e..754a819182 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -102,6 +102,41 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Equal(dataContext.StringProperty, textBlock.Text); } } + + [Fact] + public void ResolvesPathPassedByPropertyWithInnerItemTemplate() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + + + + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var textBlock = window.FindControl("itemsControl"); + + var dataContext = new TestDataContext + { + ListProperty = + { + "Hello" + } + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.ListProperty, textBlock.Items); + } + } [Fact] public void ResolvesStreamTaskBindingCorrectly() From 2619ab17595b6317fe4afdf1bc0917cb325c5a1d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 8 Jul 2022 01:06:13 -0400 Subject: [PATCH 336/393] Fix compiled binding with TemplatedParent relative source --- .../AvaloniaXamlIlCompiler.cs | 6 ++-- .../AvaloniaXamlIlBindingPathParser.cs | 25 ++++++++++------ .../XamlIlBindingPathHelper.cs | 1 + .../CompiledBindingExtensionTests.cs | 30 +++++++++++++++++-- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs index 04a61e5f10..e3a55feac9 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs @@ -45,10 +45,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions new AvaloniaXamlIlReorderClassesPropertiesTransformer() ); - InsertBefore( - new AvaloniaXamlIlBindingPathParser(), + InsertBefore( new AvaloniaXamlIlSelectorTransformer(), - new AvaloniaXamlIlControlTemplateTargetTypeMetadataTransformer(), + new AvaloniaXamlIlControlTemplateTargetTypeMetadataTransformer(), + new AvaloniaXamlIlBindingPathParser(), new AvaloniaXamlIlPropertyPathTransformer(), new AvaloniaXamlIlSetterTransformer(), new AvaloniaXamlIlConstructorServiceProviderTransformer(), diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs index 890cbb69bf..60c880c6aa 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs @@ -121,11 +121,14 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers { throw new XamlParseException("Only one of ElementName, Source, or RelativeSource specified as a binding source. Only one property is allowed.", binding); } - - var mode = relativeSourceObject.Children + + var modeProperty = relativeSourceObject.Children .OfType() - .FirstOrDefault(x => x.Property.GetClrProperty().Name == "Mode") - ?.Values[0] is XamlAstTextNode modeAssignedValue ? modeAssignedValue.Text : null; + .FirstOrDefault(x => x.Property.GetClrProperty().Name == "Mode")? + .Values.FirstOrDefault() as XamlAstTextNode + ?? relativeSourceObject.Arguments.OfType().FirstOrDefault(); + + var mode = modeProperty?.Text; if (relativeSourceObject.Arguments.Count == 0 && mode == null) { mode = "FindAncestor"; @@ -212,16 +215,20 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers } else if (mode == "TemplatedParent") { - var parentType = context.ParentNodes().OfType() + var contentTemplateNode = context.ParentNodes().OfType() .FirstOrDefault(x => - x.ScopeType == AvaloniaXamlIlTargetTypeMetadataNode.ScopeTypes.ControlTemplate) - ?.TargetType.GetClrType(); - - if (parentType is null) + x.ScopeType == AvaloniaXamlIlTargetTypeMetadataNode.ScopeTypes.ControlTemplate); + if (contentTemplateNode is null) { throw new XamlParseException("A binding with a TemplatedParent RelativeSource has to be in a ControlTemplate.", binding); } + var parentType = contentTemplateNode.TargetType.GetClrType(); + if (parentType is null) + { + throw new XamlParseException("TargetType has to be set on ControlTemplate.", binding); + } + convertedNode = new TemplatedParentBindingExpressionNode { Type = parentType }; } else diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index 8a115bf8fc..ae29dcf9cb 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -244,6 +244,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions case TemplatedParentBindingExpressionNode templatedParent: var templatedParentField = context.GetAvaloniaTypes().StyledElement.GetAllFields() .FirstOrDefault(f => f.IsStatic && f.IsPublic && f.Name == "TemplatedParentProperty"); + nodes.Add(new SelfPathElementNode(selfType)); nodes.Add(new XamlIlAvaloniaPropertyPropertyPathElementNode( templatedParentField, templatedParent.Type)); diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 754a819182..5ca25a176c 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; +using System.Linq; using System.Reactive.Subjects; -using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Presenters; @@ -17,8 +17,6 @@ using Avalonia.Markup.Xaml.Templates; using Avalonia.Media; using Avalonia.Metadata; using Avalonia.UnitTests; -using JetBrains.Annotations; -using XamlX; using Xunit; namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions @@ -676,6 +674,32 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void ResolvesRelativeSourceBindingFromTemplate() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + + + +"; + + var contentControl = AvaloniaRuntimeXamlLoader.Parse(xaml); + contentControl.Measure(new Size(10, 10)); + + var result = contentControl.GetTemplateChildren().OfType().First(); + Assert.Equal("Hello", result.Content); + } + } [Fact] public void ResolvesElementNameInTemplate() From 5d234cd49c7e7da9c446d7450f06267053a71999 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 8 Jul 2022 01:06:30 -0400 Subject: [PATCH 337/393] Remove reflection bindings from standard controls --- .../Diagnostics/Controls/FilterTextBox.axaml | 2 +- src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml | 2 +- src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Diagnostics/Diagnostics/Controls/FilterTextBox.axaml b/src/Avalonia.Diagnostics/Diagnostics/Controls/FilterTextBox.axaml index b7995c38e3..a1a2ab34bf 100644 --- a/src/Avalonia.Diagnostics/Diagnostics/Controls/FilterTextBox.axaml +++ b/src/Avalonia.Diagnostics/Diagnostics/Controls/FilterTextBox.axaml @@ -19,7 +19,7 @@ Classes="textBoxClearButton" ToolTip.Tip="Clear" Cursor="Hand" - Command="{ReflectionBinding $parent[TextBox].Clear}" + Command="{Binding $parent[TextBox].Clear}" Opacity="0.5" /> diff --git a/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml b/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml index a463334a76..482b219589 100644 --- a/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml @@ -21,7 +21,7 @@ - + @@ -32,7 +32,7 @@ - + From ff3b23b2d6eb3e874ad2c71393181b7756ffb5ae Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 8 Jul 2022 01:17:05 -0400 Subject: [PATCH 338/393] Formatting --- .../Transformers/AvaloniaXamlIlBindingPathParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs index 60c880c6aa..6150265cf8 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathParser.cs @@ -121,7 +121,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers { throw new XamlParseException("Only one of ElementName, Source, or RelativeSource specified as a binding source. Only one property is allowed.", binding); } - + var modeProperty = relativeSourceObject.Children .OfType() .FirstOrDefault(x => x.Property.GetClrProperty().Name == "Mode")? @@ -226,7 +226,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers var parentType = contentTemplateNode.TargetType.GetClrType(); if (parentType is null) { - throw new XamlParseException("TargetType has to be set on ControlTemplate.", binding); + throw new XamlParseException("TargetType has to be set on ControlTemplate or it should be defined inside of a Style.", binding); } convertedNode = new TemplatedParentBindingExpressionNode { Type = parentType }; From 34f8f3d5564d3d7b1584746c8dcaa887a5e235f5 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 8 Jul 2022 01:57:06 -0400 Subject: [PATCH 339/393] Fix DataType set on Binding extension + add tests --- .../AvaloniaXamlIlBindingPathTransformer.cs | 5 + .../CompiledBindings/CompiledBindingPath.cs | 2 + .../CompiledBindingExtensionTests.cs | 95 +++++++++++++++++++ 3 files changed, 102 insertions(+) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathTransformer.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathTransformer.cs index 3cc3504e16..e509d47932 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathTransformer.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlBindingPathTransformer.cs @@ -105,6 +105,11 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers { startType = TypeReferenceResolver.ResolveType(context, text.Text, isMarkupExtension: false, text, strict: true).Type; } + + if (dataTypeProperty?.Values.Count is 1 && dataTypeProperty.Values[0] is XamlTypeExtensionNode typeNode) + { + startType = typeNode.Value.GetClrType(); + } Func startTypeResolver = startType is not null ? () => startType : () => { diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs index 73a14fd437..f78d4867ff 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs @@ -74,6 +74,8 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings return pathRoot ?? new EmptyExpressionNode(); } + internal IEnumerable Elements => _elements; + internal SourceMode SourceMode => _elements.Count > 0 && _elements[0] is IControlSourceBindingPathElement ? SourceMode.Control : SourceMode.Data; internal object RawSource { get; } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 5ca25a176c..215ae4d54f 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -9,10 +9,13 @@ using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Presenters; using Avalonia.Controls.Templates; +using Avalonia.Data; using Avalonia.Data.Converters; using Avalonia.Data.Core; using Avalonia.Input; using Avalonia.Markup.Data; +using Avalonia.Markup.Xaml.MarkupExtensions; +using Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings; using Avalonia.Markup.Xaml.Templates; using Avalonia.Media; using Avalonia.Metadata; @@ -135,6 +138,56 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Equal(dataContext.ListProperty, textBlock.Items); } } + + [Fact] + public void ResolvesDataTypeFromBindingProperty() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var textBlock = window.FindControl("textBlock"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, textBlock.Text); + } + } + + [Fact] + public void ResolvesDataTypeFromBindingProperty_TypeExtension() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var textBlock = window.FindControl("textBlock"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, textBlock.Text); + } + } [Fact] public void ResolvesStreamTaskBindingCorrectly() @@ -1479,6 +1532,43 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void ResolvesDataTypeForAssignBinding() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" +"; + var control = (AssignBindingControl)AvaloniaRuntimeXamlLoader.Load(xaml); + var compiledPath = ((CompiledBindingExtension)control.X).Path; + + var node = Assert.IsType(Assert.Single(compiledPath.Elements)); + Assert.Equal(typeof(string), node.Property.PropertyType); + } + } + + [Fact] + public void ResolvesDataTypeForAssignBinding_FromBindingProperty() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" +"; + var control = (AssignBindingControl)AvaloniaRuntimeXamlLoader.Load(xaml); + var compiledPath = ((CompiledBindingExtension)control.X).Path; + + var node = Assert.IsType(Assert.Single(compiledPath.Elements)); + Assert.Equal(typeof(string), node.Property.PropertyType); + } + } + void Throws(string type, Action cb) { try @@ -1656,4 +1746,9 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } public class CustomDataTemplateInherit : CustomDataTemplate { } + + public class AssignBindingControl : Control + { + [AssignBinding] public IBinding X { get; set; } + } } From 8e57d0b7c6b52e6598570795e206a4a27e7e13b9 Mon Sep 17 00:00:00 2001 From: Takoooooo Date: Fri, 8 Jul 2022 11:52:55 +0300 Subject: [PATCH 340/393] Fix bindings to Types. --- .../Data/Core/Plugins/InpcPropertyAccessorPlugin.cs | 2 +- tests/Avalonia.Markup.UnitTests/Data/BindingTests.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs index b93bf87fdf..91d69b5d3d 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs @@ -55,7 +55,7 @@ namespace Avalonia.Data.Core.Plugins private PropertyInfo? GetFirstPropertyWithName(object instance, string propertyName) { - if (instance is IReflectableType reflectableType) + if (instance is IReflectableType reflectableType && instance is not Type) return reflectableType.GetTypeInfo().GetProperty(propertyName, PropertyBindingFlags); var type = instance.GetType(); diff --git a/tests/Avalonia.Markup.UnitTests/Data/BindingTests.cs b/tests/Avalonia.Markup.UnitTests/Data/BindingTests.cs index 11a22f0dec..f4a4a2934f 100644 --- a/tests/Avalonia.Markup.UnitTests/Data/BindingTests.cs +++ b/tests/Avalonia.Markup.UnitTests/Data/BindingTests.cs @@ -637,6 +637,17 @@ namespace Avalonia.Markup.UnitTests.Data Assert.Equal("baz", source["Foo"]); } + [Fact] + public void Binding_To_Types_Should_Work() + { + var type = typeof(string); + var textBlock = new TextBlock() { DataContext = type }; + using (textBlock.Bind(TextBlock.TextProperty, new Binding("Name"))) + { + Assert.Equal("String", textBlock.Text); + }; + } + private class StyledPropertyClass : AvaloniaObject { public static readonly StyledProperty DoubleValueProperty = From 0553c7ceabf01199a0c45cf21c3e6126fde1e660 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 8 Jul 2022 15:32:09 +0100 Subject: [PATCH 341/393] add a failing unit test --- .../WindowTests.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/Avalonia.Controls.UnitTests/WindowTests.cs b/tests/Avalonia.Controls.UnitTests/WindowTests.cs index a8c9b68d12..ab4fd566c8 100644 --- a/tests/Avalonia.Controls.UnitTests/WindowTests.cs +++ b/tests/Avalonia.Controls.UnitTests/WindowTests.cs @@ -540,6 +540,51 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(window.Position, expectedPosition); } } + + [Fact] + public void Window_Should_Be_Centered_When_WindowStartupLocation_Is_CenterScreen_1080_175() + { + var screen1 = new Mock(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true); + + var screens = new Mock(); + screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1.Object }); + screens.Setup(x => x.ScreenFromPoint(It.IsAny())).Returns(screen1.Object); + + + var windowImpl = MockWindowingPlatform.CreateWindowMock(); + windowImpl.Setup(x => x.DesktopScaling).Returns(1.75); + windowImpl.Setup(x => x.RenderScaling).Returns(1.75); + windowImpl.Setup(x => x.Screen).Returns(screens.Object); + + var clientSize = new Size(801.142, 366); + + windowImpl.Setup(x => x.ClientSize).Returns(() => clientSize); + + windowImpl.Setup(x => x.Resize(It.IsAny(), It.IsAny())) + .Callback((x, y) => + { + clientSize = x;//.Constrain(screen1.Object.Bounds.Size.ToSize(1.75)); + windowImpl.Object.Resized?.Invoke(clientSize, y); + }); + + windowImpl.Setup(x => x.FrameSize).Returns(() => clientSize.Inflate(new Thickness(5, 25, 5, 5))); + + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var window = new Window(windowImpl.Object); + window.WindowStartupLocation = WindowStartupLocation.CenterScreen; + window.MinWidth = 720; + window.MinHeight = 480; + //window.Width = 720; + //window.Height = 480; + + window.Show(); + + var expectedPosition = new PixelPoint(321, 36); + + Assert.Equal(window.Position, expectedPosition); + } + } [Fact] public void Window_Should_Be_Centered_Relative_To_Owner_When_WindowStartupLocation_Is_CenterOwner() From b9aa49bc05d039b01a52e0a10d0494be6bdb92d9 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 8 Jul 2022 18:31:49 +0100 Subject: [PATCH 342/393] Add failing unit test. --- .../Avalonia.Controls.UnitTests/WindowTests.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/WindowTests.cs b/tests/Avalonia.Controls.UnitTests/WindowTests.cs index ab4fd566c8..3677d62050 100644 --- a/tests/Avalonia.Controls.UnitTests/WindowTests.cs +++ b/tests/Avalonia.Controls.UnitTests/WindowTests.cs @@ -542,28 +542,25 @@ namespace Avalonia.Controls.UnitTests } [Fact] - public void Window_Should_Be_Centered_When_WindowStartupLocation_Is_CenterScreen_1080_175() + public void Window_Should_Be_Sized_To_MinSize_If_InitialSize_Less_Than_MinSize() { var screen1 = new Mock(1.75, new PixelRect(new PixelSize(1920, 1080)), new PixelRect(new PixelSize(1920, 966)), true); - var screens = new Mock(); screens.Setup(x => x.AllScreens).Returns(new Screen[] { screen1.Object }); screens.Setup(x => x.ScreenFromPoint(It.IsAny())).Returns(screen1.Object); - var windowImpl = MockWindowingPlatform.CreateWindowMock(); windowImpl.Setup(x => x.DesktopScaling).Returns(1.75); windowImpl.Setup(x => x.RenderScaling).Returns(1.75); windowImpl.Setup(x => x.Screen).Returns(screens.Object); - var clientSize = new Size(801.142, 366); + var clientSize = new Size(400.142, 366); windowImpl.Setup(x => x.ClientSize).Returns(() => clientSize); - windowImpl.Setup(x => x.Resize(It.IsAny(), It.IsAny())) .Callback((x, y) => { - clientSize = x;//.Constrain(screen1.Object.Bounds.Size.ToSize(1.75)); + clientSize = x; windowImpl.Object.Resized?.Invoke(clientSize, y); }); @@ -575,14 +572,10 @@ namespace Avalonia.Controls.UnitTests window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.MinWidth = 720; window.MinHeight = 480; - //window.Width = 720; - //window.Height = 480; window.Show(); - - var expectedPosition = new PixelPoint(321, 36); - - Assert.Equal(window.Position, expectedPosition); + + Assert.Equal(new Size(720, 480), window.Bounds.Size); } } From 05f4bcad80fdbf621f57c34303b2207eb35ea519 Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 8 Jul 2022 23:40:08 -0400 Subject: [PATCH 343/393] Enable compiled bindings for ColorPicker and ColorView --- .../Themes/Fluent/ColorPicker.xaml | 2 +- .../Themes/Fluent/ColorView.xaml | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index b9133d6bfb..b34ac68be5 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -1,7 +1,7 @@  + x:CompileBindings="True"> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index a0687ed972..bcdb72d96c 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -5,7 +5,7 @@ xmlns:primitives="using:Avalonia.Controls.Primitives" xmlns:pc="clr-namespace:Avalonia.Controls.Primitives.Converters;assembly=Avalonia.Controls.ColorPicker" xmlns:globalization="clr-namespace:System.Globalization;assembly=mscorlib" - x:CompileBindings="False"> + x:CompileBindings="True"> @@ -244,12 +244,20 @@ - - + From 8f0b3911a5216dee5d44b5d5719f34b3a0ef2973 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 9 Jul 2022 12:22:57 +0200 Subject: [PATCH 344/393] Added failing tests for MenuItem.TemplatedParent. Seems #8412 caused `Menu.TemplatedParent` to get set to the parent `MenuItem` when re-opening a popup. --- .../MenuItemTests.cs | 44 ++++++ .../Primitives/PopupTests.cs | 147 +++++++++++++++++- 2 files changed, 190 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Controls.UnitTests/MenuItemTests.cs b/tests/Avalonia.Controls.UnitTests/MenuItemTests.cs index db31d22b4f..d25a790fde 100644 --- a/tests/Avalonia.Controls.UnitTests/MenuItemTests.cs +++ b/tests/Avalonia.Controls.UnitTests/MenuItemTests.cs @@ -8,6 +8,7 @@ using Avalonia.Data; using Avalonia.Input; using Avalonia.Platform; using Avalonia.UnitTests; +using Avalonia.VisualTree; using Moq; using Xunit; @@ -301,6 +302,49 @@ namespace Avalonia.Controls.UnitTests Assert.Equal(3, canExecuteCallCount); } } + + + [Fact] + public void TemplatedParent_Should_Not_Be_Applied_To_Submenus() + { + using (Application()) + { + MenuItem topLevelMenu; + MenuItem childMenu1; + MenuItem childMenu2; + var menu = new Menu + { + Items = new[] + { + (topLevelMenu = new MenuItem + { + Header = "Foo", + Items = new[] + { + (childMenu1 = new MenuItem { Header = "Bar" }), + (childMenu2 = new MenuItem { Header = "Baz" }), + } + }), + } + }; + + var window = new Window { Content = menu }; + window.LayoutManager.ExecuteInitialLayoutPass(); + + topLevelMenu.IsSubMenuOpen = true; + + Assert.True(((IVisual)childMenu1).IsAttachedToVisualTree); + Assert.Null(childMenu1.TemplatedParent); + Assert.Null(childMenu2.TemplatedParent); + + topLevelMenu.IsSubMenuOpen = false; + topLevelMenu.IsSubMenuOpen = true; + + Assert.Null(childMenu1.TemplatedParent); + Assert.Null(childMenu2.TemplatedParent); + } + } + private IDisposable Application() { var screen = new PixelRect(new PixelPoint(), new PixelSize(100, 100)); diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs index d9cb40d1cc..5f91f2e2a1 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs @@ -295,7 +295,7 @@ namespace Avalonia.Controls.UnitTests.Primitives } [Fact] - public void Templated_Control_With_Popup_In_Template_Should_Set_TemplatedParent() + public void ContentControl_With_Popup_In_Template_Should_Set_TemplatedParent() { // Test uses OverlayPopupHost default template using (CreateServices()) @@ -384,6 +384,134 @@ namespace Avalonia.Controls.UnitTests.Primitives } } + [Fact] + public void ItemsControl_With_Popup_In_Template_Should_Set_TemplatedParent() + { + // Test uses OverlayPopupHost default template + using (CreateServices()) + { + PopupItemsControl target; + var item = new Border(); + var root = PreparedWindow(target = new PopupItemsControl + { + Items = new[] { item }, + Template = new FuncControlTemplate(PopupItemsControlTemplate), + }); ; + root.Show(); + + target.ApplyTemplate(); + + var popup = (Popup)target.GetTemplateChildren().First(x => x.Name == "popup"); + popup.Open(); + + var popupRoot = (Control)popup.Host; + popupRoot.Measure(Size.Infinity); + popupRoot.Arrange(new Rect(popupRoot.DesiredSize)); + + var children = popupRoot.GetVisualDescendants().ToList(); + var types = children.Select(x => x.GetType().Name).ToList(); + + if (UsePopupHost) + { + Assert.Equal( + new[] + { + "LayoutTransformControl", + "VisualLayerManager", + "ContentPresenter", + "ItemsPresenter", + "StackPanel", + "Border", + }, + types); + } + else + { + Assert.Equal( + new[] + { + "LayoutTransformControl", + "Panel", + "Border", + "VisualLayerManager", + "ContentPresenter", + "ItemsPresenter", + "StackPanel", + "Border", + }, + types); + } + + var templatedParents = children + .OfType() + .Select(x => x.TemplatedParent).ToList(); + + if (UsePopupHost) + { + Assert.Equal( + new object[] + { + popupRoot, + popupRoot, + popupRoot, + target, + target, + null, + }, + templatedParents); + } + else + { + Assert.Equal( + new object[] + { + popupRoot, + popupRoot, + popupRoot, + popupRoot, + popupRoot, + target, + target, + null, + }, + templatedParents); + } + } + } + + [Fact] + public void Should_Not_Overwrite_TemplatedParent_Of_Item_In_ItemsControl_With_Popup_On_Second_Open() + { + // Test uses OverlayPopupHost default template + using (CreateServices()) + { + PopupItemsControl target; + var item = new Border(); + var root = PreparedWindow(target = new PopupItemsControl + { + Items = new[] { item }, + Template = new FuncControlTemplate(PopupItemsControlTemplate), + }); + root.Show(); + + target.ApplyTemplate(); + + var popup = (Popup)target.GetTemplateChildren().First(x => x.Name == "popup"); + popup.Open(); + + var popupRoot = (Control)popup.Host; + popupRoot.Measure(Size.Infinity); + popupRoot.Arrange(new Rect(popupRoot.DesiredSize)); + + Assert.Null(item.TemplatedParent); + + popup.Close(); + popup.Open(); + + Assert.Null(item.TemplatedParent); + } + } + [Fact] public void DataContextBeginUpdate_Should_Not_Be_Called_For_Controls_That_Dont_Inherit() { @@ -979,10 +1107,27 @@ namespace Avalonia.Controls.UnitTests.Primitives }.RegisterInNameScope(scope); } + private static IControl PopupItemsControlTemplate(PopupItemsControl control, INameScope scope) + { + return new Popup + { + Name = "popup", + PlacementTarget = control, + Child = new ItemsPresenter + { + [~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty], + } + }.RegisterInNameScope(scope); + } + private class PopupContentControl : ContentControl { } + private class PopupItemsControl : ItemsControl + { + } + private class TestControl : Decorator { public event EventHandler DataContextBeginUpdate; From 78a7257a5a3a0cd33ad77382d4d0c29759263dfa Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 9 Jul 2022 12:32:22 +0200 Subject: [PATCH 345/393] Don't apply templated parent if already set. When applying the `TemplatedParent`, don't move into trees that already have the `TemplatedParent` property set - in this case we can assume that the templated parent has already been set for this tree, and it fixes the problem with menus added in the previous commit. --- src/Avalonia.Controls/Primitives/TemplatedControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index 4403bfce51..c3e0f3e523 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -396,7 +396,7 @@ namespace Avalonia.Controls.Primitives for (var i = 0; i < count; i++) { - if (children[i] is IStyledElement child) + if (children[i] is IStyledElement child && child.TemplatedParent is null) { ApplyTemplatedParent(child, templatedParent); } From 5da9d528c9a9901afa6cd6e856b9055022cdb706 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 9 Jul 2022 14:50:52 +0200 Subject: [PATCH 346/393] Added missing param docs. --- src/Avalonia.Controls/Primitives/TemplatedControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index c3e0f3e523..e50f991cdb 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -387,6 +387,7 @@ namespace Avalonia.Controls.Primitives /// Sets the TemplatedParent property for the created template children. /// /// The control. + /// The templated parent to apply. internal static void ApplyTemplatedParent(IStyledElement control, ITemplatedControl? templatedParent) { control.SetValue(TemplatedParentProperty, templatedParent); From 435419588a3702efc1f67eec7a6865c64a03cbb5 Mon Sep 17 00:00:00 2001 From: Eric M Date: Wed, 6 Jul 2022 21:18:40 +1000 Subject: [PATCH 347/393] Allow customisation of ProgressBar text format. --- .../ControlCatalog/Pages/ProgressBarPage.xaml | 27 ++++++++++++++----- .../Converters/StringFormatConverter.cs | 27 +++++++++++++++++++ src/Avalonia.Controls/ProgressBar.cs | 23 ++++++++++++++++ .../Controls/ProgressBar.xaml | 21 ++++++++++++--- .../Controls/ProgressBar.xaml | 16 ++++++++++- 5 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 src/Avalonia.Controls/Converters/StringFormatConverter.cs diff --git a/samples/ControlCatalog/Pages/ProgressBarPage.xaml b/samples/ControlCatalog/Pages/ProgressBarPage.xaml index db7d7d3280..8e73f1d0f5 100644 --- a/samples/ControlCatalog/Pages/ProgressBarPage.xaml +++ b/samples/ControlCatalog/Pages/ProgressBarPage.xaml @@ -1,22 +1,37 @@ A progress bar control - + + + Maximum + + + + Minimum + + + + Progress Text Format + + - + - + - - + + - + diff --git a/src/Avalonia.Controls/Converters/StringFormatConverter.cs b/src/Avalonia.Controls/Converters/StringFormatConverter.cs new file mode 100644 index 0000000000..ae920dac7e --- /dev/null +++ b/src/Avalonia.Controls/Converters/StringFormatConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Avalonia.Data; +using Avalonia.Data.Converters; + +namespace Avalonia.Controls.Converters; + +/// +/// Calls on the passed in values, where the first element in the list +/// is the string, and everything after it is passed into the object array in order. +/// +public class StringFormatConverter : IMultiValueConverter +{ + public object? Convert(IList values, Type targetType, object? parameter, CultureInfo culture) + { + try + { + return string.Format((string)values[0]!, values.Skip(1).ToArray()); + } + catch (Exception e) + { + return new BindingNotification(e, BindingErrorType.Error); + } + } +} diff --git a/src/Avalonia.Controls/ProgressBar.cs b/src/Avalonia.Controls/ProgressBar.cs index 1075328c67..70edeadfd9 100644 --- a/src/Avalonia.Controls/ProgressBar.cs +++ b/src/Avalonia.Controls/ProgressBar.cs @@ -96,6 +96,7 @@ namespace Avalonia.Controls } } + private double _percentage; private double _indeterminateStartingOffset; private double _indeterminateEndingOffset; private Border? _indicator; @@ -106,9 +107,17 @@ namespace Avalonia.Controls public static readonly StyledProperty ShowProgressTextProperty = AvaloniaProperty.Register(nameof(ShowProgressText)); + public static readonly StyledProperty ProgressTextFormatProperty = + AvaloniaProperty.Register(nameof(ProgressTextFormat), "{1:0}%"); + public static readonly StyledProperty OrientationProperty = AvaloniaProperty.Register(nameof(Orientation), Orientation.Horizontal); + public static readonly DirectProperty PercentageProperty = + AvaloniaProperty.RegisterDirect( + nameof(Percentage), + o => o.Percentage); + [Obsolete("To be removed when Avalonia.Themes.Default is discontinued.")] public static readonly DirectProperty IndeterminateStartingOffsetProperty = AvaloniaProperty.RegisterDirect( @@ -123,6 +132,12 @@ namespace Avalonia.Controls p => p.IndeterminateEndingOffset, (p, o) => p.IndeterminateEndingOffset = o); + public double Percentage + { + get { return _percentage; } + private set { SetAndRaise(PercentageProperty, ref _percentage, value); } + } + [Obsolete("To be removed when Avalonia.Themes.Default is discontinued.")] public double IndeterminateStartingOffset { @@ -165,6 +180,12 @@ namespace Avalonia.Controls set => SetValue(ShowProgressTextProperty, value); } + public string ProgressTextFormat + { + get => GetValue(ProgressTextFormatProperty); + set => SetValue(ProgressTextFormatProperty, value); + } + public Orientation Orientation { get => GetValue(OrientationProperty); @@ -245,6 +266,8 @@ namespace Avalonia.Controls _indicator.Width = bounds.Width * percent; else _indicator.Height = bounds.Height * percent; + + Percentage = percent * 100; } } } diff --git a/src/Avalonia.Themes.Default/Controls/ProgressBar.xaml b/src/Avalonia.Themes.Default/Controls/ProgressBar.xaml index fd847b5d65..3f684f3936 100644 --- a/src/Avalonia.Themes.Default/Controls/ProgressBar.xaml +++ b/src/Avalonia.Themes.Default/Controls/ProgressBar.xaml @@ -1,4 +1,6 @@ - + @@ -11,10 +13,13 @@ From 4ca4986b4f6e6bf31e7e53a5de531895a33b8ee7 Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Tue, 12 Jul 2022 15:58:58 +0200 Subject: [PATCH 362/393] rename --- src/Avalonia.Base/Controls/IPseudoClasses.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Base/Controls/IPseudoClasses.cs b/src/Avalonia.Base/Controls/IPseudoClasses.cs index 45013ee069..438b05a8cf 100644 --- a/src/Avalonia.Base/Controls/IPseudoClasses.cs +++ b/src/Avalonia.Base/Controls/IPseudoClasses.cs @@ -25,6 +25,6 @@ namespace Avalonia.Controls /// /// The pseudoclass name. /// Whether the pseudoclass is present. - bool Has(string name); + bool Contains(string name); } } From d1f3c4d691c3e8336b3f98dc7f524b3fc30f515b Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Tue, 12 Jul 2022 17:04:03 +0300 Subject: [PATCH 363/393] [mac] Don't update layer if IOSurface doesn't have any valid content yet --- native/Avalonia.Native/src/OSX/rendertarget.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native/Avalonia.Native/src/OSX/rendertarget.mm b/native/Avalonia.Native/src/OSX/rendertarget.mm index 266d0345d1..2075cc85ab 100644 --- a/native/Avalonia.Native/src/OSX/rendertarget.mm +++ b/native/Avalonia.Native/src/OSX/rendertarget.mm @@ -13,6 +13,7 @@ { @public IOSurfaceRef surface; @public AvnPixelSize size; + @public bool hasContent; @public float scale; ComPtr _context; GLuint _framebuffer, _texture, _renderbuffer; @@ -41,6 +42,7 @@ self->scale = scale; self->size = size; self->_context = context; + self->hasContent = false; return self; } @@ -92,6 +94,7 @@ _context->MakeCurrent(release.getPPV()); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glFlush(); + self->hasContent = true; } -(void) dealloc @@ -170,6 +173,8 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta @synchronized (lock) { if(_layer == nil) return; + if(!surface->hasContent) + return; [CATransaction begin]; [_layer setContents: nil]; if(surface != nil) @@ -213,6 +218,7 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta memcpy(pSurface + y*sstride, pFb + y*fstride, wbytes); } IOSurfaceUnlock(surf, 0, nil); + surface->hasContent = true; [self updateLayer]; return S_OK; } From ecca63949f3377d566197712a512c42431fca3aa Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Tue, 12 Jul 2022 19:43:24 +0300 Subject: [PATCH 364/393] Use Blit when available --- .../Composition/Server/ServerCompositionTarget.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index 3351caf0c6..0fde86e484 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -122,9 +122,12 @@ namespace Avalonia.Rendering.Composition.Server targetContext.Clear(Colors.Transparent); targetContext.Transform = Matrix.Identity; - targetContext.DrawBitmap(RefCountable.CreateUnownedNotClonable(_layer), 1, - new Rect(_layerSize), - new Rect(Size), BitmapInterpolationMode.LowQuality); + if (_layer.CanBlit) + _layer.Blit(targetContext); + else + targetContext.DrawBitmap(RefCountable.CreateUnownedNotClonable(_layer), 1, + new Rect(_layerSize), + new Rect(Size), BitmapInterpolationMode.LowQuality); if (DrawDirtyRects) From 551f35a760f08062be6e8d41f05c4d58495a8493 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 13 Jul 2022 07:41:55 +0300 Subject: [PATCH 365/393] Cleanup --- ...cs => ServerCompositionContainerVisual.cs} | 0 .../ServerCompositionLinearGradientBrush.cs | 22 ------------------- ...erverCompositionVisual.DirtyProperties.cs} | 0 ...erVisual.cs => ServerCompositionVisual.cs} | 0 4 files changed, 22 deletions(-) rename src/Avalonia.Base/Rendering/Composition/Server/{ServerContainerVisual.cs => ServerCompositionContainerVisual.cs} (100%) delete mode 100644 src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs rename src/Avalonia.Base/Rendering/Composition/Server/{ServerVisual.DirtyProperties.cs => ServerCompositionVisual.DirtyProperties.cs} (100%) rename src/Avalonia.Base/Rendering/Composition/Server/{ServerVisual.cs => ServerCompositionVisual.cs} (100%) diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionContainerVisual.cs similarity index 100% rename from src/Avalonia.Base/Rendering/Composition/Server/ServerContainerVisual.cs rename to src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionContainerVisual.cs diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs deleted file mode 100644 index c421cdcfb0..0000000000 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionLinearGradientBrush.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Avalonia.Media; - -namespace Avalonia.Rendering.Composition.Server -{ - internal partial class ServerCompositionLinearGradientBrush - { - /* - protected override void UpdateBackendBrush(ICbBrush brush) - { - var stopColors = new Color[Stops.List.Count]; - var offsets = new float[Stops.List.Count]; - for (var c = 0; c < Stops.List.Count; c++) - { - stopColors[c] = Stops.List[c].Color; - offsets[c] = Stops.List[c].Offset; - } - - ((ICbLinearGradientBrush) brush).Update(StartPoint, EndPoint, stopColors, offsets, ExtendMode); - }*/ - - } -} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.DirtyProperties.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.DirtyProperties.cs similarity index 100% rename from src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.DirtyProperties.cs rename to src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.DirtyProperties.cs diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs similarity index 100% rename from src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs rename to src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs From 221a0f134148914ccaff159e60fbc1859fef5924 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 13 Jul 2022 07:44:05 +0300 Subject: [PATCH 366/393] Removed workaround from headless platform memory measurement code --- samples/ControlCatalog.NetCore/Program.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 07d514df6b..cfa016d814 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -60,12 +60,6 @@ namespace ControlCatalog.NetCore }) .AfterSetup(_ => { - static Task LowPriorityDelay(int ms) - { - return Task.Delay(ms).ContinueWith(_ => - Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Background)) - .Unwrap(); - } DispatcherTimer.RunOnce(async () => { var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime) @@ -77,7 +71,7 @@ namespace ControlCatalog.NetCore continue; Console.WriteLine("Selecting " + page.Header); tc.SelectedItem = page; - await LowPriorityDelay(20); + await Task.Delay(50); } Console.WriteLine("Selecting the first page"); tc.SelectedItem = tc.Items.OfType().First(); @@ -86,7 +80,7 @@ namespace ControlCatalog.NetCore for (var c = 0; c < 3; c++) { GC.Collect(2, GCCollectionMode.Forced); - await Task.Delay(00); + await Task.Delay(50); } void FormatMem(string metric, long bytes) From 7746b79fb5d21a17d055cb2b7dbdbd1c1577a5bc Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 13 Jul 2022 10:46:31 +0100 Subject: [PATCH 367/393] close app after running --- tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs b/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs index b3385d8ee7..70052b672c 100644 --- a/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs +++ b/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs @@ -57,6 +57,7 @@ namespace Avalonia.IntegrationTests.Appium { try { + Session.CloseApp(); Session.Close(); } catch From e0c1bae8422d052d55085bb24507e04480cc0fe5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 13 Jul 2022 10:56:15 +0100 Subject: [PATCH 368/393] use pkill to close app. --- tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs | 1 - .../Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs b/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs index 70052b672c..b3385d8ee7 100644 --- a/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs +++ b/tests/Avalonia.IntegrationTests.Appium/TestAppFixture.cs @@ -57,7 +57,6 @@ namespace Avalonia.IntegrationTests.Appium { try { - Session.CloseApp(); Session.Close(); } catch diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index 635c593f37..b3cba2c5ea 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -6,4 +6,6 @@ git clean -xdf ./build.sh CompileNative ./samples/IntegrationTestApp/bundle.sh open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app +pkill IntegrationTestApp dotnet test tests/Avalonia.IntegrationTests.Appium/ -l "console;verbosity=detailed" +pkill IntegrationTestApp From d59c9feac9a0d70494fef36a5718af37b1a7f075 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 13 Jul 2022 11:11:58 +0100 Subject: [PATCH 369/393] make sure any existing instances are closed. --- tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index b3cba2c5ea..5018e78d68 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -3,6 +3,7 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) cd "$SCRIPT_DIR"/../.. || exit git clean -xdf +pkill IntegrationTestApp ./build.sh CompileNative ./samples/IntegrationTestApp/bundle.sh open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app From af0014b735115fea8f3cd7527a51295719a6a6b6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 13 Jul 2022 12:16:48 +0200 Subject: [PATCH 370/393] Added --debug switch to benchmarks. To be able to run benchmarks in the debugger, you need to pass `DebugInProcessConfig` to the benchmark switcher. There doesn't seem to be any inbuilt switch to enable this from the command-line, so added one to the benchmarks projects in order to be able to debug benchmarks more easily. --- tests/Avalonia.Benchmarks/Program.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Benchmarks/Program.cs b/tests/Avalonia.Benchmarks/Program.cs index 903778ff00..8f7aa3eb79 100644 --- a/tests/Avalonia.Benchmarks/Program.cs +++ b/tests/Avalonia.Benchmarks/Program.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using System.Linq; using System.Reflection; using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; namespace Avalonia.Benchmarks @@ -19,7 +21,17 @@ namespace Avalonia.Benchmarks .ThenBy(t => t.Name) .ToArray(); var benchmarkSwitcher = new BenchmarkSwitcher(benchmarks); - benchmarkSwitcher.Run(args); + IConfig config = null; + + if (args.Contains("--debug")) + { + config = new DebugInProcessConfig(); + var a = new List(args); + a.Remove("--debug"); + args = a.ToArray(); + } + + benchmarkSwitcher.Run(args, config); } } } From 5d69d1648da64674d2e3ae15707790c025933121 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 13 Jul 2022 15:57:11 +0100 Subject: [PATCH 371/393] run appium and restart it each time. --- .../Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index 5018e78d68..b03a8a7a69 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -3,6 +3,8 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) cd "$SCRIPT_DIR"/../.. || exit git clean -xdf +pkill node +appium & pkill IntegrationTestApp ./build.sh CompileNative ./samples/IntegrationTestApp/bundle.sh @@ -10,3 +12,4 @@ open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/Integrat pkill IntegrationTestApp dotnet test tests/Avalonia.IntegrationTests.Appium/ -l "console;verbosity=detailed" pkill IntegrationTestApp +pkill node From ebf464ad93173cccb46470c4363b0ea322101c9e Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Thu, 14 Jul 2022 13:12:16 +0300 Subject: [PATCH 372/393] Enable compositing renderer by default for desktop platforms --- samples/ControlCatalog.NetCore/Program.cs | 6 ++---- src/Avalonia.X11/X11Platform.cs | 4 ++-- src/Windows/Avalonia.Win32/Win32Platform.cs | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index cfa016d814..d98a068d84 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -113,13 +113,11 @@ namespace ControlCatalog.NetCore { EnableMultiTouch = true, UseDBusMenu = true, - EnableIme = true, - UseCompositor = true + EnableIme = true }) .With(new Win32PlatformOptions { - EnableMultitouch = true, - UseCompositor = true + EnableMultitouch = true }) .UseSkia() .AfterSetup(builder => diff --git a/src/Avalonia.X11/X11Platform.cs b/src/Avalonia.X11/X11Platform.cs index b5fbebca4b..edb320d4f0 100644 --- a/src/Avalonia.X11/X11Platform.cs +++ b/src/Avalonia.X11/X11Platform.cs @@ -235,8 +235,8 @@ namespace Avalonia /// Immediate re-renders the whole scene when some element is changed on the scene. Deferred re-renders only changed elements. /// public bool UseDeferredRendering { get; set; } = true; - - public bool UseCompositor { get; set; } + + public bool UseCompositor { get; set; } = true; /// /// Determines whether to use IME. diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index f71d514e38..73ef50052c 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -49,8 +49,8 @@ namespace Avalonia /// Immediate re-renders the whole scene when some element is changed on the scene. Deferred re-renders only changed elements. /// public bool UseDeferredRendering { get; set; } = true; - - public bool UseCompositor { get; set; } + + public bool UseCompositor { get; set; } = true; /// /// Enables ANGLE for Windows. For every Windows version that is above Windows 7, the default is true otherwise it's false. From 3e5afd1fc3f6b89210bf78e25bc46739db63942e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 14 Jul 2022 20:19:34 +0100 Subject: [PATCH 373/393] appium v1 tests on mac --- azure-pipelines-integrationtests.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index c3f6292703..7954b970de 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -12,8 +12,23 @@ jobs: name: 'AvaloniaMacPool' steps: - - script: ./tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh - displayName: 'run integration tests' + - script: | + pkill node + appium & + pkill IntegrationTestApp + ./build.sh CompileNative + ./samples/IntegrationTestApp/bundle.sh + open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app + pkill IntegrationTestApp + + - task: DotNetCoreCLI@2 + inputs: + command: 'test' + projects: 'tests/Avalonia.IntegrationTests.Appium/Avalonia.IntegrationTests.Appium.csproj' + + - script: | + pkill IntegrationTestApp + pkill node - job: Windows From 121a6e31b129dfbd00bbec4bcca7ab5555622665 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 14 Jul 2022 20:29:06 +0100 Subject: [PATCH 374/393] print mac os display res. --- azure-pipelines-integrationtests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 7954b970de..10f098b607 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -12,6 +12,8 @@ jobs: name: 'AvaloniaMacPool' steps: + - script: system_profiler SPDisplaysDataType |grep Resolution + - script: | pkill node appium & From 0bf3a6d94487c0bf795bf5521c115d5b12a4ac8f Mon Sep 17 00:00:00 2001 From: robloo Date: Thu, 14 Jul 2022 23:57:27 -0400 Subject: [PATCH 375/393] Rename `ShowAccentColors` to `IsAccentColorsVisible` and disable drop shadow when false --- .../ControlCatalog/Pages/ColorPickerPage.xaml | 2 +- .../ColorPreviewer.Properties.cs | 14 +- .../ColorView/ColorView.Properties.cs | 32 ++--- .../Themes/Default/ColorPreviewer.xaml | 122 ++++++++++-------- .../Themes/Fluent/ColorPicker.xaml | 4 +- .../Themes/Fluent/ColorPreviewer.xaml | 122 ++++++++++-------- .../Themes/Fluent/ColorView.xaml | 2 +- 7 files changed, 167 insertions(+), 131 deletions(-) diff --git a/samples/ControlCatalog/Pages/ColorPickerPage.xaml b/samples/ControlCatalog/Pages/ColorPickerPage.xaml index 486a36956f..1590be25ba 100644 --- a/samples/ControlCatalog/Pages/ColorPickerPage.xaml +++ b/samples/ControlCatalog/Pages/ColorPickerPage.xaml @@ -47,7 +47,7 @@ ColorModel="Hsva" HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" /> - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty ShowAccentColorsProperty = + public static readonly StyledProperty IsAccentColorsVisibleProperty = AvaloniaProperty.Register( - nameof(ShowAccentColors), + nameof(IsAccentColorsVisible), true); /// @@ -38,13 +38,13 @@ namespace Avalonia.Controls.Primitives } /// - /// Gets or sets a value indicating whether accent colors are shown along + /// Gets or sets a value indicating whether accent colors are visible along /// with the preview color. /// - public bool ShowAccentColors + public bool IsAccentColorsVisible { - get => GetValue(ShowAccentColorsProperty); - set => SetValue(ShowAccentColorsProperty, value); + get => GetValue(IsAccentColorsVisibleProperty); + set => SetValue(IsAccentColorsVisibleProperty, value); } } } diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index d59c4d544a..b76059037b 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -52,6 +52,14 @@ namespace Avalonia.Controls defaultBindingMode: BindingMode.TwoWay, coerce: CoerceHsvColor); + /// + /// Defines the property. + /// + public static readonly StyledProperty IsAccentColorsVisibleProperty = + AvaloniaProperty.Register( + nameof(IsAccentColorsVisible), + true); + /// /// Defines the property. /// @@ -220,14 +228,6 @@ namespace Avalonia.Controls nameof(SelectedIndex), (int)ColorViewTab.Spectrum); - /// - /// Defines the property. - /// - public static readonly StyledProperty ShowAccentColorsProperty = - AvaloniaProperty.Register( - nameof(ShowAccentColors), - true); - /// public Color Color { @@ -267,6 +267,13 @@ namespace Avalonia.Controls set => SetValue(HsvColorProperty, value); } + /// + public bool IsAccentColorsVisible + { + get => GetValue(IsAccentColorsVisibleProperty); + set => SetValue(IsAccentColorsVisibleProperty, value); + } + /// /// Gets or sets a value indicating whether the alpha component is enabled. /// When disabled (set to false) the alpha component will be fixed to maximum and @@ -325,7 +332,7 @@ namespace Avalonia.Controls /// /// /// Note that accent color visibility is controlled separately by - /// . + /// . /// public bool IsColorPreviewVisible { @@ -484,12 +491,5 @@ namespace Avalonia.Controls get => GetValue(SelectedIndexProperty); set => SetValue(SelectedIndexProperty, value); } - - /// - public bool ShowAccentColors - { - get => GetValue(ShowAccentColorsProperty); - set => SetValue(ShowAccentColorsProperty, value); - } } } diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml index 3a4efaa42a..c3bc7df4a4 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Default/ColorPreviewer.xaml @@ -14,69 +14,87 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + - - + BoxShadow="0 0 10 2 #BF000000" + CornerRadius="{TemplateBinding CornerRadius}" + Margin="10"> + + + + + - - + + - - + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index b34ac68be5..a4d5ff673f 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -53,6 +53,7 @@ ColorSpectrumComponents="{TemplateBinding ColorSpectrumComponents}" ColorSpectrumShape="{TemplateBinding ColorSpectrumShape}" HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}" IsAlphaEnabled="{TemplateBinding IsAlphaEnabled}" IsAlphaVisible="{TemplateBinding IsAlphaVisible}" IsColorComponentsVisible="{TemplateBinding IsColorComponentsVisible}" @@ -73,8 +74,7 @@ PaletteColors="{TemplateBinding PaletteColors}" PaletteColumnCount="{TemplateBinding PaletteColumnCount}" Palette="{TemplateBinding Palette}" - SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" - ShowAccentColors="{TemplateBinding ShowAccentColors}" /> + SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" /> diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml index 77059f14fb..74f33d1258 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPreviewer.xaml @@ -14,69 +14,87 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + - - + BoxShadow="0 0 10 2 #BF000000" + CornerRadius="{TemplateBinding CornerRadius}" + Margin="10"> + + + + + - - + + - - + diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index bcdb72d96c..e25e822f3f 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -638,8 +638,8 @@ From bb4287e22de38014cc6ba05e94c104188f68725e Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 15 Jul 2022 13:28:29 +0200 Subject: [PATCH 376/393] fix: RowDesiredWidth was missing the RowHeaderWidth --- .../Primitives/DataGridRowsPresenter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs b/src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs index 5d82689eff..d906cd359c 100644 --- a/src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs +++ b/src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs @@ -97,7 +97,7 @@ namespace Avalonia.Controls.Primitives OwningGrid.OnFillerColumnWidthNeeded(finalSize.Width); - double rowDesiredWidth = OwningGrid.ColumnsInternal.VisibleEdgedColumnsWidth + OwningGrid.ColumnsInternal.FillerColumn.FillerWidth; + double rowDesiredWidth = OwningGrid.RowHeadersDesiredWidth + OwningGrid.ColumnsInternal.VisibleEdgedColumnsWidth + OwningGrid.ColumnsInternal.FillerColumn.FillerWidth; double topEdge = -OwningGrid.NegVerticalOffset; foreach (Control element in OwningGrid.DisplayData.GetScrollingElements()) { From c3bb062a3705341666649aa5a949ccdd4b543faa Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 15 Jul 2022 14:08:29 +0100 Subject: [PATCH 377/393] ensure bundle id is registered. --- .../Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index b03a8a7a69..e60eb47a81 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -7,9 +7,12 @@ pkill node appium & pkill IntegrationTestApp ./build.sh CompileNative +rm -rf ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app +open -b net.avaloniaui.avalonia.integrationtestapp ./samples/IntegrationTestApp/bundle.sh open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app pkill IntegrationTestApp +open -b net.avaloniaui.avalonia.integrationtestapp dotnet test tests/Avalonia.IntegrationTests.Appium/ -l "console;verbosity=detailed" pkill IntegrationTestApp pkill node From e8914c966d8f33be44df6007114569d4099072b4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 15 Jul 2022 14:17:55 +0100 Subject: [PATCH 378/393] reliably replace old bundle. --- azure-pipelines-integrationtests.yml | 2 ++ .../macos-clean-build-test.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml index 10f098b607..0b79758c76 100644 --- a/azure-pipelines-integrationtests.yml +++ b/azure-pipelines-integrationtests.yml @@ -19,6 +19,8 @@ jobs: appium & pkill IntegrationTestApp ./build.sh CompileNative + rm -rf $(osascript -e "POSIX path of (path to application id \"net.avaloniaui.avalonia.integrationtestapp\")") + pkill IntegrationTestApp ./samples/IntegrationTestApp/bundle.sh open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app pkill IntegrationTestApp diff --git a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh index e60eb47a81..14e765d16a 100755 --- a/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh +++ b/tests/Avalonia.IntegrationTests.Appium/macos-clean-build-test.sh @@ -7,8 +7,8 @@ pkill node appium & pkill IntegrationTestApp ./build.sh CompileNative -rm -rf ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app -open -b net.avaloniaui.avalonia.integrationtestapp +rm -rf $(osascript -e "POSIX path of (path to application id \"net.avaloniaui.avalonia.integrationtestapp\")") +pkill IntegrationTestApp ./samples/IntegrationTestApp/bundle.sh open -n ./samples/IntegrationTestApp/bin/Debug/net6.0/osx-arm64/publish/IntegrationTestApp.app pkill IntegrationTestApp From b9998dd4839b27516d2006c3633ec302c72495c5 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 15 Jul 2022 15:56:59 +0200 Subject: [PATCH 379/393] Don't use TransformedBounds for automation. --- .../Automation/Peers/ControlAutomationPeer.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs b/src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs index 28cb3e34b2..a93d3fa7dd 100644 --- a/src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs +++ b/src/Avalonia.Controls/Automation/Peers/ControlAutomationPeer.cs @@ -146,7 +146,7 @@ namespace Avalonia.Automation.Peers protected override string? GetAccessKeyCore() => AutomationProperties.GetAccessKey(Owner); protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Custom; protected override string? GetAutomationIdCore() => AutomationProperties.GetAutomationId(Owner) ?? Owner.Name; - protected override Rect GetBoundingRectangleCore() => GetBounds(Owner.TransformedBounds); + protected override Rect GetBoundingRectangleCore() => GetBounds(Owner); protected override string GetClassNameCore() => Owner.GetType().Name; protected override bool HasKeyboardFocusCore() => Owner.IsFocused; protected override bool IsContentElementCore() => AutomationProperties.GetAccessibilityView(Owner) >= AccessibilityView.Content; @@ -160,9 +160,19 @@ namespace Avalonia.Automation.Peers return AutomationProperties.GetControlTypeOverride(Owner) ?? GetAutomationControlTypeCore(); } - private static Rect GetBounds(TransformedBounds? bounds) + private static Rect GetBounds(Control control) { - return bounds?.Bounds.TransformToAABB(bounds!.Value.Transform) ?? default; + var root = control.GetVisualRoot(); + + if (root is null) + return default; + + var transform = control.TransformToVisual(root); + + if (!transform.HasValue) + return default; + + return new Rect(control.Bounds.Size).TransformToAABB(transform.Value); } private void Initialize() @@ -182,12 +192,14 @@ namespace Avalonia.Automation.Peers if (parent is Control c) (GetOrCreate(c) as ControlAutomationPeer)?.InvalidateChildren(); } - else if (e.Property == Visual.TransformedBoundsProperty) + else if (e.Property == Visual.BoundsProperty || + e.Property == Visual.RenderTransformProperty || + e.Property == Visual.RenderTransformOriginProperty) { RaisePropertyChangedEvent( AutomationElementIdentifiers.BoundingRectangleProperty, - GetBounds((TransformedBounds?)e.OldValue), - GetBounds((TransformedBounds?)e.NewValue)); + null, + GetBounds(Owner)); } else if (e.Property == Visual.VisualParentProperty) { From ac30a64d785b6c2c047c59faee33c3ad9555fa5a Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 15 Jul 2022 15:24:15 +0100 Subject: [PATCH 380/393] dont use window size that could go off screen. --- tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs index 15ca78fdac..ecbdd5bade 100644 --- a/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs +++ b/tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs @@ -137,7 +137,7 @@ namespace Avalonia.IntegrationTests.Appium { var mainWindow = _session.FindElementByAccessibilityId("MainWindow"); - using (OpenWindow(new PixelSize(1400, 100), ShowWindowMode.NonOwned, WindowStartupLocation.Manual)) + using (OpenWindow(new PixelSize(800, 100), ShowWindowMode.NonOwned, WindowStartupLocation.Manual)) { mainWindow.Click(); From c1b75357f1b24f578a33328be407ef19c3f90153 Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Fri, 15 Jul 2022 16:56:15 +0200 Subject: [PATCH 381/393] Allow to pass custom menu interaction handler in MenuFlyoutPresenter --- src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs | 5 +++++ src/Avalonia.Controls/MenuBase.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs b/src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs index 6a7da87387..278e498a67 100644 --- a/src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs +++ b/src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs @@ -11,9 +11,14 @@ namespace Avalonia.Controls public MenuFlyoutPresenter() :base(new DefaultMenuInteractionHandler(true)) { + } + public MenuFlyoutPresenter(IMenuInteractionHandler menuInteractionHandler) + : base(menuInteractionHandler) + { } + public override void Close() { // DefaultMenuInteractionHandler calls this diff --git a/src/Avalonia.Controls/MenuBase.cs b/src/Avalonia.Controls/MenuBase.cs index 122d45d033..54cbc46a36 100644 --- a/src/Avalonia.Controls/MenuBase.cs +++ b/src/Avalonia.Controls/MenuBase.cs @@ -40,7 +40,7 @@ namespace Avalonia.Controls /// /// Initializes a new instance of the class. /// - public MenuBase() + protected MenuBase() { InteractionHandler = new DefaultMenuInteractionHandler(false); } @@ -49,7 +49,7 @@ namespace Avalonia.Controls /// Initializes a new instance of the class. /// /// The menu interaction handler. - public MenuBase(IMenuInteractionHandler interactionHandler) + protected MenuBase(IMenuInteractionHandler interactionHandler) { InteractionHandler = interactionHandler ?? throw new ArgumentNullException(nameof(interactionHandler)); } From 0dca4bebc17e0cf640f066a4c1a4e6cc0f3b1dc1 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 16 Jul 2022 01:26:02 -0400 Subject: [PATCH 382/393] Disable additional aot flags --- samples/ControlCatalog.Android/ControlCatalog.Android.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj index e52430f50b..54acdd9114 100644 --- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj +++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj @@ -21,12 +21,12 @@ True - + True From c6e12a6e321d1e6a5dc6f46f31dab7cd45ed4a37 Mon Sep 17 00:00:00 2001 From: petris Date: Sat, 16 Jul 2022 20:23:49 +0200 Subject: [PATCH 383/393] Fix unaligned accesses --- .../Rendering/Composition/Transport/BatchStream.cs | 6 +++--- src/Avalonia.X11/X11Structs.cs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs index 65237473fb..6db480a966 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs @@ -72,7 +72,7 @@ internal class BatchStreamWriter : IDisposable var size = Unsafe.SizeOf(); if (_currentDataSegment.Data == IntPtr.Zero || _currentDataSegment.ElementCount + size > _memoryPool.BufferSize) NextDataSegment(); - *(T*)((byte*)_currentDataSegment.Data + _currentDataSegment.ElementCount) = item; + Unsafe.WriteUnaligned((byte*)_currentDataSegment.Data + _currentDataSegment.ElementCount, item); _currentDataSegment.ElementCount += size; } @@ -123,7 +123,7 @@ internal class BatchStreamReader : IDisposable if (_memoryOffset + size > _currentDataSegment.ElementCount) throw new InvalidOperationException("Attempted to read more memory then left in the current segment"); - var rv = *(T*)((byte*)_currentDataSegment.Data + _memoryOffset); + var rv = Unsafe.ReadUnaligned((byte*)_currentDataSegment.Data + _memoryOffset); _memoryOffset += size; if (_memoryOffset == _currentDataSegment.ElementCount) { @@ -181,4 +181,4 @@ internal class BatchStreamReader : IDisposable while (_input.Objects.Count > 0) _objectPool.Return(_input.Objects.Dequeue().Data); } -} \ No newline at end of file +} diff --git a/src/Avalonia.X11/X11Structs.cs b/src/Avalonia.X11/X11Structs.cs index b1006b43ee..23abd31b2c 100644 --- a/src/Avalonia.X11/X11Structs.cs +++ b/src/Avalonia.X11/X11Structs.cs @@ -32,6 +32,7 @@ using System.Collections; using System.Drawing; using System.Diagnostics; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // ReSharper disable FieldCanBeMadeReadOnly.Global // ReSharper disable IdentifierTypo @@ -545,7 +546,7 @@ namespace Avalonia.X11 { { if (data == null) throw new InvalidOperationException(); - return *(T*)data; + return Unsafe.ReadUnaligned(data); } } From 8fbfde96541fa85a6ee9cbd0a9ce1eb6945169b5 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 18 Jul 2022 07:55:57 +0200 Subject: [PATCH 384/393] `ComboBoxMinHeight` should be of Type `double`, not `Thickness` --- src/Avalonia.Themes.Fluent/DensityStyles/Compact.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Themes.Fluent/DensityStyles/Compact.xaml b/src/Avalonia.Themes.Fluent/DensityStyles/Compact.xaml index f0f3e5ea16..3b9c5038e6 100644 --- a/src/Avalonia.Themes.Fluent/DensityStyles/Compact.xaml +++ b/src/Avalonia.Themes.Fluent/DensityStyles/Compact.xaml @@ -15,7 +15,7 @@ 0,1,0,2 9,0,0,1 10,0,30,0 - 24 + 24 12,1,0,3 32 From 4b7feeb4f4905bce85ba0787d9cd60b6063b3a98 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 18 Jul 2022 13:55:53 +0300 Subject: [PATCH 385/393] Fixed various invalidation and hit-testing issues --- .../Composition/CompositingRenderer.cs | 34 +- .../Composition/CompositionDrawListVisual.cs | 13 +- .../Composition/CompositionTarget.cs | 44 +- .../ICompositionTargetDebugEvents.cs | 6 + .../Server/ServerCompositionTarget.cs | 3 +- .../Server/ServerCompositionVisual.cs | 35 +- .../Transport/BatchStreamArrayPool.cs | 10 +- .../Rendering/Composition/Visual.cs | 2 +- .../Rendering/CompositorHitTestingTests.cs | 417 ++++++++++++++++++ .../Rendering/CompositorInvalidationTests.cs | 109 +++++ .../Rendering/CompositorTestsBase.cs | 208 +++++++++ .../MockPlatformRenderInterface.cs | 27 +- 12 files changed, 834 insertions(+), 74 deletions(-) create mode 100644 src/Avalonia.Base/Rendering/Composition/ICompositionTargetDebugEvents.cs create mode 100644 tests/Avalonia.Base.UnitTests/Rendering/CompositorHitTestingTests.cs create mode 100644 tests/Avalonia.Base.UnitTests/Rendering/CompositorInvalidationTests.cs create mode 100644 tests/Avalonia.Base.UnitTests/Rendering/CompositorTestsBase.cs diff --git a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs index 282973c26a..a571a0518b 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs @@ -24,11 +24,12 @@ public class CompositingRenderer : IRendererWithCompositor DrawingContext _recordingContext; private HashSet _dirty = new(); private HashSet _recalculateChildren = new(); - private readonly CompositionTarget _target; private bool _queuedUpdate; private Action _update; private Action _invalidateScene; + internal CompositionTarget CompositionTarget; + /// /// Asks the renderer to only draw frames on the render thread. Makes Paint to wait until frame is rendered. /// @@ -40,8 +41,8 @@ public class CompositingRenderer : IRendererWithCompositor _root = root; _compositor = compositor; _recordingContext = new DrawingContext(_recorder); - _target = compositor.CreateCompositionTarget(root.CreateRenderTarget); - _target.Root = ((Visual)root!.VisualRoot!).AttachToCompositor(compositor); + CompositionTarget = compositor.CreateCompositionTarget(root.CreateRenderTarget); + CompositionTarget.Root = ((Visual)root!.VisualRoot!).AttachToCompositor(compositor); _update = Update; _invalidateScene = InvalidateScene; } @@ -49,15 +50,15 @@ public class CompositingRenderer : IRendererWithCompositor /// public bool DrawFps { - get => _target.DrawFps; - set => _target.DrawFps = value; + get => CompositionTarget.DrawFps; + set => CompositionTarget.DrawFps = value; } /// public bool DrawDirtyRects { - get => _target.DrawDirtyRects; - set => _target.DrawDirtyRects = value; + get => CompositionTarget.DrawDirtyRects; + set => CompositionTarget.DrawDirtyRects = value; } /// @@ -81,12 +82,11 @@ public class CompositingRenderer : IRendererWithCompositor /// public IEnumerable HitTest(Point p, IVisual root, Func? filter) { - var res = _target.TryHitTest(p, filter); + var res = CompositionTarget.TryHitTest(p, filter); if(res == null) yield break; - for (var index = res.Count - 1; index >= 0; index--) + foreach(var v in res) { - var v = res[index]; if (v is CompositionDrawListVisual dv) { if (filter == null || filter(dv.Visual)) @@ -234,8 +234,8 @@ public class CompositingRenderer : IRendererWithCompositor SyncChildren(v); _dirty.Clear(); _recalculateChildren.Clear(); - _target.Size = _root.ClientSize; - _target.Scaling = _root.RenderScaling; + CompositionTarget.Size = _root.ClientSize; + CompositionTarget.Scaling = _root.RenderScaling; Compositor.InvokeOnNextCommit(_invalidateScene); } @@ -246,24 +246,24 @@ public class CompositingRenderer : IRendererWithCompositor public void Paint(Rect rect) { Update(); - _target.RequestRedraw(); + CompositionTarget.RequestRedraw(); if(RenderOnlyOnRenderThread && Compositor.Loop.RunsInBackground) Compositor.RequestCommitAsync().Wait(); else - _target.ImmediateUIThreadRender(); + CompositionTarget.ImmediateUIThreadRender(); } - public void Start() => _target.IsEnabled = true; + public void Start() => CompositionTarget.IsEnabled = true; public void Stop() { - _target.IsEnabled = false; + CompositionTarget.IsEnabled = false; } public void Dispose() { Stop(); - _target.Dispose(); + CompositionTarget.Dispose(); // Wait for the composition batch to be applied and rendered to guarantee that // render target is not used anymore and can be safely disposed diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs index 47cfcd325b..49aea1c3dc 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionDrawListVisual.cs @@ -54,13 +54,20 @@ internal class CompositionDrawListVisual : CompositionContainerVisual internal override bool HitTest(Point pt, Func? filter) { - if (DrawList == null) + var custom = Visual as ICustomHitTest; + if (DrawList == null && custom == null) return false; if (filter != null && !filter(Visual)) return false; - if (Visual is ICustomHitTest custom) + if (custom != null) + { + // Simulate the old behavior + // TODO: Change behavior once legacy renderers are removed + pt += new Point(Offset.X, Offset.Y); return custom.HitTest(pt); - foreach (var op in DrawList) + } + + foreach (var op in DrawList!) if (op.Item.HitTest(pt)) return true; return false; diff --git a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs index 25bbd4dc88..01b2d0d5d9 100644 --- a/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/CompositionTarget.cs @@ -62,7 +62,7 @@ namespace Avalonia.Rendering.Composition bool TryGetInvertedTransform(CompositionVisual visual, out Matrix matrix) { - var m = visual.TryGetServerTransform(); + var m = visual.TryGetServerGlobalTransform(); if (m == null) { matrix = default; @@ -73,52 +73,44 @@ namespace Avalonia.Rendering.Composition return m33.TryInvert(out matrix); } - bool TryTransformTo(CompositionVisual visual, ref Point v) + bool TryTransformTo(CompositionVisual visual, Point globalPoint, out Point v) { + v = default; if (TryGetInvertedTransform(visual, out var m)) { - v = v * m; + v = globalPoint * m; return true; } return false; } - bool HitTestCore(CompositionVisual visual, Point point, PooledList result, + void HitTestCore(CompositionVisual visual, Point globalPoint, PooledList result, Func? filter) { - //TODO: Check readback too if (visual.Visible == false) - return false; - if (!TryTransformTo(visual, ref point)) - return false; + return; + if (!TryTransformTo(visual, globalPoint, out var point)) + return; if (visual.ClipToBounds && (point.X < 0 || point.Y < 0 || point.X > visual.Size.X || point.Y > visual.Size.Y)) - return false; - if (visual.Clip?.FillContains(point) == false) - return false; + return; - bool success = false; - // Hit-test the current node - if (visual.HitTest(point, filter)) - { - result.Add(visual); - success = true; - } - - // Inspect children too + if (visual.Clip?.FillContains(point) == false) + return; + + // Inspect children if (visual is CompositionContainerVisual cv) for (var c = cv.Children.Count - 1; c >= 0; c--) { var ch = cv.Children[c]; - var hit = HitTestCore(ch, point, result, filter); - if (hit) - return true; + HitTestCore(ch, globalPoint, result, filter); } - - return success; - + + // Hit-test the current node + if (visual.HitTest(point, filter)) + result.Add(visual); } /// diff --git a/src/Avalonia.Base/Rendering/Composition/ICompositionTargetDebugEvents.cs b/src/Avalonia.Base/Rendering/Composition/ICompositionTargetDebugEvents.cs new file mode 100644 index 0000000000..045a4f8cc6 --- /dev/null +++ b/src/Avalonia.Base/Rendering/Composition/ICompositionTargetDebugEvents.cs @@ -0,0 +1,6 @@ +namespace Avalonia.Rendering.Composition; + +internal interface ICompositionTargetDebugEvents +{ + void RectInvalidated(Rect rc); +} \ No newline at end of file diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs index 0fde86e484..882b66bf70 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs @@ -33,7 +33,7 @@ namespace Avalonia.Rendering.Composition.Server private HashSet _attachedVisuals = new(); private Queue _adornerUpdateQueue = new(); - + public ICompositionTargetDebugEvents? DebugEvents { get; set; } public ReadbackIndices Readback { get; } = new(); public int RenderedVisuals { get; set; } @@ -173,6 +173,7 @@ namespace Avalonia.Rendering.Composition.Server if(rect.IsEmpty) return; var snapped = SnapToDevicePixels(rect, Scaling); + DebugEvents?.RectInvalidated(rect); _dirtyRect = _dirtyRect.Union(snapped); _redrawRequested = true; } diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs index 6fdf105e58..c0e487f209 100644 --- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs @@ -119,14 +119,15 @@ namespace Avalonia.Rendering.Composition.Server var oldTransformedContentBounds = TransformedOwnContentBounds; var oldCombinedTransformedClipBounds = _combinedTransformedClipBounds; - - var dirtyOldBounds = false; + if (_parent?.IsDirtyComposition == true) { IsDirtyComposition = true; _isDirtyForUpdate = true; - dirtyOldBounds = true; } + + var invalidateOldBounds = _isDirtyForUpdate; + var invalidateNewBounds = _isDirtyForUpdate; GlobalTransformMatrix = newTransform; @@ -157,30 +158,20 @@ namespace Avalonia.Rendering.Composition.Server EffectiveOpacity = Opacity * (Parent?.EffectiveOpacity ?? 1); - IsVisibleInFrame = Visible && EffectiveOpacity > 0.04 && !_isBackface && + IsVisibleInFrame = _parent?.IsVisibleInFrame != false && Visible && EffectiveOpacity > 0.04 && !_isBackface && !_combinedTransformedClipBounds.IsEmpty; - - if (wasVisible != IsVisibleInFrame) - _isDirtyForUpdate = true; - - // Invalidate previous rect and queue new rect based on visibility - if (positionChanged) - { - if (wasVisible) - dirtyOldBounds = true; - if (IsVisibleInFrame) - _isDirtyForUpdate = true; + if (wasVisible != IsVisibleInFrame || positionChanged) + { + invalidateOldBounds |= wasVisible; + invalidateNewBounds |= IsVisibleInFrame; } - + // Invalidate new bounds - if (IsVisibleInFrame && _isDirtyForUpdate) - { - dirtyOldBounds = true; + if (invalidateNewBounds) AddDirtyRect(TransformedOwnContentBounds.Intersect(_combinedTransformedClipBounds)); - } - if (dirtyOldBounds && wasVisible) + if (invalidateOldBounds) AddDirtyRect(oldTransformedContentBounds.Intersect(oldCombinedTransformedClipBounds)); @@ -190,7 +181,7 @@ namespace Avalonia.Rendering.Composition.Server var i = Root!.Readback; ref var readback = ref GetReadback(i.WriteIndex); readback.Revision = root.Revision; - readback.Matrix = CombinedTransformMatrix; + readback.Matrix = GlobalTransformMatrix; readback.TargetId = Root.Id; readback.Visible = IsVisibleInFrame; } diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs index 32b4ed3026..b0a89c6f92 100644 --- a/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs +++ b/src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; +using Avalonia.Platform; using Avalonia.Threading; namespace Avalonia.Rendering.Composition.Transport; @@ -17,6 +17,7 @@ internal abstract class BatchStreamPoolBase : IDisposable int _usage; readonly int[] _usageStatistics = new int[10]; int _usageStatisticsSlot; + bool _reclaimImmediately; public int CurrentUsage => _usage; public int CurrentPool => _pool.Count; @@ -27,7 +28,10 @@ internal abstract class BatchStreamPoolBase : IDisposable GC.SuppressFinalize(needsFinalize); var updateRef = new WeakReference>(this); - StartUpdateTimer(startTimer, updateRef); + if (AvaloniaLocator.Current.GetService() == null) + _reclaimImmediately = true; + else + StartUpdateTimer(startTimer, updateRef); } static void StartUpdateTimer(Action>? startTimer, WeakReference> updateRef) @@ -90,7 +94,7 @@ internal abstract class BatchStreamPoolBase : IDisposable lock (_pool) { _usage--; - if (!_disposed) + if (!_disposed && !_reclaimImmediately) { _pool.Push(item); return; diff --git a/src/Avalonia.Base/Rendering/Composition/Visual.cs b/src/Avalonia.Base/Rendering/Composition/Visual.cs index f9e1eae2ab..7ebbb0aa96 100644 --- a/src/Avalonia.Base/Rendering/Composition/Visual.cs +++ b/src/Avalonia.Base/Rendering/Composition/Visual.cs @@ -31,7 +31,7 @@ namespace Avalonia.Rendering.Composition } } - internal Matrix4x4? TryGetServerTransform() + internal Matrix4x4? TryGetServerGlobalTransform() { if (Root == null) return null; diff --git a/tests/Avalonia.Base.UnitTests/Rendering/CompositorHitTestingTests.cs b/tests/Avalonia.Base.UnitTests/Rendering/CompositorHitTestingTests.cs new file mode 100644 index 0000000000..705c8fad9c --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Rendering/CompositorHitTestingTests.cs @@ -0,0 +1,417 @@ +using System; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Controls.Presenters; +using Avalonia.Controls.Shapes; +using Avalonia.Layout; +using Avalonia.Media; +using Avalonia.Platform; +using Avalonia.Rendering; +using Avalonia.UnitTests; +using Avalonia.VisualTree; +using Moq; +using Xunit; + +namespace Avalonia.Base.UnitTests.Rendering; + +public class CompositorHitTestingTests : CompositorTestsBase +{ + + [Fact] + public void HitTest_Should_Find_Controls_At_Point() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + var border = new Border + { + Width = 100, + Height = 100, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }; + + s.TopLevel.Content = border; + + s.AssertHitTest(new Point(100, 100), null, border); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Empty_Controls_At_Point() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + var border = new Border + { + Width = 100, + Height = 100, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }; + + s.TopLevel.Content = border; + + s.AssertHitTest(new Point(100, 100), null); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Invisible_Controls_At_Point() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Border visible, border; + s.TopLevel.Content = border = new Border + { + Width = 100, + Height = 100, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center, + IsVisible = false, + Child = visible = new Border + { + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Stretch, + } + }; + + s.AssertHitTest(new Point(100, 100), null); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Control_Outside_Point() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + var border = new Border + { + Width = 100, + Height = 100, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + + }; + s.TopLevel.Content = border; + + s.AssertHitTest(new Point(10, 10), null); + } + } + + [Fact] + public void HitTest_Should_Return_Top_Controls_First() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Panel container = new Panel + { + Width = 200, + Height = 200, + Children = + { + new Border + { + Width = 100, + Height = 100, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }, + new Border + { + Width = 50, + Height = 50, + Background = Brushes.Blue, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + } + } + }; + s.TopLevel.Content = container; + + s.AssertHitTest(new Point(100, 100), null, container.Children[1], container.Children[0]); + } + } + + [Fact] + public void HitTest_Should_Return_Top_Controls_First_With_ZIndex() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Panel container = new Panel + { + Width = 200, + Height = 200, + Children = + { + new Border + { + Width = 100, + Height = 100, + ZIndex = 1, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }, + new Border + { + Width = 50, + Height = 50, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }, + new Border + { + Width = 75, + Height = 75, + ZIndex = 2, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + } + } + + }; + s.TopLevel.Content = container; + + s.AssertHitTest(new Point(100, 100), null, new[] { container.Children[2], container.Children[0], container.Children[1] }); + } + } + + [Fact] + public void HitTest_Should_Find_Control_Translated_Outside_Parent_Bounds() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Border target; + Panel container = new Panel + { + Width = 200, + Height = 200, + Background = Brushes.Red, + ClipToBounds = false, + Children = + { + new Border + { + Width = 100, + Height = 100, + ZIndex = 1, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Left, + VerticalAlignment = VerticalAlignment.Top, + Child = target = new Border + { + Width = 50, + Height = 50, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Left, + VerticalAlignment = VerticalAlignment.Top, + RenderTransform = new TranslateTransform(110, 110), + } + }, + } + }; + s.TopLevel.Content = container; + + s.AssertHitTest(new Point(120, 120), null, target, container); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Control_Outside_Parent_Bounds_When_Clipped() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Border target; + Panel container = new Panel + { + Width = 100, + Height = 200, + Background = Brushes.Red, + Children = + { + new Panel() + { + Width = 100, + Height = 100, + Background = Brushes.Red, + Margin = new Thickness(0, 100, 0, 0), + ClipToBounds = true, + Children = + { + (target = new Border() + { + Width = 100, + Height = 100, + Background = Brushes.Red, + Margin = new Thickness(0, -100, 0, 0) + }) + } + } + } + + }; + s.TopLevel.Content = container; + + s.AssertHitTest(new Point(50, 50), null, container); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Control_Outside_Scroll_Viewport() + { + using (var s = new CompositorServices(new Size(100, 200))) + { + Border target; + Border item1; + Border item2; + ScrollContentPresenter scroll; + Panel container = new Panel + { + Width = 100, + Height = 200, + Background = Brushes.Red, + Children = + { + (target = new Border() + { + Name = "b1", + Width = 100, + Height = 100, + Background = Brushes.Red, + }), + new Border() + { + Name = "b2", + Width = 100, + Height = 100, + Background = Brushes.Red, + Margin = new Thickness(0, 100, 0, 0), + Child = scroll = new ScrollContentPresenter() + { + CanHorizontallyScroll = true, + CanVerticallyScroll = true, + Content = new StackPanel() + { + Children = + { + (item1 = new Border() + { + Name = "b3", + Width = 100, + Height = 100, + Background = Brushes.Red, + }), + (item2 = new Border() + { + Name = "b4", + Width = 100, + Height = 100, + Background = Brushes.Red, + }), + } + } + } + } + } + }; + s.TopLevel.Content = container; + + scroll.UpdateChild(); + + s.AssertHitTestFirst(new Point(50, 150), null, item1); + + s.AssertHitTestFirst(new Point(50,50), null, target); + + scroll.Offset = new Vector(0, 100); + + s.AssertHitTestFirst(new Point(50, 150), null, item2); + + s.AssertHitTestFirst(new Point(50,50), null, target); + } + } + + [Fact] + public void HitTest_Should_Not_Find_Path_When_Outside_Fill() + { + using (var s = new CompositorServices(new Size(200, 200))) + { + Path path = new Path + { + Width = 200, + Height = 200, + Fill = Brushes.Red, + Data = StreamGeometry.Parse("M100,0 L0,100 100,100") + }; + s.TopLevel.Content = path; + + s.AssertHitTest(new Point(100, 100), null, path); + s.AssertHitTest(new Point(10, 10), null); + } + } + + [Fact] + public void HitTest_Should_Respect_Geometry_Clip() + { + using (var s = new CompositorServices(new Size(400, 400))) + { + Canvas canvas; + Border border = new Border + { + Background = Brushes.Red, + Clip = StreamGeometry.Parse("M100,0 L0,100 100,100"), + Width = 200, + Height = 200, + Child = canvas = new Canvas + { + Background = Brushes.Yellow, + Margin = new Thickness(10), + } + + }; + s.TopLevel.Content = border; + + s.RunJobs(); + Assert.Equal(new Rect(100, 100, 200, 200), border.Bounds); + + s.AssertHitTest(new Point(200,200), null, canvas, border); + + s.AssertHitTest(new Point(110, 110), null); + } + } + + [Fact] + public void HitTest_Should_Accommodate_ICustomHitTest() + { + using (var s = new CompositorServices(new Size(300, 200))) + { + Border border = new CustomHitTestBorder + { + ClipToBounds = false, + Width = 100, + Height = 100, + Background = Brushes.Red, + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Center + }; + + s.TopLevel.Content = border; + + s.AssertHitTest(75, 100, null, border); + s.AssertHitTest(125, 100, null, border); + s.AssertHitTest(175, 100, null); + } + } + + private IDisposable TestApplication() + { + return UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); + } + +} \ No newline at end of file diff --git a/tests/Avalonia.Base.UnitTests/Rendering/CompositorInvalidationTests.cs b/tests/Avalonia.Base.UnitTests/Rendering/CompositorInvalidationTests.cs new file mode 100644 index 0000000000..699f450223 --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Rendering/CompositorInvalidationTests.cs @@ -0,0 +1,109 @@ +using Avalonia.Controls; +using Avalonia.Media; +using Xunit; + +namespace Avalonia.Base.UnitTests.Rendering; + +public class CompositorInvalidationTests : CompositorTestsBase +{ + [Fact] + public void Control_Should_Invalidate_Own_Rect_When_Added() + { + using (var s = new CompositorCanvas()) + { + var control = new Border() + { + Background = Brushes.Red, Width = 20, Height = 10, + [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50 + }; + s.Canvas.Children.Add(control); + s.AssertRects(new Rect(30, 50, 20, 10)); + } + } + + [Fact] + public void Control_Should_Invalidate_Own_Rect_When_Removed() + { + using (var s = new CompositorCanvas()) + { + var control = new Border() + { + Background = Brushes.Red, Width = 20, Height = 10, + [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50 + }; + s.Canvas.Children.Add(control); + s.RunJobs(); + s.Events.Rects.Clear(); + s.Canvas.Children.Remove(control); + s.AssertRects(new Rect(30, 50, 20, 10)); + } + } + + [Fact] + public void Control_Should_Invalidate_Both_Own_Rects_When_Moved() + { + using (var s = new CompositorCanvas()) + { + var control = new Border() + { + Background = Brushes.Red, Width = 20, Height = 10, + [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50 + }; + s.Canvas.Children.Add(control); + s.RunJobs(); + s.Events.Rects.Clear(); + control[Canvas.LeftProperty] = 55; + s.AssertRects(new Rect(30, 50, 20, 10), + new Rect(55, 50, 20, 10) + ); + } + } + + [Fact] + public void Control_Should_Invalidate_Child_Rects_When_Moved() + { + using (var s = new CompositorCanvas()) + { + var control = new Decorator() + { + [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50, + Padding = new Thickness(10), + Child = new Border() + { + Width = 20, Height = 10, + Background = Brushes.Red + } + }; + s.Canvas.Children.Add(control); + s.RunJobs(); + s.Events.Rects.Clear(); + control[Canvas.LeftProperty] = 55; + s.AssertRects(new Rect(40, 60, 20, 10), + new Rect(65, 60, 20, 10) + ); + } + } + + [Fact] + public void Control_Should_Invalidate_Child_Rects_When_Becomes_Invisible() + { + using (var s = new CompositorCanvas()) + { + var control = new Decorator() + { + [Canvas.LeftProperty] = 30, [Canvas.TopProperty] = 50, + Padding = new Thickness(10), + Child = new Border() + { + Width = 20, Height = 10, + Background = Brushes.Red + } + }; + s.Canvas.Children.Add(control); + s.RunJobs(); + s.Events.Rects.Clear(); + control.IsVisible = false; + s.AssertRects(new Rect(40, 60, 20, 10)); + } + } +} \ No newline at end of file diff --git a/tests/Avalonia.Base.UnitTests/Rendering/CompositorTestsBase.cs b/tests/Avalonia.Base.UnitTests/Rendering/CompositorTestsBase.cs new file mode 100644 index 0000000000..fa722a23b8 --- /dev/null +++ b/tests/Avalonia.Base.UnitTests/Rendering/CompositorTestsBase.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reactive.Disposables; +using System.Threading; +using System.Threading.Tasks; +using Avalonia.Controls; +using Avalonia.Controls.Embedding; +using Avalonia.Controls.Presenters; +using Avalonia.Controls.Templates; +using Avalonia.Data; +using Avalonia.Input; +using Avalonia.Input.Raw; +using Avalonia.Platform; +using Avalonia.Rendering; +using Avalonia.Rendering.Composition; +using Avalonia.Threading; +using Avalonia.UnitTests; +using Avalonia.VisualTree; +using JetBrains.Annotations; +using Xunit; + +namespace Avalonia.Base.UnitTests.Rendering; + +public class CompositorTestsBase +{ + public class DebugEvents : ICompositionTargetDebugEvents + { + public List Rects = new(); + + public void RectInvalidated(Rect rc) + { + Rects.Add(rc); + } + + public void Reset() + { + Rects.Clear(); + } + } + + public class ManualRenderTimer : IRenderTimer + { + public event Action Tick; + public bool RunsInBackground => false; + public void TriggerTick() => Tick?.Invoke(TimeSpan.Zero); + public Task TriggerBackgroundTick() => Task.Run(TriggerTick); + } + + class TopLevelImpl : ITopLevelImpl + { + private readonly Compositor _compositor; + public CompositingRenderer Renderer { get; private set; } + + public TopLevelImpl(Compositor compositor, Size clientSize) + { + ClientSize = clientSize; + _compositor = compositor; + } + + public void Dispose() + { + + } + + public Size ClientSize { get; } + public Size? FrameSize { get; } + public double RenderScaling => 1; + public IEnumerable Surfaces { get; } = Array.Empty(); + public Action Input { get; set; } + public Action Paint { get; set; } + public Action Resized { get; set; } + public Action ScalingChanged { get; set; } + public Action TransparencyLevelChanged { get; set; } + + public IRenderer CreateRenderer(IRenderRoot root) + { + return Renderer = new CompositingRenderer(root, _compositor); + } + + public void Invalidate(Rect rect) + { + } + + public void SetInputRoot(IInputRoot inputRoot) + { + } + + public Point PointToClient(PixelPoint point) => default; + + public PixelPoint PointToScreen(Point point) => new(); + + public void SetCursor(ICursorImpl cursor) + { + } + + public Action Closed { get; set; } + public Action LostFocus { get; set; } + public IMouseDevice MouseDevice { get; } = new MouseDevice(); + public IPopupImpl CreatePopup() => throw new NotImplementedException(); + + public void SetTransparencyLevelHint(WindowTransparencyLevel transparencyLevel) + { + } + + public WindowTransparencyLevel TransparencyLevel { get; } + public AcrylicPlatformCompensationLevels AcrylicCompensationLevels { get; } + } + + protected class CompositorServices : IDisposable + { + private readonly IDisposable _app; + public Compositor Compositor { get; } + public ManualRenderTimer Timer { get; } = new(); + public EmbeddableControlRoot TopLevel { get; } + public CompositingRenderer Renderer { get; } = null!; + public DebugEvents Events { get; } = new(); + + public void Dispose() + { + TopLevel.Renderer.Stop(); + TopLevel.Dispose(); + _app.Dispose(); + } + + public CompositorServices(Size? size = null) + { + _app = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); + try + { + AvaloniaLocator.CurrentMutable.Bind().ToConstant(Timer); + AvaloniaLocator.CurrentMutable.Bind() + .ToConstant(new RenderLoop(Timer, Dispatcher.UIThread)); + + Compositor = new Compositor(AvaloniaLocator.Current.GetRequiredService(), null); + var impl = new TopLevelImpl(Compositor, size ?? new Size(1000, 1000)); + TopLevel = new EmbeddableControlRoot(impl) + { + Template = new FuncControlTemplate((parent, scope) => + { + var presenter = new ContentPresenter + { + [~ContentPresenter.ContentProperty] = new TemplateBinding(ContentControl.ContentProperty) + }; + scope.Register("PART_ContentPresenter", presenter); + return presenter; + }) + }; + Renderer = impl.Renderer; + TopLevel.Prepare(); + TopLevel.Renderer.Start(); + RunJobs(); + Renderer.CompositionTarget.Server.DebugEvents = Events; + } + catch + { + _app.Dispose(); + throw; + } + } + + public void RunJobs() + { + Dispatcher.UIThread.RunJobs(); + Timer.TriggerTick(); + Dispatcher.UIThread.RunJobs(); + } + + public void AssertRects(params Rect[] rects) + { + RunJobs(); + var toAssert = rects.Select(x => x.ToString()).Distinct().OrderBy(x => x); + var invalidated = Events.Rects.Select(x => x.ToString()).Distinct().OrderBy(x => x); + Assert.Equal(toAssert, invalidated); + Events.Rects.Clear(); + } + + public void AssertHitTest(double x, double y, Func filter, params object[] expected) + => AssertHitTest(new Point(x, y), filter, expected); + public void AssertHitTest(Point pt, Func filter, params object[] expected) + { + RunJobs(); + var tested = Renderer.HitTest(pt, TopLevel, filter); + Assert.Equal(expected, tested); + } + + public void AssertHitTestFirst(Point pt, Func filter, object expected) + { + RunJobs(); + var tested = Renderer.HitTest(pt, TopLevel, filter).First(); + Assert.Equal(expected, tested); + } + } + + + protected class CompositorCanvas : CompositorServices + { + public Canvas Canvas { get; } = new(); + + public CompositorCanvas() + { + TopLevel.Content = Canvas; + RunJobs(); + Events.Reset(); + } + } +} \ No newline at end of file diff --git a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs index bf4ac9c1f6..f6a127b573 100644 --- a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs +++ b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs @@ -4,6 +4,7 @@ using System.IO; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Media.Imaging; +using Avalonia.Rendering; using Moq; namespace Avalonia.UnitTests @@ -25,9 +26,33 @@ namespace Avalonia.UnitTests return Mock.Of(x => x.Bounds == rect); } + class MockRenderTarget : IRenderTarget + { + public void Dispose() + { + + } + + public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer) + { + var m = new Mock(); + m.Setup(c => c.CreateLayer(It.IsAny())) + .Returns(() => + { + var r = new Mock(); + r.Setup(r => r.CreateDrawingContext(It.IsAny())) + .Returns(CreateDrawingContext(null)); + return r.Object; + } + ); + return m.Object; + + } + } + public IRenderTarget CreateRenderTarget(IEnumerable surfaces) { - return Mock.Of(); + return new MockRenderTarget(); } public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi) From fa17ee9bb991cc0b49326ea7b217daa12baefad2 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 18 Jul 2022 15:48:07 +0300 Subject: [PATCH 386/393] Introduced GtkInteropHelper.RunOnGlibThread, fixed demos --- .../NativeControls/Gtk/EmbedSample.Gtk.cs | 3 +-- .../NativeControls/Gtk/GtkHelper.cs | 9 ++----- src/Avalonia.X11/Interop/GtkInteropHelper.cs | 15 +++++++++++ src/Avalonia.X11/NativeDialogs/Gtk.cs | 27 ++++++++++++++++--- 4 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 src/Avalonia.X11/Interop/GtkInteropHelper.cs diff --git a/samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs b/samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs index 521d3674eb..81a5ba536f 100644 --- a/samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs +++ b/samples/ControlCatalog.NetCore/NativeControls/Gtk/EmbedSample.Gtk.cs @@ -22,8 +22,7 @@ public class EmbedSampleGtk : INativeDemoControl var control = createDefault(); var nodes = Path.GetFullPath(Path.Combine(typeof(EmbedSample).Assembly.GetModules()[0].FullyQualifiedName, - "..", - "nodes.mp4")); + "..", "NativeControls", "Gtk", "nodes.mp4")); _mplayer = Process.Start(new ProcessStartInfo("mplayer", $"-vo x11 -zoom -loop 0 -wid {control.Handle.ToInt64()} \"{nodes}\"") { diff --git a/samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs b/samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs index 456f77a44d..b1fef7c013 100644 --- a/samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs +++ b/samples/ControlCatalog.NetCore/NativeControls/Gtk/GtkHelper.cs @@ -2,6 +2,7 @@ using System; using System.Threading.Tasks; using Avalonia.Controls.Platform; using Avalonia.Platform.Interop; +using Avalonia.X11.Interop; using Avalonia.X11.NativeDialogs; using static Avalonia.X11.NativeDialogs.Gtk; using static Avalonia.X11.NativeDialogs.Glib; @@ -10,8 +11,6 @@ namespace ControlCatalog.NetCore; internal class GtkHelper { - private static Task s_gtkTask; - class FileChooser : INativeControlHostDestroyableControlHandle { private readonly IntPtr _widget; @@ -38,11 +37,7 @@ internal class GtkHelper public static INativeControlHostDestroyableControlHandle CreateGtkFileChooser(IntPtr parentXid) { - if (s_gtkTask == null) - s_gtkTask = StartGtk(); - if (!s_gtkTask.Result) - return null; - return RunOnGlibThread(() => + return GtkInteropHelper.RunOnGlibThread(() => { using (var title = new Utf8Buffer("Embedded")) { diff --git a/src/Avalonia.X11/Interop/GtkInteropHelper.cs b/src/Avalonia.X11/Interop/GtkInteropHelper.cs new file mode 100644 index 0000000000..de0b755832 --- /dev/null +++ b/src/Avalonia.X11/Interop/GtkInteropHelper.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel; +using System.Threading.Tasks; + +namespace Avalonia.X11.Interop; + +public class GtkInteropHelper +{ + public static async Task RunOnGlibThread(Func cb) + { + if (!await NativeDialogs.Gtk.StartGtk().ConfigureAwait(false)) + throw new Win32Exception("Unable to initialize GTK"); + return await NativeDialogs.Glib.RunOnGlibThread(cb).ConfigureAwait(false); + } +} \ No newline at end of file diff --git a/src/Avalonia.X11/NativeDialogs/Gtk.cs b/src/Avalonia.X11/NativeDialogs/Gtk.cs index 8e2d920bc7..c9e482db86 100644 --- a/src/Avalonia.X11/NativeDialogs/Gtk.cs +++ b/src/Avalonia.X11/NativeDialogs/Gtk.cs @@ -3,6 +3,8 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Avalonia.Platform.Interop; +using JetBrains.Annotations; + // ReSharper disable IdentifierTypo namespace Avalonia.X11.NativeDialogs { @@ -256,10 +258,19 @@ namespace Avalonia.X11.NativeDialogs public static IntPtr GetForeignWindow(IntPtr xid) => gdk_x11_window_foreign_new_for_display(s_display, xid); + static object s_startGtkLock = new(); + static Task s_startGtkTask; + public static Task StartGtk() { - var tcs = new TaskCompletionSource(); - new Thread(() => + return StartGtkCore(); + lock (s_startGtkLock) + return s_startGtkTask ??= StartGtkCore(); + } + + private static void GtkThread(TaskCompletionSource tcs) + { + try { try { @@ -293,7 +304,17 @@ namespace Avalonia.X11.NativeDialogs tcs.SetResult(true); while (true) gtk_main_iteration(); - }) {Name = "GTK3THREAD", IsBackground = true}.Start(); + } + catch + { + tcs.SetResult(false); + } + } + + private static Task StartGtkCore() + { + var tcs = new TaskCompletionSource(); + new Thread(() => GtkThread(tcs)) {Name = "GTK3THREAD", IsBackground = true}.Start(); return tcs.Task; } } From 78a49b3fb327e7e374edd6b13a7e7bb09b1e4160 Mon Sep 17 00:00:00 2001 From: Takoooooo Date: Mon, 18 Jul 2022 17:44:39 +0300 Subject: [PATCH 387/393] Fix typo in DataGrid. DataGridComparerSortDesctiption -> DataGridComparerSortDescription --- .../Collections/DataGridSortDescription.cs | 8 ++++---- src/Avalonia.Controls.DataGrid/DataGridColumn.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs b/src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs index ca6020128c..ff222658db 100644 --- a/src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs +++ b/src/Avalonia.Controls.DataGrid/Collections/DataGridSortDescription.cs @@ -268,11 +268,11 @@ namespace Avalonia.Collections public static DataGridSortDescription FromComparer(IComparer comparer, ListSortDirection direction = ListSortDirection.Ascending) { - return new DataGridComparerSortDesctiption(comparer, direction); + return new DataGridComparerSortDescription(comparer, direction); } } - public class DataGridComparerSortDesctiption : DataGridSortDescription + public class DataGridComparerSortDescription : DataGridSortDescription { private readonly IComparer _innerComparer; private readonly ListSortDirection _direction; @@ -281,7 +281,7 @@ namespace Avalonia.Collections public IComparer SourceComparer => _innerComparer; public override IComparer Comparer => _comparer; public override ListSortDirection Direction => _direction; - public DataGridComparerSortDesctiption(IComparer comparer, ListSortDirection direction) + public DataGridComparerSortDescription(IComparer comparer, ListSortDirection direction) { _innerComparer = comparer; _direction = direction; @@ -300,7 +300,7 @@ namespace Avalonia.Collections public override DataGridSortDescription SwitchSortDirection() { var newDirection = _direction == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending; - return new DataGridComparerSortDesctiption(_innerComparer, newDirection); + return new DataGridComparerSortDescription(_innerComparer, newDirection); } } diff --git a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs index c415f477d4..e57d6bbde2 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs @@ -1091,7 +1091,7 @@ namespace Avalonia.Controls { return OwningGrid.DataConnection.SortDescriptions - .OfType() + .OfType() .FirstOrDefault(s => s.SourceComparer == CustomSortComparer); } From a51acea5e02ddde0a05c2102a45f48e395e314ae Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 19 Jul 2022 15:32:37 +0100 Subject: [PATCH 388/393] MenuItem might have to look up the logical tree to find its menu parent (as in trayicon) --- src/Avalonia.Controls/MenuItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/MenuItem.cs b/src/Avalonia.Controls/MenuItem.cs index 11c42f2ef3..5e7c83fcbd 100644 --- a/src/Avalonia.Controls/MenuItem.cs +++ b/src/Avalonia.Controls/MenuItem.cs @@ -304,7 +304,7 @@ namespace Avalonia.Controls bool IMenuItem.IsPointerOverSubMenu => _popup?.IsPointerOverPopup ?? false; /// - IMenuElement? IMenuItem.Parent => Parent as IMenuElement; + IMenuElement? IMenuItem.Parent => this.FindLogicalAncestorOfType(); protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute; From 961c693e343ee698227448da77823ec6d1dc2da2 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 20 Jul 2022 11:37:11 +0100 Subject: [PATCH 389/393] fix win32native to managed menu exporter. --- src/Avalonia.Controls/MenuItem.cs | 2 +- .../Win32NativeToManagedMenuExporter.cs | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/MenuItem.cs b/src/Avalonia.Controls/MenuItem.cs index 5e7c83fcbd..11c42f2ef3 100644 --- a/src/Avalonia.Controls/MenuItem.cs +++ b/src/Avalonia.Controls/MenuItem.cs @@ -304,7 +304,7 @@ namespace Avalonia.Controls bool IMenuItem.IsPointerOverSubMenu => _popup?.IsPointerOverPopup ?? false; /// - IMenuElement? IMenuItem.Parent => this.FindLogicalAncestorOfType(); + IMenuElement? IMenuItem.Parent => Parent as IMenuElement; protected override bool IsEnabledCore => base.IsEnabledCore && _commandCanExecute; diff --git a/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs b/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs index fa6f9927b5..da8357a6f1 100644 --- a/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs +++ b/src/Windows/Avalonia.Win32/Win32NativeToManagedMenuExporter.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Platform; @@ -15,13 +16,15 @@ namespace Avalonia.Win32 _nativeMenu = nativeMenu; } - private IEnumerable Populate(NativeMenu nativeMenu) + private AvaloniaList Populate(NativeMenu nativeMenu) { + var result = new AvaloniaList(); + foreach (var menuItem in nativeMenu.Items) { if (menuItem is NativeMenuItemSeparator) { - yield return new MenuItem { Header = "-" }; + result.Add(new MenuItem { Header = "-" }); } else if (menuItem is NativeMenuItem item) { @@ -36,12 +39,14 @@ namespace Avalonia.Win32 newItem.Click += (_, __) => bridge.RaiseClicked(); } - yield return newItem; + result.Add(newItem); } } + + return result; } - public IEnumerable? GetMenu() + public AvaloniaList? GetMenu() { if (_nativeMenu != null) { From 949b7f2d9427e3922e43721a03f1acc13b209680 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 19 Jul 2022 21:24:29 -0400 Subject: [PATCH 390/393] Call GetHicon only once when creation a windows icon --- src/Windows/Avalonia.Win32/IconImpl.cs | 20 +++----------------- src/Windows/Avalonia.Win32/TrayIconImpl.cs | 4 +++- src/Windows/Avalonia.Win32/Win32Platform.cs | 8 ++++++-- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/Windows/Avalonia.Win32/IconImpl.cs b/src/Windows/Avalonia.Win32/IconImpl.cs index 8548801555..4d2b89b0cc 100644 --- a/src/Windows/Avalonia.Win32/IconImpl.cs +++ b/src/Windows/Avalonia.Win32/IconImpl.cs @@ -1,6 +1,5 @@ using System; using System.Drawing; -using System.Drawing.Imaging; using System.IO; using Avalonia.Platform; @@ -8,31 +7,18 @@ namespace Avalonia.Win32 { class IconImpl : IWindowIconImpl { - private Bitmap bitmap; - private Icon icon; - - public IconImpl(Bitmap bitmap) - { - this.bitmap = bitmap; - } + private readonly Icon icon; public IconImpl(Icon icon) { this.icon = icon; } - public IntPtr HIcon => icon?.Handle ?? bitmap.GetHicon(); + public IntPtr HIcon => icon.Handle; public void Save(Stream outputStream) { - if (icon != null) - { - icon.Save(outputStream); - } - else - { - bitmap.Save(outputStream, ImageFormat.Png); - } + icon.Save(outputStream); } } } diff --git a/src/Windows/Avalonia.Win32/TrayIconImpl.cs b/src/Windows/Avalonia.Win32/TrayIconImpl.cs index 4d537a16a4..346d6e5adb 100644 --- a/src/Windows/Avalonia.Win32/TrayIconImpl.cs +++ b/src/Windows/Avalonia.Win32/TrayIconImpl.cs @@ -18,6 +18,8 @@ namespace Avalonia.Win32 [Unstable] public class TrayIconImpl : ITrayIconImpl { + private static readonly IntPtr s_emptyIcon = new System.Drawing.Bitmap(32, 32).GetHicon(); + private readonly int _uniqueId; private static int s_nextUniqueId; private bool _iconAdded; @@ -86,7 +88,7 @@ namespace Avalonia.Win32 uID = _uniqueId, uFlags = NIF.TIP | NIF.MESSAGE, uCallbackMessage = (int)CustomWindowsMessage.WM_TRAYMOUSE, - hIcon = _icon?.HIcon ?? new IconImpl(new System.Drawing.Bitmap(32, 32)).HIcon, + hIcon = _icon?.HIcon ?? s_emptyIcon, szTip = _tooltipText ?? "" }; diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 73ef50052c..2b8070fb04 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -359,7 +359,7 @@ namespace Avalonia.Win32 using (var memoryStream = new MemoryStream()) { bitmap.Save(memoryStream); - return new IconImpl(new System.Drawing.Bitmap(memoryStream)); + return CreateIconImpl(memoryStream); } } @@ -367,11 +367,15 @@ namespace Avalonia.Win32 { try { + // new Icon() will work only if stream is an "ico" file. return new IconImpl(new System.Drawing.Icon(stream)); } catch (ArgumentException) { - return new IconImpl(new System.Drawing.Bitmap(stream)); + // Fallback to Bitmap creation and converting into a windows icon. + using var icon = new System.Drawing.Bitmap(stream); + var hIcon = icon.GetHicon(); + return new IconImpl(System.Drawing.Icon.FromHandle(hIcon)); } } From 62d1b4f3b69eb97460a0c3bc0999caff8ed16ecb Mon Sep 17 00:00:00 2001 From: Max Katz Date: Tue, 19 Jul 2022 23:25:37 -0400 Subject: [PATCH 391/393] Add missing IsEnabled binding --- src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml | 1 + src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml b/src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml index 81bd8f39c5..3b0019eea1 100644 --- a/src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml +++ b/src/Avalonia.Themes.Default/Controls/NativeMenuBar.xaml @@ -14,6 +14,7 @@