Skip to content

Commit

Permalink
Renaming things
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrietS committed Oct 19, 2024
1 parent dadd220 commit ea3141b
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/LogAlligator.App/Controls/FileView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<Border Grid.Column="2"
BorderBrush="{DynamicResource ThemeControlMidBrush}"
BorderThickness="1">
<controls:LogView Name="RootLogView" textView:EndlessTextView.AddBookmark="OnAddBookmark"/>
<controls:LogView Name="RootLogView" textView:TextAreaView.AddBookmark="OnAddBookmark"/>
</Border>
</Grid>
</Border>
Expand Down
2 changes: 1 addition & 1 deletion src/LogAlligator.App/Controls/FileView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public FileView()
BookmarksView.JumpToBookmark += OnJumpToBookmark;
}

public async void OnAddBookmark(object? sender, EndlessTextView.BookmarkEventArgs bookmarkEvent)
public async void OnAddBookmark(object? sender, TextAreaView.BookmarkEventArgs bookmarkEvent)
{
var bookmarkDialog = new BookmarkDialog();
try
Expand Down
2 changes: 1 addition & 1 deletion src/LogAlligator.App/Controls/LogView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<ToggleButton Content="_All occurrences" IsEnabled="False"/>
</StackPanel>
</Border>
<textView:EndlessTextView Name="TextView" />
<textView:TextAreaView Name="TextView" />
</DockPanel>
</TabItem>
</TabControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

namespace LogAlligator.App.Controls.TextView;

internal class TextArea : Control
internal class TextAreaControl : Control
{
private TextAreaLine[] _lines = [];
private double _lineHeight;

public static readonly StyledProperty<IBrush> BackgroundProperty =
AvaloniaProperty.Register<TextArea, IBrush>(nameof(Background), new SolidColorBrush(Colors.Transparent));
AvaloniaProperty.Register<TextAreaControl, IBrush>(nameof(Background), new SolidColorBrush(Colors.Transparent));

public IBrush Background
{
Expand All @@ -22,7 +22,7 @@ public IBrush Background
}

public static readonly StyledProperty<IBrush> ForegroundProperty =
AvaloniaProperty.Register<TextArea, IBrush>(nameof(Foreground), new SolidColorBrush(Colors.Black));
AvaloniaProperty.Register<TextAreaControl, IBrush>(nameof(Foreground), new SolidColorBrush(Colors.Black));

public IBrush Foreground
{
Expand All @@ -34,7 +34,7 @@ public IBrush Foreground
public Color BackgroundColor => ((SolidColorBrush)Background).Color;

public static readonly StyledProperty<double> FontSizeProperty =
AvaloniaProperty.Register<TextArea, double>(nameof(FontSize), 12);
AvaloniaProperty.Register<TextAreaControl, double>(nameof(FontSize), 12);

public double FontSize
{
Expand All @@ -43,7 +43,7 @@ public double FontSize
}

public static readonly StyledProperty<Thickness> PaddingProperty =
Decorator.PaddingProperty.AddOwner<TextArea>();
Decorator.PaddingProperty.AddOwner<TextAreaControl>();

public Thickness Padding
{
Expand All @@ -52,7 +52,7 @@ public Thickness Padding
}

public static readonly StyledProperty<FontFamily> FontFamilyProperty =
AvaloniaProperty.Register<TextArea, FontFamily>(nameof(FontFamily), FontFamily.Default);
AvaloniaProperty.Register<TextAreaControl, FontFamily>(nameof(FontFamily), FontFamily.Default);

public FontFamily FontFamily
{
Expand All @@ -78,13 +78,13 @@ public int NumberOfLines

public int NumberOfLinesThatCanFit => (int)Math.Ceiling(Bounds.Height / _lineHeight);

static TextArea()
static TextAreaControl()
{
FontSizeProperty.Changed.AddClassHandler<TextArea>((o, _) => o.OnFontSizeChanged());
FontFamilyProperty.Changed.AddClassHandler<TextArea>((o, _) => o.OnFontFamilyChanged());
FontSizeProperty.Changed.AddClassHandler<TextAreaControl>((o, _) => o.OnFontSizeChanged());
FontFamilyProperty.Changed.AddClassHandler<TextAreaControl>((o, _) => o.OnFontFamilyChanged());
}

public TextArea()
public TextAreaControl()
{
_lineHeight = GetInitialLineHeight(FontFamily, FontSize);
}
Expand Down Expand Up @@ -122,7 +122,7 @@ public void SetLineBackground(int lineIndex, IBrush? background)
/// <summary>
/// Gets position of the character in the text pointed by <paramref name="position"/> (usually mouse cursor)
/// </summary>
/// <param name="position">Position (X,Y) relative to <see cref="TextArea"/>.</param>
/// <param name="position">Position (X,Y) relative to <see cref="TextAreaControl"/>.</param>
/// <returns>
/// <para>A tuple containing the index of pointed line and index of pointer character in that line.</para>
/// <para>If <paramref name="position"/> points above the first line, then <c>(0, 0)</c> is returned.</para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
xmlns:textView="clr-namespace:LogAlligator.App.Controls.TextView"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="250"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
x:Class="LogAlligator.App.Controls.TextView.EndlessTextView">
x:Class="LogAlligator.App.Controls.TextView.TextAreaView">
<UserControl.Styles>
<Style Selector="Border#TextViewBorder">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
</Style>
<Style Selector="textView|EndlessTextView:focus Border#TextViewBorder">
<Style Selector="textView|TextAreaView:focus Border#TextViewBorder">
<Setter Property="BorderBrush" Value="{DynamicResource HighlightBrush2}" />
</Style>
</UserControl.Styles>
Expand Down Expand Up @@ -57,7 +57,7 @@
</StackPanel>
<Panel Name="TextAreaContainer"
ClipToBounds="True">
<textView:TextArea Name="TextArea"
<textView:TextAreaControl Name="TextArea"
Cursor="Ibeam"
FontFamily="Arial"
FontSize="12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace LogAlligator.App.Controls.TextView;

public partial class EndlessTextView : UserControl
public partial class TextAreaView : UserControl
{
private ILineProvider _lines = new EmptyLineProvider();
private int _topLineIndex = 0;
Expand All @@ -32,15 +32,15 @@ public partial class EndlessTextView : UserControl
private SearchPattern? _searchHighlight;

private static readonly StyledProperty<IBrush> HighlightBackgroundProperty =
AvaloniaProperty.Register<EndlessTextView, IBrush>(nameof(HighlightBackground), new SolidColorBrush(Color.FromRgb(0, 120, 215)));
AvaloniaProperty.Register<TextAreaView, IBrush>(nameof(HighlightBackground), new SolidColorBrush(Color.FromRgb(0, 120, 215)));
public IBrush HighlightBackground
{
get => GetValue(HighlightBackgroundProperty);
set => SetValue(HighlightBackgroundProperty, value);
}

private static readonly StyledProperty<IBrush> HighlightForegroundProperty =
AvaloniaProperty.Register<EndlessTextView, IBrush>(nameof(HighlightForeground), new SolidColorBrush(Colors.Black));
AvaloniaProperty.Register<TextAreaView, IBrush>(nameof(HighlightForeground), new SolidColorBrush(Colors.Black));
public IBrush HighlightForeground
{
get => GetValue(HighlightForegroundProperty);
Expand All @@ -53,13 +53,13 @@ public class BookmarkEventArgs : RoutedEventArgs
public required string LineText { get; init; }
public required string SelectedText { get; init; }

public BookmarkEventArgs() : base(EndlessTextView.AddBookmarkEvent)
public BookmarkEventArgs() : base(TextAreaView.AddBookmarkEvent)
{
}
}

public static readonly RoutedEvent<BookmarkEventArgs> AddBookmarkEvent =
RoutedEvent.Register<EndlessTextView, BookmarkEventArgs>(nameof(AddBookmark2), RoutingStrategies.Bubble);
RoutedEvent.Register<TextAreaView, BookmarkEventArgs>(nameof(AddBookmark2), RoutingStrategies.Bubble);

public event EventHandler<BookmarkEventArgs> AddBookmark2
{
Expand Down Expand Up @@ -96,7 +96,7 @@ private set
}
}

public EndlessTextView()
public TextAreaView()
{
InitializeComponent();

Expand All @@ -115,7 +115,7 @@ public EndlessTextView()
TextArea.PointerReleased += TextArea_PointerReleased;
TextArea.PointerMoved += TextArea_PointerMoved;

WeakEventHandlerManager.Subscribe<Application, EventArgs, EndlessTextView>(
WeakEventHandlerManager.Subscribe<Application, EventArgs, TextAreaView>(
Application.Current!, nameof(Application.ActualThemeVariantChanged), OnActualThemeVariantChanged);

if (Design.IsDesignMode)
Expand Down

0 comments on commit ea3141b

Please sign in to comment.