From d4f7440fdafbbbefcef11e4a31b066e7543b75d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:29:03 +0000 Subject: [PATCH] Automated JetBrains cleanup Co-authored-by: <+@users.noreply.github.com> --- Directory.Core.Build.props | 2 +- .../Drawing/ConsoloniaRenderInterface.cs | 13 +++++---- .../Drawing/DrawingContextImpl.cs | 25 +++++++++-------- .../Drawing/FourBitColorBrush.cs | 20 ++++++------- src/Consolonia.Core/Drawing/Rectangle.cs | 2 +- src/Consolonia.Core/Drawing/RenderTarget.cs | 16 +++++------ .../ArrowsAndKeyboardNavigationHandler.cs | 4 +-- .../Infrastructure/ConsoleWindow.cs | 26 ++++++++--------- .../Infrastructure/ConsoloniaPlatform.cs | 2 +- .../Infrastructure/ExceptionSink.cs | 4 +-- .../InputLessDefaultNetConsole.cs | 6 ++-- .../InternalHelpers/CommonInternalHelper.cs | 3 +- .../Styles/ResourceIncludeBase.cs | 3 +- src/Consolonia.Core/Text/FontManagerImpl.cs | 15 +++++----- src/Consolonia.Core/Text/GlyphRunImpl.cs | 4 +-- src/Consolonia.Core/Text/TextShaper.cs | 9 ++---- .../WindowsConsole.cs | 8 +++--- .../Templates/Controls/Button.axaml | 4 +-- .../Templates/Controls/CalendarItem.axaml | 6 ++-- .../Templates/Controls/ComboBox.axaml | 5 ++-- .../Templates/Controls/DataGrid.axaml | 14 +++++----- .../Controls/Dialog/DialogHelpers.cs | 2 +- .../Templates/Controls/DialogWrap.axaml | 2 +- .../Templates/Controls/DialogWrap.axaml.cs | 18 ++++++------ .../Helpers/AreIntegersEqualConverter.cs | 4 --- .../Controls/Helpers/FastLineSeparator.cs | 18 ++++++------ .../Controls/Helpers/MenuExtensions.cs | 4 ++- .../Controls/Helpers/SymbolsControl.cs | 22 +++++++-------- .../Controls/Helpers/TextBoxCaret.cs | 12 ++++---- .../Templates/Controls/ItemsControl.axaml | 2 +- .../Templates/Controls/ScrollViewer.axaml | 8 ++++-- .../Templates/Controls/Separator.axaml | 2 +- .../Templates/Controls/TabControl.axaml | 2 +- .../Templates/Controls/TextBox.axaml | 28 ++++++++++++------- .../Templates/TurboVisionDefaultColors.axaml | 2 +- .../Base/GalleryTestsBaseBase.cs | 4 ++- .../ConsoloniaAppTestBase.cs | 17 +++++------ .../Consolonia.TestsCore/UnitTestConsole.cs | 1 - 38 files changed, 172 insertions(+), 167 deletions(-) diff --git a/Directory.Core.Build.props b/Directory.Core.Build.props index 4f24099a..90acdb61 100644 --- a/Directory.Core.Build.props +++ b/Directory.Core.Build.props @@ -11,7 +11,7 @@ true - true + true true \ No newline at end of file diff --git a/src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs b/src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs index 998dfb1e..7f03c62e 100644 --- a/src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs +++ b/src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs @@ -90,12 +90,14 @@ public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) throw new NotImplementedException(); } - IBitmapImpl IPlatformRenderInterface.LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode) + IBitmapImpl IPlatformRenderInterface.LoadBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode) { throw new NotImplementedException(); } - IBitmapImpl IPlatformRenderInterface.LoadBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode) + IBitmapImpl IPlatformRenderInterface.LoadBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode) { throw new NotImplementedException(); } @@ -105,7 +107,7 @@ IBitmapImpl IPlatformRenderInterface.ResizeBitmap(IBitmapImpl bitmapImpl, PixelS { throw new NotImplementedException(); } - + public IBitmapImpl LoadBitmap( PixelFormat format, AlphaFormat alphaFormat, @@ -117,10 +119,11 @@ public IBitmapImpl LoadBitmap( throw new NotImplementedException(); } - public IGlyphRunImpl CreateGlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize, IReadOnlyList glyphInfos, + public IGlyphRunImpl CreateGlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize, + IReadOnlyList glyphInfos, Point baselineOrigin) { - return new GlyphRunImpl(glyphTypeface,glyphInfos,baselineOrigin); + return new GlyphRunImpl(glyphTypeface, glyphInfos, baselineOrigin); } public IPlatformRenderInterfaceContext CreateBackendContext(IPlatformGraphicsContext graphicsApiContext) diff --git a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs index ec846958..ba90be07 100644 --- a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs +++ b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs @@ -170,6 +170,7 @@ public void DrawGlyphRun(IBrush foreground, IGlyphRunImpl glyphRun) ConsoloniaPlatform.RaiseNotSupported(17, glyphRun); throw new InvalidProgramException(); } + if (glyphRun.FontRenderingEmSize.IsNearlyEqual(0)) return; if (!glyphRun.FontRenderingEmSize.IsNearlyEqual(1)) { @@ -195,9 +196,9 @@ public void PushClip(Rect clip) public void PushClip(RoundedRect clip) { - if(clip.IsRounded) + if (clip.IsRounded) ConsoloniaPlatform.RaiseNotSupported(2); - + PushClip(clip.Rect); } @@ -265,13 +266,13 @@ public Matrix Transform { lineStyle = null; if (pen is not - { - Brush: FourBitColorBrush or LineBrush { Brush: FourBitColorBrush }, - Thickness: 1, - DashStyle: null or { Dashes.Count: 0 }, - LineCap: PenLineCap.Flat, - LineJoin: PenLineJoin.Miter - }) + { + Brush: FourBitColorBrush or LineBrush { Brush: FourBitColorBrush }, + Thickness: 1, + DashStyle: null or { Dashes.Count: 0 }, + LineCap: PenLineCap.Flat, + LineJoin: PenLineJoin.Miter + }) { ConsoloniaPlatform.RaiseNotSupported(6); return null; @@ -352,7 +353,7 @@ void DrawPixelAndMoveHead(int count) } } } - + private void DrawStringInternal(IBrush foreground, string str, Point origin = new()) { if (foreground is not FourBitColorBrush { Mode: PixelBackgroundMode.Colored } consoleColorBrush) @@ -394,8 +395,8 @@ void DrawPixelAndMoveHead(int count) case '\n': { /* it's not clear if we need to draw anything. Cursor can be placed at the end of the line - var consolePixel = new Pixel(' ', foregroundColor); - + var consolePixel = new Pixel(' ', foregroundColor); + _pixelBuffer.Set((PixelBufferCoordinate)characterPoint, (oldPixel, cp) => oldPixel.Blend(cp), consolePixel);*/ } diff --git a/src/Consolonia.Core/Drawing/FourBitColorBrush.cs b/src/Consolonia.Core/Drawing/FourBitColorBrush.cs index 0a9d5242..bd523b82 100644 --- a/src/Consolonia.Core/Drawing/FourBitColorBrush.cs +++ b/src/Consolonia.Core/Drawing/FourBitColorBrush.cs @@ -43,19 +43,19 @@ public ConsoleColor Color set => SetValue(ColorProperty, value); } + public double Opacity => 1; + public ITransform Transform => null; + public RelativePoint TransformOrigin => RelativePoint.TopLeft; + // ReSharper disable once UnusedMember.Global used by Avalonia // ReSharper disable once UnusedParameter.Global public IBrush ProvideValue(IServiceProvider _) { return this; } - - public double Opacity => 1; - public ITransform Transform => null; - public RelativePoint TransformOrigin => RelativePoint.TopLeft; } - public class FourBitBrushConverter : TypeConverter + public class FourBitBrushConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { @@ -66,15 +66,11 @@ public override object ConvertFrom( ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string s) - { - return Enum.TryParse(s, out ConsoleColor result) - ? result + return Enum.TryParse(s, out ConsoleColor result) + ? result : null; - } - + return null; } } - - } \ No newline at end of file diff --git a/src/Consolonia.Core/Drawing/Rectangle.cs b/src/Consolonia.Core/Drawing/Rectangle.cs index 74a2aa2c..ad001372 100644 --- a/src/Consolonia.Core/Drawing/Rectangle.cs +++ b/src/Consolonia.Core/Drawing/Rectangle.cs @@ -34,7 +34,7 @@ public IGeometryImpl Intersect(IGeometryImpl geometry) throw new NotImplementedException(); } - public bool StrokeContains([NotNull]IPen pen, Point point) + public bool StrokeContains([NotNull] IPen pen, Point point) { if (pen!.Thickness == 0) return false; diff --git a/src/Consolonia.Core/Drawing/RenderTarget.cs b/src/Consolonia.Core/Drawing/RenderTarget.cs index 096edd7b..d4cacc4e 100644 --- a/src/Consolonia.Core/Drawing/RenderTarget.cs +++ b/src/Consolonia.Core/Drawing/RenderTarget.cs @@ -67,6 +67,13 @@ void IDrawingContextLayerImpl.Blit(IDrawingContextImpl context) bool IDrawingContextLayerImpl.CanBlit => true; + public IDrawingContextImpl CreateDrawingContext() + { + return new DrawingContextImpl(_consoleWindow, _bufferBuffer); + } + + public bool IsCorrupted => false; + private void OnResized(Size size, WindowResizeReason reason) { @@ -110,7 +117,7 @@ private void RenderToDevice() throw new InvalidOperationException("Caret is already shown"); caretPosition = new PixelBufferCoordinate(x, y); } - + /* todo: There is not IWindowImpl.Invalidate anymore. if (!_consoleWindow.InvalidatedRects.Any(rect => rect.ContainsExclusive(new Point(x, y)))) continue;*/ @@ -221,12 +228,5 @@ public void Flush() _stringBuilder.Clear(); } } - - public IDrawingContextImpl CreateDrawingContext() - { - return new DrawingContextImpl(_consoleWindow, _bufferBuffer); - } - - public bool IsCorrupted => false; } } \ No newline at end of file diff --git a/src/Consolonia.Core/Infrastructure/ArrowsAndKeyboardNavigationHandler.cs b/src/Consolonia.Core/Infrastructure/ArrowsAndKeyboardNavigationHandler.cs index a3b90fc1..a2562213 100644 --- a/src/Consolonia.Core/Infrastructure/ArrowsAndKeyboardNavigationHandler.cs +++ b/src/Consolonia.Core/Infrastructure/ArrowsAndKeyboardNavigationHandler.cs @@ -10,11 +10,11 @@ namespace Consolonia.Core.Infrastructure { public class ArrowsAndKeyboardNavigationHandler : IKeyboardNavigationHandler { + private readonly IKeyboardNavigationHandler _keyboardNavigationHandler; + //todo: check XTFocus https://github.com/jinek/Consolonia/issues/105#issuecomment-2089015880 private IInputRoot _owner; - private readonly IKeyboardNavigationHandler _keyboardNavigationHandler; - public ArrowsAndKeyboardNavigationHandler(IKeyboardNavigationHandler keyboardNavigationHandler) { _keyboardNavigationHandler = keyboardNavigationHandler; diff --git a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs index 9f684510..f7f03703 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoleWindow.cs @@ -32,6 +32,8 @@ public ConsoleWindow() Handle = null!; } + private IMouseDevice MouseDevice { get; } + public void Dispose() { Closed?.Invoke(); @@ -41,7 +43,7 @@ public void Dispose() Console.FocusEvent -= ConsoleOnFocusEvent; Console.Dispose(); } - + public void SetInputRoot(IInputRoot inputRoot) { _inputRoot = inputRoot; @@ -77,7 +79,7 @@ public void SetFrameThemeVariant(PlatformThemeVariant themeVariant) { //todo: } - + public Size ClientSize { get @@ -105,7 +107,6 @@ public Size ClientSize public Compositor Compositor { get; } = new(null); public Action Closed { get; set; } public Action LostFocus { get; set; } - private IMouseDevice MouseDevice { get; } public WindowTransparencyLevel TransparencyLevel => WindowTransparencyLevel.None; @@ -241,6 +242,14 @@ public void SetExtendClientAreaTitleBarHeightHint(double titleBarHeight) // ReSharper disable once UnassignedGetOnlyAutoProperty todo: what is this property public Thickness OffScreenMargin { get; } + public object TryGetFeature(Type featureType) + { + if (featureType == typeof(ISystemNavigationManagerImpl)) + return null; + if (featureType == typeof(ITextInputMethodImpl)) return null; + throw new NotImplementedException("Consider this"); + } + private void ConsoleOnMouseEvent(RawPointerEventType type, Point point, Vector? wheelDelta, RawInputModifiers modifiers) { @@ -334,16 +343,5 @@ await Dispatcher.UIThread.InvokeAsync(() => }, DispatcherPriority.Input); } } - - public object TryGetFeature(Type featureType) - { - if (featureType == typeof(ISystemNavigationManagerImpl)) - return null; - if (featureType == typeof(ITextInputMethodImpl)) - { - return null; - } - throw new NotImplementedException("Consider this"); - } } } \ No newline at end of file diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs index abc60746..f65c7f2c 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaPlatform.cs @@ -41,7 +41,7 @@ public void Initialize() .Bind().ToConstant(new UiThreadRenderTimer(120)) .Bind().ToConstant(new ManagedDispatcherImpl(null)) /*.Bind().ToConstant(new SleepLoopRenderTimer(120))*/ - /*SleepLoopRenderTimer : IRenderTimer*/ + /*SleepLoopRenderTimer : IRenderTimer*/ /*.Bind().ToConstant(new RenderLoop()) todo: is internal now*/ .Bind().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Control)) .Bind().ToConstant(new ConsoleKeyboardDevice()) diff --git a/src/Consolonia.Core/Infrastructure/ExceptionSink.cs b/src/Consolonia.Core/Infrastructure/ExceptionSink.cs index ba5bf7bb..717fdf66 100644 --- a/src/Consolonia.Core/Infrastructure/ExceptionSink.cs +++ b/src/Consolonia.Core/Infrastructure/ExceptionSink.cs @@ -16,9 +16,7 @@ public bool IsEnabled(LogEventLevel level, string area) public void Log(LogEventLevel level, string area, object source, string messageTemplate) { Log(level, area, source, messageTemplate, Array.Empty()); - } - - // ReSharper disable UnusedMember.Global + } // ReSharper disable UnusedMember.Global public void Log(LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0) { Log(level, area, source, messageTemplate, new object[] { propertyValue0 }); diff --git a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs index d6e54536..02f59ca8 100644 --- a/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs +++ b/src/Consolonia.Core/Infrastructure/InputLessDefaultNetConsole.cs @@ -81,11 +81,9 @@ public void Print(PixelBufferCoordinate bufferPoint, ConsoleColor backgroundColo throw new NotSupportedException("Is not supposed to be rendered"); if (str.Any( - c => ConsoleText.IsWideChar(c) && - char.IsLetterOrDigit(c) /*todo: https://github.com/SlimeNull/NullLib.ConsoleEx/issues/2*/)) - { + c => ConsoleText.IsWideChar(c) && + char.IsLetterOrDigit(c) /*todo: https://github.com/SlimeNull/NullLib.ConsoleEx/issues/2*/)) throw new NotSupportedException("Is not supposed to be rendered"); - } Console.Write(str); diff --git a/src/Consolonia.Core/InternalHelpers/CommonInternalHelper.cs b/src/Consolonia.Core/InternalHelpers/CommonInternalHelper.cs index 276c8836..dc15318f 100644 --- a/src/Consolonia.Core/InternalHelpers/CommonInternalHelper.cs +++ b/src/Consolonia.Core/InternalHelpers/CommonInternalHelper.cs @@ -6,7 +6,8 @@ namespace Consolonia.Core.InternalHelpers internal static class CommonInternalHelper { public static bool IsNearlyEqual(this double value, double compareTo) - {//todo: strange implementation for this name + { + //todo: strange implementation for this name return value.CompareTo(compareTo) == 0; } diff --git a/src/Consolonia.Core/Styles/ResourceIncludeBase.cs b/src/Consolonia.Core/Styles/ResourceIncludeBase.cs index 63d13d8e..0b41173d 100644 --- a/src/Consolonia.Core/Styles/ResourceIncludeBase.cs +++ b/src/Consolonia.Core/Styles/ResourceIncludeBase.cs @@ -46,11 +46,12 @@ public IStyle Loaded return _loaded[0]; } } + public bool TryGetResource(object key, ThemeVariant theme, out object value) { if (!_isLoading && Loaded is IResourceProvider p) return p.TryGetResource(key, theme, out value); - + value = null; return false; } diff --git a/src/Consolonia.Core/Text/FontManagerImpl.cs b/src/Consolonia.Core/Text/FontManagerImpl.cs index d93344f3..c3c53874 100644 --- a/src/Consolonia.Core/Text/FontManagerImpl.cs +++ b/src/Consolonia.Core/Text/FontManagerImpl.cs @@ -11,11 +11,6 @@ namespace Consolonia.Core.Text /// internal class FontManagerImpl : IFontManagerImpl { - public static string GetTheOnlyFontFamilyName() - { - return "ConsoleDefault(F7D6533C-AC9D-4C4A-884F-7719A9B5DC0C)"; - } - public string GetDefaultFontFamilyName() { return GetTheOnlyFontFamilyName(); @@ -23,10 +18,11 @@ public string GetDefaultFontFamilyName() string[] IFontManagerImpl.GetInstalledFontFamilyNames(bool checkForUpdates) { - return new []{GetTheOnlyFontFamilyName()}; + return new[] { GetTheOnlyFontFamilyName() }; } - public bool TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, FontStretch fontStretch, + public bool TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, + FontStretch fontStretch, CultureInfo culture, out Typeface typeface) { throw new NotImplementedException(); @@ -44,5 +40,10 @@ public bool TryCreateGlyphTypeface(Stream stream, out IGlyphTypeface glyphTypefa { throw new NotImplementedException(); } + + public static string GetTheOnlyFontFamilyName() + { + return "ConsoleDefault(F7D6533C-AC9D-4C4A-884F-7719A9B5DC0C)"; + } } } \ No newline at end of file diff --git a/src/Consolonia.Core/Text/GlyphRunImpl.cs b/src/Consolonia.Core/Text/GlyphRunImpl.cs index 93b8fc08..7c141569 100644 --- a/src/Consolonia.Core/Text/GlyphRunImpl.cs +++ b/src/Consolonia.Core/Text/GlyphRunImpl.cs @@ -20,9 +20,10 @@ public GlyphRunImpl(IGlyphTypeface glyphTypeface, IReadOnlyList glyph new Size(glyphInfos.Sum(info => info.GlyphAdvance), FontRenderingEmSize)); } + public ushort[] GlyphIndices { get; } + public void Dispose() { - } public IReadOnlyList GetIntersections(float lowerLimit, float upperLimit) @@ -35,6 +36,5 @@ public IReadOnlyList GetIntersections(float lowerLimit, float upperLimit) public double FontRenderingEmSize { get; } public Point BaselineOrigin { get; } public Rect Bounds { get; } - public ushort[] GlyphIndices { get; } } } \ No newline at end of file diff --git a/src/Consolonia.Core/Text/TextShaper.cs b/src/Consolonia.Core/Text/TextShaper.cs index 9df478e6..84a26c9d 100644 --- a/src/Consolonia.Core/Text/TextShaper.cs +++ b/src/Consolonia.Core/Text/TextShaper.cs @@ -12,14 +12,11 @@ public class TextShaper : ITextShaperImpl public ShapedBuffer ShapeText(ReadOnlyMemory text, TextShaperOptions options) { var glyphInfos = Convert(text.Span.ToString()); - + var shapedBuffer = new ShapedBuffer(text, glyphInfos.Length, new GlyphTypeface(), 1, 0 /*todo: must be 1 for right to left?*/); - - for (int i = 0; i < shapedBuffer.Length; i++) - { - shapedBuffer[i] = glyphInfos[i]; - } + + for (int i = 0; i < shapedBuffer.Length; i++) shapedBuffer[i] = glyphInfos[i]; return shapedBuffer; } diff --git a/src/Consolonia.PlatformSupport/WindowsConsole.cs b/src/Consolonia.PlatformSupport/WindowsConsole.cs index 2954de9e..34a2eef9 100644 --- a/src/Consolonia.PlatformSupport/WindowsConsole.cs +++ b/src/Consolonia.PlatformSupport/WindowsConsole.cs @@ -139,8 +139,8 @@ private bool HandleMouseInput(WindowsConsole.MouseEventRecord mouseEvent) case default(WindowsConsole.EventFlags): int xor = _mouseButtonsState ^ incomeMouseState; foreach (RawPointerEventType pointerEventType in ((WindowsConsole.ButtonState)(xor & - incomeMouseState)).GetFlags() - .Select(MouseButtonFlagTranslator.Translate)) + incomeMouseState)).GetFlags() + .Select(MouseButtonFlagTranslator.Translate)) //todo: вернуть mouse gesture на элементы RaiseMouseEvent(pointerEventType, point, @@ -149,8 +149,8 @@ private bool HandleMouseInput(WindowsConsole.MouseEventRecord mouseEvent) //todo: refactor: code clone foreach (RawPointerEventType pointerEventType in ((WindowsConsole.ButtonState)(xor & - _mouseButtonsState)).GetFlags() - .Select(MouseButtonFlagTranslator.Translate)) + _mouseButtonsState)).GetFlags() + .Select(MouseButtonFlagTranslator.Translate)) { RawPointerEventType rawPointerEventType = pointerEventType + 1; RaiseMouseEvent(rawPointerEventType, diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Button.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/Button.axaml index 179370ce..e96c19c8 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Button.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Button.axaml @@ -53,7 +53,7 @@ - + - + IsVisible="False" HorizontalAlignment="Center" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto" - ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto"> - + ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto" /> IsVisible="False" Margin="0,1" RowDefinitions="Auto,Auto,Auto" - ColumnDefinitions="Auto,Auto,Auto,Auto"> - + ColumnDefinitions="Auto,Auto,Auto,Auto" /> diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/ComboBox.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/ComboBox.axaml index f80868bd..36bda035 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/ComboBox.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/ComboBox.axaml @@ -76,8 +76,9 @@ BorderThickness="1" Margin="0,0,2,1" Background="{DynamicResource ThemeAlternativeBackgroundBrush}"> - + diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/DataGrid.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/DataGrid.axaml index 8fc87443..876ead88 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/DataGrid.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/DataGrid.axaml @@ -73,12 +73,12 @@ + Grid.Column="1" + Orientation="Vertical" + VerticalAlignment="Stretch" + Width="1" + Brush="{TemplateBinding BorderBrush}" + IsVisible="{TemplateBinding AreSeparatorsVisible}" /> @@ -320,7 +320,7 @@ Orientation="Horizontal" Brush="{TemplateBinding BorderBrush}" Margin="-1,0" /> - + ("ContentPresenter"); - + AttachedToVisualTree += (_, _) => { var parentWindow = this.FindAncestorOfType(); - _disposable = parentWindow!.GetPropertyChangedObservable(TopLevel.ClientSizeProperty).Subscribe(new AnonymousObserver( - args => - { - var newSize = (Size)args.NewValue!; + _disposable = parentWindow!.GetPropertyChangedObservable(TopLevel.ClientSizeProperty).Subscribe( + new AnonymousObserver( + args => + { + var newSize = (Size)args.NewValue!; - SetNewSize(newSize); - })); + SetNewSize(newSize); + })); SetNewSize(parentWindow!.ClientSize); }; DetachedFromLogicalTree += (_, _) => { _disposable.Dispose(); }; diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/AreIntegersEqualConverter.cs b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/AreIntegersEqualConverter.cs index 4c51e394..b900d59d 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/AreIntegersEqualConverter.cs +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/AreIntegersEqualConverter.cs @@ -14,12 +14,8 @@ public object Convert(IList values, Type targetType, object parameter, C int first = ints.FirstOrDefault(); for (int i = 1; i < values.Count; i++) - { if (ints[i] != first) - { return false; - } - } return true; } diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/FastLineSeparator.cs b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/FastLineSeparator.cs index 581fc651..bed5768c 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/FastLineSeparator.cs +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/FastLineSeparator.cs @@ -10,27 +10,27 @@ public class FastLineSeparator : Control public static readonly StyledProperty OrientationProperty = AvaloniaProperty.Register(nameof(Orientation)); + public static readonly StyledProperty BrushProperty = + AvaloniaProperty.Register(nameof(Brush), Brushes.Black); + + + public FastLineSeparator() + { + AffectsRender(OrientationProperty); + } + public Orientation Orientation { get => GetValue(OrientationProperty); set => SetValue(OrientationProperty, value); } - public static readonly StyledProperty BrushProperty = - AvaloniaProperty.Register(nameof(Brush), Brushes.Black); - public IBrush Brush { get => GetValue(BrushProperty); set => SetValue(BrushProperty, value); } - - public FastLineSeparator() - { - AffectsRender(OrientationProperty); - } - protected override Size MeasureOverride(Size availableSize) { return Orientation == Orientation.Horizontal diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/MenuExtensions.cs b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/MenuExtensions.cs index b7904c56..decb5eec 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/MenuExtensions.cs +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/MenuExtensions.cs @@ -35,7 +35,9 @@ static MenuExtensions() if (!(bool)eventArgs.NewValue!) Dispatcher.UIThread.Post(() => { - var focusedControl = (Control)AvaloniaLocator.Current.GetRequiredService()!.GetFocusedElement(); + var focusedControl = + (Control)AvaloniaLocator.Current.GetRequiredService()! + .GetFocusedElement(); var menuItems = visual.GetLogicalAncestors().OfType(); var focusedTree = focusedControl!.GetLogicalAncestors(); diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/SymbolsControl.cs b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/SymbolsControl.cs index 7f70d3e7..cf9b73c0 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/SymbolsControl.cs +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/SymbolsControl.cs @@ -12,10 +12,10 @@ namespace Consolonia.Themes.TurboVision.Templates.Controls.Helpers { /// - /// Represents a control that displays symbols. - /// This control has two modes of operation depending on the Fill property. - /// If the Fill property is false, it just draws - /// If the Fill property is true, the symbol (Text[0]) is repeated and fills the control. + /// Represents a control that displays symbols. + /// This control has two modes of operation depending on the Fill property. + /// If the Fill property is false, it just draws + /// If the Fill property is true, the symbol (Text[0]) is repeated and fills the control. /// public sealed class SymbolsControl : Control, IDisposable { @@ -37,7 +37,7 @@ public sealed class SymbolsControl : Control, IDisposable AvaloniaProperty.Register(nameof(Fill)); private GlyphRun _shapedText; - + private string _text; static SymbolsControl() @@ -68,7 +68,7 @@ public string Text set { _text = value; - + _shapedText = new GlyphRun(new GlyphTypeface(), 1, (_text ?? string.Empty).AsMemory(), @@ -77,6 +77,11 @@ public string Text } } + public void Dispose() + { + _shapedText?.Dispose(); + } + public override void Render(DrawingContext context) { if (!Fill) @@ -101,10 +106,5 @@ protected override Size MeasureOverride(Size availableSize) { return !Fill ? _shapedText?.Bounds.Size ?? default : default; } - - public void Dispose() - { - _shapedText?.Dispose(); - } } } \ No newline at end of file diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/TextBoxCaret.cs b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/TextBoxCaret.cs index 6e10a28b..9121ac0b 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/TextBoxCaret.cs +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/Helpers/TextBoxCaret.cs @@ -9,6 +9,12 @@ namespace Consolonia.Themes.TurboVision.Templates.Controls.Helpers { public class TextBoxCaret : Control { + public static readonly StyledProperty ActiveProperty = + AvaloniaProperty.Register(nameof(Active)); + + public static readonly StyledProperty PositionProperty = + AvaloniaProperty.Register(nameof(Position)); + public TextBoxCaret() { PositionProperty.Changed.Subscribe(new AnonymousObserver>(args => @@ -26,12 +32,6 @@ public TextBoxCaret() Focusable = false; } - public static readonly StyledProperty ActiveProperty = - AvaloniaProperty.Register(nameof(Active)); - - public static readonly StyledProperty PositionProperty = - AvaloniaProperty.Register(nameof(Position)); - public bool Active { get => GetValue(ActiveProperty); diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/ItemsControl.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/ItemsControl.axaml index 75d23a74..d05eafcf 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/ItemsControl.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/ItemsControl.axaml @@ -7,7 +7,7 @@ BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"> + ItemsPanel="{TemplateBinding ItemsPanel}" /> diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/ScrollViewer.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/ScrollViewer.axaml index 7e0a4354..5027d2cf 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/ScrollViewer.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/ScrollViewer.axaml @@ -11,9 +11,11 @@ Value="{DynamicResource ThemeBackgroundBrush}" /> - - - + + + diff --git a/src/Consolonia.Themes.TurboVision/Templates/Controls/TabControl.axaml b/src/Consolonia.Themes.TurboVision/Templates/Controls/TabControl.axaml index 8a3b30ba..d545e3a6 100644 --- a/src/Consolonia.Themes.TurboVision/Templates/Controls/TabControl.axaml +++ b/src/Consolonia.Themes.TurboVision/Templates/Controls/TabControl.axaml @@ -12,7 +12,7 @@ VerticalAlignment="{TemplateBinding VerticalAlignment}"> + ItemsPanel="{TemplateBinding ItemsPanel}" />