Skip to content

Commit

Permalink
Move LineBrush/LineStyle into Consolonia.Controls public namespace (#232
Browse files Browse the repository at this point in the history
)

* Move LineBrush into public Consolonia.Controls namespace

* update unit tests namespace

* move DialogWindow, LineBrush, LineStyle, etc. into Consolonia.Controls namespace

* fix rule violations

* Automated JetBrains cleanup

Co-authored-by:  <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
tomlm and github-actions[bot] authored Dec 26, 2024
1 parent 2dd81ad commit a66b163
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 48 deletions.
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/Dialog/DialogHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Avalonia.Controls.Templates;
using Avalonia.Input;
using Avalonia.VisualTree;
using Consolonia.Controls;
using Consolonia.Core.Helpers;

namespace Consolonia.Core.Controls.Dialog
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/Dialog/DialogWrap.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Avalonia.Input;
using Avalonia.Reactive;
using Avalonia.VisualTree;
using Consolonia.Controls;

namespace Consolonia.Core.Controls.Dialog
{
Expand Down
4 changes: 2 additions & 2 deletions src/Consolonia.Core/Controls/DialogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
using Avalonia.VisualTree;
using Consolonia.Core.Controls.Dialog;

// ReSharper disable CheckNamespace
// ReSharper disable MemberCanBeProtected.Global

namespace Consolonia.Core.Controls
namespace Consolonia.Controls
{
[TemplatePart("PART_ContentPresenter", typeof(ContentPresenter))]
public class DialogWindow : UserControl
Expand Down
5 changes: 3 additions & 2 deletions src/Consolonia.Core/Controls/FileOpenPicker.axaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<controls:DialogWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:storage="clr-namespace:Avalonia.Platform.Storage;assembly=Avalonia.Base"
xmlns:controls="clr-namespace:Consolonia.Core.Controls"
xmlns:controls="clr-namespace:Consolonia.Controls"
xmlns:core-Controls="clr-namespace:Consolonia.Core.Controls"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="controls:FileOpenPickerViewModel"
x:DataType="core-Controls:FileOpenPickerViewModel"
x:Class="Consolonia.Core.Controls.FileOpenPicker"
Icon="📰"
CancelOnEscape="True"
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Consolonia.Controls;

namespace Consolonia.Core.Controls
{
Expand Down
5 changes: 3 additions & 2 deletions src/Consolonia.Core/Controls/FileSavePicker.axaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<controls:DialogWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:storage="clr-namespace:Avalonia.Platform.Storage;assembly=Avalonia.Base"
xmlns:controls="clr-namespace:Consolonia.Core.Controls"
xmlns:controls="clr-namespace:Consolonia.Controls"
xmlns:core-Controls="clr-namespace:Consolonia.Core.Controls"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="controls:FileSavePickerViewModel"
x:DataType="core-Controls:FileSavePickerViewModel"
x:Class="Consolonia.Core.Controls.FileSavePicker"
Icon="📰"
CancelOnEscape="True"
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/FileSavePicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Consolonia.Controls;

namespace Consolonia.Core.Controls
{
Expand Down
5 changes: 3 additions & 2 deletions src/Consolonia.Core/Controls/FolderPicker.axaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<controls:DialogWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:storage="clr-namespace:Avalonia.Platform.Storage;assembly=Avalonia.Base"
xmlns:controls="clr-namespace:Consolonia.Core.Controls"
xmlns:controls="clr-namespace:Consolonia.Controls"
xmlns:core-Controls="clr-namespace:Consolonia.Core.Controls"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="controls:FolderPickerViewModel"
x:DataType="core-Controls:FolderPickerViewModel"
x:Class="Consolonia.Core.Controls.FolderPicker"
Icon="📁"
CancelOnEscape="True"
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/FolderPicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Consolonia.Controls;
using Consolonia.Core.Infrastructure;

namespace Consolonia.Core.Controls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
using Avalonia.Media;
using Consolonia.Core.InternalHelpers;

namespace Consolonia.Core.Drawing
// ReSharper disable CheckNamespace
namespace Consolonia.Controls
{
public class LineBrush : Animatable, IImmutableBrush
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Consolonia.Core.Drawing
// ReSharper disable CheckNamespace

namespace Consolonia.Controls
{
public enum LineStyle
{
Expand Down
4 changes: 2 additions & 2 deletions src/Consolonia.Core/Controls/MessageBox.axaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<controls:DialogWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Consolonia.Core.Controls"
xmlns:controls="clr-namespace:Consolonia.Controls"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="controls:MessageBoxViewModel"
x:Class="Consolonia.Core.Controls.MessageBox"
x:Class="Consolonia.Controls.MessageBox"
CancelOnEscape="True"
WindowStartupLocation="CenterOwner"
Title="{Binding Title}">
Expand Down
4 changes: 3 additions & 1 deletion src/Consolonia.Core/Controls/MessageBox.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using Avalonia.Interactivity;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Consolonia.Core.Controls
// ReSharper disable CheckNamespace

namespace Consolonia.Controls
{
public partial class MessageBox : DialogWindow
{
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Drawing/DrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Avalonia.Media;
using Avalonia.Media.TextFormatting;
using Avalonia.Platform;
using Consolonia.Controls;
using Consolonia.Core.Drawing.PixelBufferImplementation;
using Consolonia.Core.Helpers;
using Consolonia.Core.Infrastructure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using Consolonia.Controls;

namespace Consolonia.Core.Drawing.PixelBufferImplementation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core"
xmlns:consolonia="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
x:Class="Consolonia.Gallery.Gallery.GalleryViews.GalleryAnimatedLines">
<Panel>
<Panel Width="40"
Expand Down Expand Up @@ -48,8 +48,8 @@
VerticalAlignment="Center"
HorizontalAlignment="Right">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Bold"
Brush="Blue" />
<consolonia:LineBrush LineStyle="Bold"
Brush="Blue" />
</Border.BorderBrush>
<Border.Styles>
<Style Selector="Border">
Expand Down Expand Up @@ -88,8 +88,8 @@
VerticalAlignment="Bottom"
HorizontalAlignment="Right">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="DoubleLine"
Brush="Blue" />
<consolonia:LineBrush LineStyle="DoubleLine"
Brush="Blue" />
</Border.BorderBrush>
<Border.Styles>
<Style Selector="Border">
Expand Down
34 changes: 17 additions & 17 deletions src/Consolonia.Gallery/Gallery/GalleryViews/GalleryBorders.axaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core"
xmlns:consolonia="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Expand All @@ -15,40 +15,40 @@
</Border>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="SingleLine"
Brush="Green" />
<consolonia:LineBrush LineStyle="SingleLine"
Brush="Green" />
</Border.BorderBrush>
<TextBlock Text="LineStyle=SingleLine"
Background="AntiqueWhite" />
</Border>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="DoubleLine"
Brush="Blue" />
<consolonia:LineBrush LineStyle="DoubleLine"
Brush="Blue" />
</Border.BorderBrush>
<TextBlock Text="LineStyle=DoubleLine"
Background="AntiqueWhite" />
</Border>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Edge"
Brush="DarkGreen" />
<consolonia:LineBrush LineStyle="Edge"
Brush="DarkGreen" />
</Border.BorderBrush>
<TextBlock Text="LineStyle=Edge"
Background="AntiqueWhite" />
</Border>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="EdgeWide"
Brush="Purple" />
<consolonia:LineBrush LineStyle="EdgeWide"
Brush="Purple" />
</Border.BorderBrush>
<TextBlock Text="LineStyle=EdgeWide"
Background="AntiqueWhite" />
</Border>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Bold"
Brush="DarkGray" />
<consolonia:LineBrush LineStyle="Bold"
Brush="DarkGray" />
</Border.BorderBrush>
<TextBlock Text="LineStyle=Bold"
Background="AntiqueWhite" />
Expand All @@ -57,8 +57,8 @@
<WrapPanel>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Edge"
Brush="Gray" />
<consolonia:LineBrush LineStyle="Edge"
Brush="Gray" />
</Border.BorderBrush>
<ComboBox Width="10">
<ComboBoxItem>Item 1</ComboBoxItem>
Expand All @@ -70,8 +70,8 @@
<Border BorderThickness="1 0 1 1"
Padding="0 1 0 0">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Edge"
Brush="Gray" />
<consolonia:LineBrush LineStyle="Edge"
Brush="Gray" />
</Border.BorderBrush>
<TextBlock Text="Partial borders"
Background="AntiqueWhite" />
Expand All @@ -80,8 +80,8 @@
<WrapPanel>
<Border BorderThickness="1">
<Border.BorderBrush>
<drawing:LineBrush LineStyle="Edge"
Brush="Gray" />
<consolonia:LineBrush LineStyle="Edge"
Brush="Gray" />
</Border.BorderBrush>
<Panel Background="AntiqueWhite">
<Image Source="avares://Consolonia.Gallery/Resources/happy.png"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core"
xmlns:consolonia="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Expand Down Expand Up @@ -74,8 +74,8 @@
<Line StartPoint="4,4"
EndPoint="8,8">
<Line.Stroke>
<drawing:LineBrush LineStyle="DoubleLine"
Brush="Red" />
<consolonia:LineBrush LineStyle="DoubleLine"
Brush="Red" />
</Line.Stroke>
</Line>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Avalonia.Interactivity;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using Consolonia.Core.Controls;
using Consolonia.Controls;

namespace Consolonia.Gallery.Gallery.GalleryViews
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
xmlns:controls="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Class="Consolonia.Gallery.Gallery.GalleryViews.SomeDialogWindow">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia;
using Avalonia.Interactivity;
using Consolonia.Core.Controls;
using Consolonia.Controls;

namespace Consolonia.Gallery.Gallery.GalleryViews
{
Expand Down
2 changes: 1 addition & 1 deletion src/Consolonia.Gallery/View/XamlDialogWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
xmlns:controls="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Class="Consolonia.Gallery.View.XamlDialogWindow">
Expand Down
2 changes: 1 addition & 1 deletion src/Consolonia.Gallery/View/XamlDialogWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Avalonia;
using Avalonia.Input;
using Avalonia.LogicalTree;
using Consolonia.Core.Controls;
using Consolonia.Controls;

namespace Consolonia.Gallery.View
{
Expand Down
7 changes: 3 additions & 4 deletions src/Consolonia.Themes/Templates/Controls/DialogWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers"
xmlns:drawing="clr-namespace:Consolonia.Core.Drawing;assembly=Consolonia.Core">
xmlns:controls="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core"
xmlns:helpers="clr-namespace:Consolonia.Themes.Templates.Controls.Helpers">
<Styles.Resources>
<Thickness x:Key="ConsoloniaDialogWindowBorderMargin">1,0</Thickness>
</Styles.Resources>
Expand Down Expand Up @@ -46,7 +45,7 @@
<Border BorderThickness="{TemplateBinding BorderThickness}"
Margin="{DynamicResource ConsoloniaDialogWindowBorderMargin}">
<Border.BorderBrush>
<drawing:LineBrush
<controls:LineBrush
Brush="{Binding Path=BorderBrush, RelativeSource={RelativeSource Mode=TemplatedParent}}"
LineStyle="DoubleLine" />
</Border.BorderBrush>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core">
xmlns:controls="clr-namespace:Consolonia.Controls;assembly=Consolonia.Core">
<Styles.Resources>
<ControlTheme x:Key="{x:Type controls:DialogWindow}"
TargetType="controls:DialogWindow"
Expand Down
1 change: 1 addition & 0 deletions src/Example.Blazor.Components/MainPage.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@page "/"
@using Consolonia.Controls
@inject INavigation Navigation
@inject IClassicDesktopStyleApplicationLifetime Lifetime

Expand Down
1 change: 1 addition & 0 deletions src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Avalonia.Media;
using Avalonia.Media.TextFormatting;
using Avalonia.Platform;
using Consolonia.Controls;
using Consolonia.Core.Drawing;
using Consolonia.Core.Drawing.PixelBufferImplementation;
using Consolonia.Core.Dummy;
Expand Down

0 comments on commit a66b163

Please sign in to comment.