Skip to content

Commit d83de42

Browse files
authored
Avalonia 11 (#214)
The editor has been updated to the latest UI framework version. The new version has many breaking changes, if you think there is some new bug, please report it.
1 parent dee881c commit d83de42

File tree

1,127 files changed

+19965
-10866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,127 files changed

+19965
-10866
lines changed

AntlrSupport.props

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<!-- sadly AntlrBuildTools doesn't support non standard paths, so we need to revert obj/ and bin/ paths to the standard
5-
https://github.com/kaby76/Antlr4BuildTasks/issues/14
6-
-->
7-
<BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/obj</BaseIntermediateOutputPath>
8-
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(Configuration)</IntermediateOutputPath>
4+
95
</PropertyGroup>
106
</Project>

Avalonia.props

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<AvaloniaVersion>11.1.999-cibuild0045870-beta</AvaloniaVersion>
5+
</PropertyGroup>
36
<ItemGroup>
47
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
8+
<PackageReference Include="Avalonia.Skia" Version="$(AvaloniaVersion)" />
9+
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="$(AvaloniaVersion)" />
10+
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)"/>
511
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
6-
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
7-
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.10" />
8-
<PackageReference Include="Projektanker.Icons.Avalonia" Version="5.13.0" />
9-
<PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="5.13.0" />
12+
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
13+
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.10" />
14+
<PackageReference Include="Projektanker.Icons.Avalonia" Version="9.1.1" />
15+
<PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="9.1.1" />
1016
<ProjectReference Include="$(MSBuildThisFileDirectory)\Prism.Avalonia\src\Prism.Avalonia\Prism.Avalonia.csproj" />
1117
</ItemGroup>
1218
<ItemGroup>
@@ -17,4 +23,4 @@
1723
<SubType>Designer</SubType>
1824
</AvaloniaResource>
1925
</ItemGroup>
20-
</Project>
26+
</Project>

AvaloniaEdit

Submodule AvaloniaEdit updated 137 files
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Configurations>Debug;Release</Configurations>
7+
<Platforms>AnyCPU</Platforms>
8+
<Nullable>enable</Nullable>
9+
<WarningsAsErrors>$(WarningsAsErrors),nullable</WarningsAsErrors>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\AvaloniaStyles\AvaloniaStyles.csproj" />
14+
</ItemGroup>
15+
16+
<Import Project="..\Module.props" />
17+
<Import Project="..\Avalonia.props" />
18+
19+
<ItemGroup>
20+
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
21+
</ItemGroup>
22+
</Project>

AvaloniaStyles.Desktop/Program.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Avalonia;
2+
3+
namespace AvaloniaStyles.Desktop;
4+
5+
public class Program
6+
{
7+
static void Main(string[] args)
8+
=> BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
9+
10+
// App configuration, used by the entry point and previewer
11+
static AppBuilder BuildAvaloniaApp()
12+
=> AppBuilder.Configure<App>()
13+
.UsePlatformDetect()
14+
.WithInterFont()
15+
.LogToTrace();
16+
}

AvaloniaStyles/App.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
<Application.Styles>
66
<avaloniaStyles:SystemTheme Mode="LightWindows11" />
77
</Application.Styles>
8+
<Application.Resources>
9+
<ResourceDictionary>
10+
</ResourceDictionary>
11+
</Application.Resources>
812
</Application>

AvaloniaStyles/App.xaml.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ public override void OnFrameworkInitializationCompleted()
1616
{
1717
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
1818
desktop.MainWindow = new MainWindow();
19+
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
20+
{
21+
singleViewPlatform.MainView = new MainView
22+
{
23+
DataContext = new DemoDataContext()
24+
};
25+
}
1926
base.OnFrameworkInitializationCompleted();
2027
}
21-
22-
static void Main(string[] args)
23-
=> BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
24-
25-
// App configuration, used by the entry point and previewer
26-
static AppBuilder BuildAvaloniaApp()
27-
=> AppBuilder.Configure<App>()
28-
.With(new Win32PlatformOptions
29-
{
30-
OverlayPopups = true,
31-
})
32-
.UsePlatformDetect()
33-
.LogToTrace();
3428
}
3529
}

AvaloniaStyles/AvaloniaStyles.csproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<RuntimeIdentifiers>win8-x64;osx-x64;linux-x64;osx-arm64;win-x64</RuntimeIdentifiers>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
76
<Configurations>Debug;Release</Configurations>
87
<Platforms>AnyCPU</Platforms>
98
<Nullable>enable</Nullable>
10-
<WarningsAsErrors>nullable</WarningsAsErrors>
9+
<WarningsAsErrors>$(WarningsAsErrors),nullable</WarningsAsErrors>
1110
</PropertyGroup>
1211
<PropertyGroup>
13-
<SelfContained>false</SelfContained>
14-
<PublishSingleFile>true</PublishSingleFile>
15-
<OutputPath>..\bin\$(Configuration)\</OutputPath>
12+
<SelfContained>true</SelfContained>
1613
</PropertyGroup>
14+
1715
<Import Project="..\Module.props" />
1816

