Skip to content

Commit

Permalink
105 choredeps upgrade avalonia dependencies to 1100 (#119)
Browse files Browse the repository at this point in the history
* Avalonia 11.0.9

* Automated JetBrains cleanup

Co-authored-by:  <+@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jinek and github-actions[bot] authored Oct 29, 2024
1 parent b6417af commit 9264d99
Show file tree
Hide file tree
Showing 140 changed files with 1,407 additions and 1,781 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/editorconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
# from https://github.com/marketplace/actions/dotnet-format
steps:
- name: Get branch info # todo: is this needed?
Expand All @@ -33,10 +34,11 @@ jobs:
working-directory: ./src

- name: Inspect code
uses: muno92/resharper_inspectcode@1.4.0
uses: muno92/resharper_inspectcode@1.12.0
with:
solutionPath: ./src/Consolonia.sln
exclude: "**Consolonia.GuiCS/**.*"
exclude: "**Consolonia.GuiCS/**.*;**Consolonia.Gallery/**.*;**Example/**.*"
version: '2024.2.6'

- name: install-resharper
run: |
Expand All @@ -45,7 +47,7 @@ jobs:

- name: resharper-cleanup
run: |
jb cleanupcode Consolonia.sln --exclude="**Consolonia.GuiCS\**.*"
jb cleanupcode Consolonia.sln --exclude="**Consolonia.GuiCS/**.*;**Consolonia.Gallery/**.*;**Example/**.*"
working-directory: ./src

- name: Commit files
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/general_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ./src
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<Nullable>disable</Nullable>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>0.10.21</VersionPrefix>
<VersionPrefix>11.0.9</VersionPrefix>
<Authors>https://github.com/jinek/Consolonia/graphs/contributors</Authors>
<Description>Text User Interface implementation of Avalonia UI (GUI Framework)</Description>
<Copyright>Copyright © Evgeny Gorbovoy 2021 - 2022</Copyright>
</PropertyGroup>
<PropertyGroup>
<AvaloniaVersion>0.10.21</AvaloniaVersion>
<AvaloniaVersion>11.0.9</AvaloniaVersion>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions Directory.Core.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'RELEASE' ">true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<AvaloniaAccessUnstablePrivateApis>true</AvaloniaAccessUnstablePrivateApis>
<Avalonia_I_Want_To_Use_Private_Apis_In_Nuget_Package_And_Promise_To_Pin_The_Exact_Avalonia_Version_In_Package_Dependency>true</Avalonia_I_Want_To_Use_Private_Apis_In_Nuget_Package_And_Promise_To_Pin_The_Exact_Avalonia_Version_In_Package_Dependency>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3224,7 +3224,7 @@ resharper_use_collection_count_property_highlighting = suggestion
resharper_use_configure_await_false_for_async_disposable_highlighting = none
resharper_use_configure_await_false_highlighting = suggestion
resharper_use_deconstruction_highlighting = hint
resharper_use_deconstruction_on_parameter_highlighting = hint
resharper_use_deconstruction_on_parameter_highlighting = none
resharper_use_empty_types_field_highlighting = suggestion
resharper_use_event_args_empty_field_highlighting = suggestion
resharper_use_format_specifier_in_format_string_highlighting = suggestion
Expand Down
23 changes: 8 additions & 15 deletions src/Consolonia.Core/ApplicationStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@ public static class ApplicationStartup
lifetime.Start(args);
}

public static TAppBuilder UseStandardConsole<TAppBuilder>(this TAppBuilder builder)
where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
public static AppBuilder UseStandardConsole(this AppBuilder builder)
{
return builder.UseConsole(new DefaultNetConsole());
}

public static TAppBuilder UseConsole<TAppBuilder>(this TAppBuilder builder, IConsole console)
where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
public static AppBuilder UseConsole(this AppBuilder builder, IConsole console)
{
return builder.With(console);
}

