Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

105 choredeps upgrade avalonia dependencies to 1100 #119

Merged
merged 63 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
17d9623
Avalonia 11.0.9
jinek Apr 13, 2024
bd8e2e3
Refactor multiple code files and update code comments
jinek Apr 14, 2024
395c6e2
Update helper method syntax and adjust bindings
jinek Apr 14, 2024
4dd755d
more fixes
jinek Apr 17, 2024
85d5eac
Add Avalonia threading and improve text shaping
jinek Apr 17, 2024
6e8aa2b
Refactor drawing and rendering methods
jinek Apr 17, 2024
6efaf75
application is now being run, but does not render
jinek Apr 17, 2024
b0cf503
Welcome page is rendered
jinek Apr 17, 2024
bb117b0
Window is painted when resized
jinek Apr 20, 2024
acfc4fd
Clickable button
jinek Apr 27, 2024
ed52281
- unused code
jinek May 1, 2024
259893e
- unused button
jinek May 1, 2024
dc51e56
Button shadow drawing
jinek May 1, 2024
773b1e6
Button drawing/ SymbolsControl.cs drawing
jinek May 1, 2024
2eff951
text trimming is fixed
jinek May 2, 2024
d69b033
Wild text rendering
jinek May 2, 2024
575f539
Initialize transform with Matrix Identity.
jinek May 6, 2024
7edf517
Platform settings for investigation
jinek May 6, 2024
40e45ec
LineBrush is rendered
jinek May 7, 2024
2a609ce
ScrollViewer now works
jinek Aug 12, 2024
52bf2fb
Null reference check brought back
jinek Aug 12, 2024
9204d7f
hit test for GlyphRun
jinek Aug 12, 2024
3a2579d
+1, similar to avalonia
jinek Aug 12, 2024
2b66acf
Textbox working
jinek Aug 14, 2024
d372108
more textbox
jinek Aug 14, 2024
d0d399f
keyboardnavigationhandler is back
jinek Aug 16, 2024
48d031f
combobox fix 1
jinek Aug 17, 2024
f15265e
ComboBox drop-down works fine
jinek Aug 20, 2024
874b29d
array in the combobox items
jinek Aug 20, 2024
478fd6a
Single test run. Buttons and TextBlock tests success separately.
jinek Aug 24, 2024
0e8f835
Multiple tests now can run
jinek Sep 4, 2024
1ffe787
ProgressBar.axaml adjusted
jinek Sep 8, 2024
afb4833
Separator
jinek Sep 8, 2024
d8e7eef
Dialog fixed
jinek Sep 15, 2024
82b946f
Entire list item is clickable
jinek Sep 15, 2024
bd34f74
Entire row in datagrid is clickable
jinek Sep 15, 2024
7871b19
Custom textbox Caret
jinek Sep 17, 2024
a807e3e
Comment removed
jinek Sep 20, 2024
4527aec
datagrid lines
jinek Oct 18, 2024
6cbff99
Calendar fixed
jinek Oct 19, 2024
5944506
build fixes
jinek Oct 20, 2024
eaefba3
more quality fixes
jinek Oct 20, 2024
112f9ad
TextBoxTests.cs
jinek Oct 20, 2024
456630a
ComboBoxTests.cs
jinek Oct 20, 2024
77af91f
FlyoutTests.cs
jinek Oct 20, 2024
e845e75
PR fixes
jinek Oct 20, 2024
8efff9e
build fixes
jinek Oct 20, 2024
121221a
refactoring
jinek Oct 20, 2024
8962d2c
formatting and small fixes
jinek Oct 21, 2024
d1cbe6b
Limits to run jobs
jinek Oct 21, 2024
5f0bd23
newer analysis version and null referene fix
jinek Oct 21, 2024
36cfbcc
Delegate error
jinek Oct 21, 2024
c1de176
other errors
jinek Oct 21, 2024
1b0ab64
PR fixes
jinek Oct 21, 2024
5a84e0f
last warning
jinek Oct 21, 2024
e9c3497
Automated JetBrains cleanup
github-actions[bot] Oct 21, 2024
2dcb1c8
newer jb version
jinek Oct 22, 2024
34c9336
Revert "Automated JetBrains cleanup"
jinek Oct 22, 2024
cf992dd
refactoring and formatting
jinek Oct 29, 2024
4dd039c
+ code inspection fixes
jinek Oct 29, 2024
ce70e76
last warning
jinek Oct 29, 2024
46b6c62
All notices fixed
jinek Oct 29, 2024
d4f7440
Automated JetBrains cleanup
github-actions[bot] Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
91 changes: 38 additions & 53 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,26 +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(
PixelFormat format,
AlphaFormat alphaFormat,
Expand All @@ -142,12 +114,25 @@ 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
Loading