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

Nullabilityを修正 #731

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/Beutl.Controls/PropertyEditors/NumberEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Avalonia.Interactivity;

namespace Beutl.Controls.PropertyEditors;
#pragma warning disable AVP1002 // AvaloniaProperty objects should not be owned by a generic type

public class NumberEditor<TValue> : StringEditor
where TValue : INumber<TValue>
Expand Down
2 changes: 1 addition & 1 deletion src/Beutl.Extensibility/IAbstractProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void SetValue(T? value)

CoreProperty? IAbstractProperty.GetCoreProperty() => _animation.Property;

private static CoreProperty<T> GetProperty()
private static CoreProperty<T?> GetProperty()
{
return KeyFrame<T>.ValueProperty;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Beutl.Operators/Source/TextBlockOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public sealed class TextBlockOperator : DrawablePublishOperator<TextBlock>
{
public Setter<float> Size { get; set; } = new Setter<float>(TextBlock.SizeProperty, 24);

public Setter<FontFamily> FontFamily { get; set; } = new Setter<FontFamily>(TextBlock.FontFamilyProperty, Media.FontFamily.Default);
public Setter<FontFamily?> FontFamily { get; set; } = new Setter<FontFamily?>(TextBlock.FontFamilyProperty, Media.FontFamily.Default);

public Setter<FontStyle> FontStyle { get; set; } = new Setter<FontStyle>(TextBlock.FontStyleProperty, Media.FontStyle.Normal);

public Setter<FontWeight> FontWeight { get; set; } = new Setter<FontWeight>(TextBlock.FontWeightProperty, Media.FontWeight.Regular);

public Setter<float> Spacing { get; set; } = new Setter<float>(TextBlock.SpacingProperty, 0);

public Setter<string> Text { get; set; } = new Setter<string>(TextBlock.TextProperty, string.Empty);
public Setter<string?> Text { get; set; } = new Setter<string?>(TextBlock.TextProperty, string.Empty);

public Setter<ITransform?> Transform { get; set; } = new(Drawable.TransformProperty, new TransformGroup());

Expand Down
4 changes: 2 additions & 2 deletions src/Beutl/Services/PropertyEditorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ private record struct ListItemEditor(Func<IAbstractProperty, IListItemEditor?> C
{ typeof(ulong), new(_ => new NumberEditor<ulong>(), s => new NumberEditorViewModel<ulong>(s.ToTyped<ulong>())) },

{ typeof(bool), new(_ => new BooleanEditor(), s => new BooleanEditorViewModel(s.ToTyped<bool>())) },
{ typeof(string), new(_ => new StringEditor(), s => new StringEditorViewModel(s.ToTyped<string>())) },
{ typeof(string), new(_ => new StringEditor(), s => new StringEditorViewModel(s.ToTyped<string?>())) },

{ typeof(AlignmentX), new(_ => new AlignmentXEditor(), s => new AlignmentXEditorViewModel(s.ToTyped<AlignmentX>())) },
{ typeof(AlignmentY), new(_ => new AlignmentYEditor(), s => new AlignmentYEditorViewModel(s.ToTyped<AlignmentY>())) },
{ typeof(Enum), new(CreateEnumEditor, CreateEnumViewModel) },
{ typeof(FontFamily), new(_ => new FontFamilyEditor(), s => new FontFamilyEditorViewModel(s.ToTyped<FontFamily>())) },
{ typeof(FontFamily), new(_ => new FontFamilyEditor(), s => new FontFamilyEditorViewModel(s.ToTyped<FontFamily?>())) },
{ typeof(FileInfo), new(_ => new StorageFileEditor(), s => new StorageFileEditorViewModel(s.ToTyped<FileInfo>())) },

{ typeof(Color), new(_ => new ColorEditor(), s => new ColorEditorViewModel(s.ToTyped<Color>())) },
Expand Down
6 changes: 3 additions & 3 deletions src/Beutl/ViewModels/Editors/FontFamilyEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Beutl.ViewModels.Editors;

public sealed class FontFamilyEditorViewModel : ValueEditorViewModel<FontFamily>
public sealed class FontFamilyEditorViewModel : ValueEditorViewModel<FontFamily?>
{
public FontFamilyEditorViewModel(IAbstractProperty<FontFamily> property)
public FontFamilyEditorViewModel(IAbstractProperty<FontFamily?> property)
: base(property)
{
}
Expand All @@ -24,7 +24,7 @@ public override void Accept(IPropertyEditorContextVisitor visitor)

private void OnValueChanged(object? sender, PropertyEditorValueChangedEventArgs e)
{
if (e is PropertyEditorValueChangedEventArgs<FontFamily> args)
if (e is PropertyEditorValueChangedEventArgs<FontFamily?> args)
{
SetValue(args.OldValue, args.NewValue);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Beutl/ViewModels/Editors/StringEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace Beutl.ViewModels.Editors;

public sealed class StringEditorViewModel : ValueEditorViewModel<string>
public sealed class StringEditorViewModel : ValueEditorViewModel<string?>
{
public StringEditorViewModel(IAbstractProperty<string> property)
public StringEditorViewModel(IAbstractProperty<string?> property)
: base(property)
{
}
Expand All @@ -35,7 +35,7 @@ public override void Accept(IPropertyEditorContextVisitor visitor)

private void OnValueChanged(object? sender, PropertyEditorValueChangedEventArgs e)
{
if (e is PropertyEditorValueChangedEventArgs<string> args)
if (e is PropertyEditorValueChangedEventArgs<string?> args)
{
SetValue(args.OldValue, args.NewValue);
}
Expand Down