public static TAppBuilder UseConsolonia<TAppBuilder>(this TAppBuilder builder)
where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
public static AppBuilder UseConsolonia(this AppBuilder builder)
{
return builder
.UseStandardRuntimePlatformSubsystem()
.UseWindowingSubsystem(() => new ConsoloniaPlatform().Initialize(), nameof(ConsoloniaPlatform))
.UseRenderingSubsystem(() =>
{
var platformRenderInterface =
AvaloniaLocator.CurrentMutable.GetService<IPlatformRenderInterface>();
var consoloniaRenderInterface = new ConsoloniaRenderInterface(platformRenderInterface);
var consoloniaRenderInterface = new ConsoloniaRenderInterface();
AvaloniaLocator.CurrentMutable
.Bind<IPlatformRenderInterface>().ToConstant(consoloniaRenderInterface);
Expand All @@ -65,8 +60,7 @@ public static ClassicDesktopStyleApplicationLifetime BuildLifetime<TApp>(IConsol
return CreateLifetime(consoloniaAppBuilder, args);
}

private static ClassicDesktopStyleApplicationLifetime CreateLifetime<T>(T builder, string[] args)
where T : AppBuilderBase<T>, new()
private static ClassicDesktopStyleApplicationLifetime CreateLifetime(AppBuilder builder, string[] args)
{
var lifetime = new ConsoloniaLifetime
{
Expand All @@ -77,9 +71,8 @@ private static ClassicDesktopStyleApplicationLifetime CreateLifetime<T>(T builde
return lifetime;
}

public static int StartWithConsoleLifetime<T>(
this T builder, string[] args)
where T : AppBuilderBase<T>, new()
public static int StartWithConsoleLifetime(
this AppBuilder builder, string[] args)
{
ClassicDesktopStyleApplicationLifetime lifetime = CreateLifetime(builder, args);
return lifetime.Start(args);
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Consolonia.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
</ItemGroup>

</Project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using Avalonia.Platform;

namespace Consolonia.Core.Drawing
{
internal sealed class ConsoloniaPlatformRenderInterfaceContext : IPlatformRenderInterfaceContext
{
public object TryGetFeature(Type featureType)
{
throw new NotImplementedException();
}

public void Dispose()
{
}

public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
{
return new RenderTarget(surfaces);
}

public bool IsLost => false;
}
}
92 changes: 40 additions & 52 deletions src/Consolonia.Core/Drawing/ConsoloniaRenderInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,15 @@
using System.IO;
using Avalonia;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Media.TextFormatting;
using Avalonia.Platform;
using Avalonia.Visuals.Media.Imaging;
using FormattedText = Consolonia.Core.Text.FormattedText;
using Consolonia.Core.Text;

namespace Consolonia.Core.Drawing
{
internal class ConsoloniaRenderInterface : IPlatformRenderInterface
{
private readonly IPlatformRenderInterface _platformRenderInterface;

public ConsoloniaRenderInterface(IPlatformRenderInterface platformRenderInterface)
{
_platformRenderInterface = platformRenderInterface;
}

public IFormattedTextImpl CreateFormattedText(
string text,
Typeface typeface,
double fontSize,
TextAlignment textAlignment,
TextWrapping wrapping,
Size constraint,
IReadOnlyList<FormattedTextStyleSpan> spans)
{
return new FormattedText(text, textAlignment, wrapping, constraint, spans);
//return _platformRenderInterface.CreateFormattedText(text, typeface, fontSize, textAlignment, wrapping, constraint, spans);
}

public IGeometryImpl CreateEllipseGeometry(Rect rect)
{
throw new NotImplementedException();
Expand All @@ -39,66 +20,61 @@ public IGeometryImpl CreateEllipseGeometry(Rect rect)
public IGeometryImpl CreateLineGeometry(Point p1, Point p2)
{
return Line.CreateMyLine(p1, p2);
//return _platformRenderInterface.CreateLineGeometry(p1, p2);
}

public IGeometryImpl CreateRectangleGeometry(Rect rect)
{
return new Rectangle(rect);
//return _platformRenderInterface.CreateRectangleGeometry(rect);
}

public IStreamGeometryImpl CreateStreamGeometry()
{
throw new NotImplementedException();
//return _platformRenderInterface.CreateStreamGeometry();
}

public IGeometryImpl CreateGeometryGroup(FillRule fillRule, IReadOnlyList<Geometry> children)
public IGeometryImpl CreateGeometryGroup(FillRule fillRule, IReadOnlyList<IGeometryImpl> children)
{
throw new NotImplementedException();
}

public IGeometryImpl CreateCombinedGeometry(GeometryCombineMode combineMode, Geometry g1, Geometry g2)
public IGeometryImpl CreateCombinedGeometry(GeometryCombineMode combineMode, IGeometryImpl g1, IGeometryImpl g2)
{
throw new NotImplementedException();
}

public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
public IGeometryImpl BuildGlyphRunGeometry(GlyphRun glyphRun)
{
return new RenderTarget(surfaces);

//return _platformRenderInterface.CreateRenderTarget(surfaces);
throw new NotImplementedException();
}

public IRenderTargetBitmapImpl CreateRenderTargetBitmap(PixelSize size, Vector dpi)
{
return _platformRenderInterface.CreateRenderTargetBitmap(size, dpi);
throw new NotImplementedException();
}

public IWriteableBitmapImpl CreateWriteableBitmap(PixelSize size, Vector dpi, PixelFormat format,
AlphaFormat alphaFormat)
{
return _platformRenderInterface.CreateWriteableBitmap(size, dpi, format, alphaFormat);
throw new NotImplementedException();
}

public IBitmapImpl LoadBitmap(string fileName)
{
return _platformRenderInterface.LoadBitmap(fileName);
throw new NotImplementedException();
}

public IBitmapImpl LoadBitmap(Stream stream)
{
return _platformRenderInterface.LoadBitmap(stream);
throw new NotImplementedException();
}

public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width,
BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
IWriteableBitmapImpl IPlatformRenderInterface.LoadWriteableBitmapToHeight(Stream stream, int height,
BitmapInterpolationMode interpolationMode)
{
throw new NotImplementedException();
}

public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height,
public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width,
BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
{
throw new NotImplementedException();
Expand All @@ -114,24 +90,22 @@ public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream)
throw new NotImplementedException();
}

public IBitmapImpl LoadBitmapToWidth(Stream stream, int width,
BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
IBitmapImpl IPlatformRenderInterface.LoadBitmapToWidth(Stream stream, int width,
BitmapInterpolationMode interpolationMode)
{
return _platformRenderInterface.LoadBitmapToWidth(stream, width, interpolationMode);
throw new NotImplementedException();
}

public IBitmapImpl LoadBitmapToHeight(Stream stream, int height,
BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
IBitmapImpl IPlatformRenderInterface.LoadBitmapToHeight(Stream stream, int height,
BitmapInterpolationMode interpolationMode)
{
return _platformRenderInterface.LoadBitmapToHeight(stream, height, interpolationMode);
throw new NotImplementedException();
}

public IBitmapImpl ResizeBitmap(
IBitmapImpl bitmapImpl,
PixelSize destinationSize,
BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality)
IBitmapImpl IPlatformRenderInterface.ResizeBitmap(IBitmapImpl bitmapImpl, PixelSize destinationSize,
BitmapInterpolationMode interpolationMode)
{
return _platformRenderInterface.ResizeBitmap(bitmapImpl, destinationSize, interpolationMode);
throw new NotImplementedException();
}

public IBitmapImpl LoadBitmap(
Expand All @@ -142,12 +116,26 @@ public IBitmapImpl LoadBitmap(
Vector dpi,
int stride)
{
return _platformRenderInterface.LoadBitmap(format, alphaFormat, data, size, dpi, stride);
throw new NotImplementedException();
}

public IGlyphRunImpl CreateGlyphRun(GlyphRun glyphRun, out double width)
public IGlyphRunImpl CreateGlyphRun(IGlyphTypeface glyphTypeface, double fontRenderingEmSize,
IReadOnlyList<GlyphInfo> glyphInfos,
Point baselineOrigin)
{
return _platformRenderInterface.CreateGlyphRun(glyphRun, out width);
return new GlyphRunImpl(glyphTypeface, glyphInfos, baselineOrigin);
}

public IPlatformRenderInterfaceContext CreateBackendContext(IPlatformGraphicsContext graphicsApiContext)
{
if (graphicsApiContext != null)
throw new NotImplementedException("Investigate this cases");
return new ConsoloniaPlatformRenderInterfaceContext();
}

public bool IsSupportedBitmapPixelFormat(PixelFormat format)
{
throw new NotImplementedException();
}

public bool SupportsIndividualRoundRects => false;
Expand Down
11 changes: 5 additions & 6 deletions src/Consolonia.Core/Drawing/DrawingContextHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ internal static class DrawingContextHelper
// ReSharper disable once UnusedMethodReturnValue.Global Can be used later
public static bool ExecuteWithClipping(this Rect rect, Point place, Action action)
{
if (!ContainsAligned(rect, place)) return false;
if (!rect.ContainsExclusive(place)) return false;

action();
return true;
}

public static bool ContainsAligned(this Rect rect, Point p)
public static bool IsEmpty(this Rect rect)
{
(double x, double y) = p;
return x >= rect.X && x < rect.X + rect.Width &&
y >= rect.Y && y < rect.Y + rect.Height;
//todo: check if this implementation serves our needs. Avalonia uses == 0
return rect.Width <= 0 || rect.Height <= 0;
}

public static bool IsTranslateOnly(this Matrix transform)
Expand All @@ -32,7 +31,7 @@ public static bool IsTranslateOnly(this Matrix transform)

public static bool NoRotation(this Matrix transform)
{
return transform.M12 == 0 && transform.M21 == 0;
return transform is { M12: 0, M21: 0 };
}
}
}
Loading

0 comments on commit 9264d99

Please sign in to comment.