1917
<Import Project="..\Avalonia.props" />
@@ -26,6 +24,9 @@
2624
<AvaloniaResource Include="Styles\Assets\Lato\*.ttf" />
2725
<None Remove="Fonts\Symbols.ttf" />
2826
<AvaloniaResource Include="Fonts\Symbols.ttf" />
27+
<AvaloniaResource Remove="Styles\BigSur\**" />
28+
<AvaloniaResource Remove="Styles\Catalina\**" />
29+
<AvaloniaResource Remove="Styles\MacOs\**" />
2930
</ItemGroup>
3031
<ItemGroup>
3132
<ProjectReference Include="..\AvaloniaEdit\src\AvaloniaEdit\AvaloniaEdit.csproj" />
Lines changed: 46 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,55 @@
11
using Avalonia;
22
using Avalonia.Media;
3-
using Avalonia.Media.Immutable;
43
using Avalonia.Metadata;
54
using AvaloniaStyles.Utils;
5+
using HslColor = AvaloniaStyles.Utils.HslColor;
66

77
namespace AvaloniaStyles.Controls;
88

9-
public class AccentSolidColorBrush : Brush, ISolidColorBrush
9+
public class Accent
1010
{
11-
public static readonly StyledProperty<Color> BaseColorProperty =
12-
AvaloniaProperty.Register<AccentSolidColorBrush, Color>(nameof(BaseColor));
13-
14-
public static readonly StyledProperty<HslDiff> HueProperty =
15-
AvaloniaProperty.Register<AccentSolidColorBrush, HslDiff>(nameof(Hue));
16-
17-
static AccentSolidColorBrush()
18-
{
19-
AffectsRender<AccentSolidColorBrush>(BaseColorProperty);
20-
AffectsRender<AccentSolidColorBrush>(HueProperty);
21-
}
22-
23-
public AccentSolidColorBrush(Color color, double opacity = 1.0)
24-
{
25-
BaseColor = color;
26-
Opacity = opacity;
27-
}
28-
29-
public AccentSolidColorBrush(uint color) : this(Color.FromUInt32(color))
30-
{
31-
}
32-
33-
public AccentSolidColorBrush()
34-
{
35-
Opacity = 1;
36-
}
37-
38-
/// <summary>Gets or sets the color of the brush.</summary>
39-
[Content]
40-
public Color BaseColor
41-
{
42-
get => GetValue(BaseColorProperty);
43-
set => SetValue(BaseColorProperty, value);
44-
}
45-
46-
public HslDiff Hue
47-
{
48-
get => GetValue(HueProperty);
49-
set => SetValue(HueProperty, value);
50-
}
51-
52-
/// <summary>Parses a brush string.</summary>
53-
/// <param name="s">The brush string.</param>
54-
/// <returns>The <see cref="P:Avalonia.Media.SolidColorBrush.Color" />.</returns>
55-
/// <remarks>
56-
/// Whereas <see cref="M:Avalonia.Media.Brush.Parse(System.String)" /> may return an immutable solid color brush,
57-
/// this method always returns a mutable <see cref="T:Avalonia.Media.SolidColorBrush" />.
58-
/// </remarks>
59-
public static AccentSolidColorBrush Parse(string s)
60-
{
61-
ISolidColorBrush solidColorBrush1 = (ISolidColorBrush)Brush.Parse(s);
62-
return !(solidColorBrush1 is AccentSolidColorBrush solidColorBrush2)
63-
? new AccentSolidColorBrush(solidColorBrush1.Color)
64-
: solidColorBrush2;
65-
}
66-
67-
public override string ToString() => Color.ToString();
68-
69-
/// <inheritdoc />
70-
public override IBrush ToImmutable() => new ImmutableSolidColorBrush(this);
71-
72-
public Color Color
73-
{
74-
get
75-
{
76-
var hsl = HslColor.FromRgba(BaseColor).Scale(Hue);
77-
return hsl.ToRgba();
78-
}
79-
set
80-
{
81-
var hsl = HslColor.FromRgba(value);
82-
//Hue = (float)hsl.H;
83-
BaseColor = value;
84-
}
85-
}
11+
public static readonly StyledProperty<Color> BaseColorProperty =
12+
AvaloniaProperty.RegisterAttached<Accent, SolidColorBrush, Color>("BaseColor");
13+
14+
public static readonly StyledProperty<HslDiff> HueProperty =
15+
AvaloniaProperty.RegisterAttached<Accent, SolidColorBrush, HslDiff>("Hue");
16+
17+
static Accent()
18+
{
19+
HueProperty.Changed.AddClassHandler<SolidColorBrush>((brush, e) =>
20+
{
21+
Color baseColor;
22+
if (!brush.IsSet(BaseColorProperty))
23+
{
24+
baseColor = brush.Color;
25+
SetBaseColor(brush, baseColor);
26+
}
27+
else
28+
{
29+
baseColor = brush.GetValue(BaseColorProperty);
30+
}
31+
var hsl = HslColor.FromRgba(baseColor).Scale(e.NewValue as HslDiff);
32+
brush.Color = hsl.ToRgba();
33+
});
34+
}
35+
36+
public static Color GetBaseColor(AvaloniaObject obj)
37+
{
38+
return obj.GetValue(BaseColorProperty);
39+
}
40+
41+
public static void SetBaseColor(AvaloniaObject obj, Color value)
42+
{
43+
obj.SetValue(BaseColorProperty, value);
44+
}
45+
46+
public static HslDiff GetHue(AvaloniaObject obj)
47+
{
48+
return obj.GetValue(HueProperty);
49+
}
50+
51+
public static void SetHue(AvaloniaObject obj, HslDiff value)
52+
{
53+
obj.SetValue(HueProperty, value);
54+
}
8655
}

AvaloniaStyles/Controls/AlternativeScrollViewer.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)