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

Modernized getter and setter syntax where appropriate #429

Merged
merged 1 commit into from
Aug 8, 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
24 changes: 12 additions & 12 deletions src/AvaloniaMath/Controls/FormulaBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,39 +70,39 @@ public FormulaBlock()

public string Formula
{
get { return GetValue(FormulaProperty); }
set { SetValue(FormulaProperty, value); }
get => GetValue(FormulaProperty);
set => SetValue(FormulaProperty, value);
}

public double Scale
{
get { return GetValue(ScaleProperty); }
set { SetValue(ScaleProperty, value); }
get => GetValue(ScaleProperty);
set => SetValue(ScaleProperty, value);
}

public string SystemTextFontName
{
get { return GetValue(SystemTextFontNameProperty); }
set { SetValue(SystemTextFontNameProperty, value); }
get => GetValue(SystemTextFontNameProperty);
set => SetValue(SystemTextFontNameProperty, value);
}

public bool HasError
{
get { return GetValue(HasErrorProperty); }
private set { SetValue(HasErrorProperty, value); }
get => GetValue(HasErrorProperty);
private set => SetValue(HasErrorProperty, value);
}

public ObservableCollection<Exception> Errors
{
get { return GetValue(ErrorsProperty); }
private set { SetValue(ErrorsProperty, value); }
get => GetValue(ErrorsProperty);
private set => SetValue(ErrorsProperty, value);
}

// TODO[#353]: Make it used
public ControlTemplate ErrorTemplate
{
get { return GetValue(ErrorTemplateProperty); }
set { SetValue(ErrorTemplateProperty, value); }
get => GetValue(ErrorTemplateProperty);
set => SetValue(ErrorTemplateProperty, value);
}

public override void Render(DrawingContext context)
Expand Down
28 changes: 14 additions & 14 deletions src/WpfMath/Controls/FormulaControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public partial class FormulaControl : UserControl

public string Formula
{
get { return (string)GetValue(FormulaProperty); }
set { SetValue(FormulaProperty, value); }
get => (string)GetValue(FormulaProperty);
set => SetValue(FormulaProperty, value);
}

public double Scale
{
get { return (double)GetValue(ScaleProperty); }
set { SetValue(ScaleProperty, value); }
get => (double)GetValue(ScaleProperty);
set => SetValue(ScaleProperty, value);
}

public string SystemTextFontName
Expand All @@ -40,32 +40,32 @@ public string SystemTextFontName

public bool HasError
{
get { return (bool)GetValue(HasErrorProperty); }
private set { SetValue(HasErrorProperty, value); }
get => (bool)GetValue(HasErrorProperty);
private set => SetValue(HasErrorProperty, value);
}

public ObservableCollection<Exception> Errors
{
get { return (ObservableCollection<Exception>)GetValue(ErrorsProperty); }
private set { SetValue(ErrorsProperty, value); }
get => (ObservableCollection<Exception>)GetValue(ErrorsProperty);
private set => SetValue(ErrorsProperty, value);
}

public ControlTemplate ErrorTemplate
{
get { return (ControlTemplate)GetValue(ErrorTemplateProperty); }
set { SetValue(ErrorTemplateProperty, value); }
get => (ControlTemplate)GetValue(ErrorTemplateProperty);
set => SetValue(ErrorTemplateProperty, value);
}

public int SelectionStart
{
get { return (int)GetValue(SelectionStartProperty); }
set { SetValue(SelectionStartProperty, value); }
get => (int)GetValue(SelectionStartProperty);
set => SetValue(SelectionStartProperty, value);
}

public int SelectionLength
{
get { return (int)GetValue(SelectionLengthProperty); }
set { SetValue(SelectionLengthProperty, value); }
get => (int)GetValue(SelectionLengthProperty);
set => SetValue(SelectionLengthProperty, value);
}

public Brush? SelectionBrush
Expand Down
7 changes: 2 additions & 5 deletions src/WpfMath/Controls/VisualContainerElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public VisualContainerElement()

public DrawingVisual? Visual
{
get { return this.visual; }
get => this.visual;
set
{
RemoveVisualChild(this.visual);
Expand All @@ -31,10 +31,7 @@ public DrawingVisual? Visual
}
}

protected override int VisualChildrenCount
{
get { return 1; }
}
protected override int VisualChildrenCount => 1;

protected override Visual? GetVisualChild(int index)
{
Expand Down
5 changes: 1 addition & 4 deletions src/XamlMath.Shared/Atoms/DummyAtom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public static DummyAtom CreateLigature(FixedCharAtom ligatureAtom) =>

public bool IsTextSymbol { get; init; }

public bool IsKern
{
get { return this.Atom is SpaceAtom; }
}
public bool IsKern => this.Atom is SpaceAtom;

public Result<CharFont> GetCharFont(ITeXFont texFont) =>
((CharSymbol)this.Atom).GetCharFont(texFont);
Expand Down
5 changes: 1 addition & 4 deletions src/XamlMath.Shared/Boxes/Box.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ protected Box(IBrush? foreground, IBrush? background)
this.Background = background;
}

public ReadOnlyCollection<Box> Children
{
get { return this.childrenReadOnly; }
}
public ReadOnlyCollection<Box> Children => this.childrenReadOnly;

public SourceSpan? Source
{
Expand Down
4 changes: 2 additions & 2 deletions src/XamlMath.Shared/TexEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public sealed record TexEnvironment(

internal int LastFontId
{
get { return this.lastFontId == TexFontUtilities.NoFontId ? this.MathFont.GetMuFontId() : this.lastFontId; }
set { this.lastFontId = value; }
get => this.lastFontId == TexFontUtilities.NoFontId ? this.MathFont.GetMuFontId() : this.lastFontId;
set => this.lastFontId = value;
}

internal TexEnvironment GetCrampedStyle() =>
Expand Down
5 changes: 1 addition & 4 deletions src/XamlMath.Shared/TexFormulaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ static TexFormulaParser()
textStyles = formulaSettingsParser.GetTextStyles();
}

internal static string[][] DelimiterNames
{
get { return delimiterNames; }
}
internal static string[][] DelimiterNames => delimiterNames;

internal static string GetDelimeterMapping(char character)
{
Expand Down
Loading