Skip to content

Commit

Permalink
Merge pull request #672 from b-editor/develop
Browse files Browse the repository at this point in the history
v1.0.0 Preview.1
  • Loading branch information
yuto-trd authored Aug 27, 2023
2 parents c45c8b6 + a41c55b commit 4381927
Show file tree
Hide file tree
Showing 61 changed files with 1,856 additions and 322 deletions.
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="7.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageVersion Include="Nito.AsyncEx" Version="5.1.2" />
Expand Down Expand Up @@ -63,4 +64,4 @@
<PackageVersion Include="System.Reactive" Version="6.0.0" />
<PackageVersion Include="Vortice.XAudio2" Version="3.2.0" />
</ItemGroup>
</Project>
</Project>
24 changes: 15 additions & 9 deletions src/Beutl.Controls/Styling/AppWindowStyles.axaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:wnd="using:FluentAvalonia.UI.Windowing">
<FontFamily x:Key="SegoeFluentIconsFontFamily">Segoe Fluent Icons</FontFamily>
xmlns:wnd="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia">

<x:Double x:Key="SplashScreenImageWidth">128</x:Double>
<x:Double x:Key="SplashScreenImageHeight">128</x:Double>
<x:Double x:Key="SplashScreenTextSize">32</x:Double>
<FontWeight x:Key="SplashScreenTextFontWeight">SemiBold</FontWeight>

<ControlTheme x:Key="FA_SystemCaptionButton" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource FATitle_SysCaptionBackground}" />
<Setter Property="Foreground" Value="{DynamicResource FATitle_SysCaptionForeground}" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Width" Value="46" />
<Setter Property="Foreground" Value="{DynamicResource FATitle_SysCaptionForeground}" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="FontFamily" Value="{StaticResource SegoeFluentIconsFontFamily}" />
<Setter Property="FontFamily" Value="{StaticResource SymbolThemeFontFamily}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Focusable" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}">
<Viewbox Width="10" Height="10">
<Viewbox Width="{TemplateBinding FontSize}" Height="{TemplateBinding FontSize}">
<ui:FontIcon Name="ButtonIcon"
FontFamily="{StaticResource SegoeFluentIconsFontFamily}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="{TemplateBinding Content}" />
</Viewbox>
</Border>
Expand Down Expand Up @@ -79,21 +83,23 @@
<ControlTemplate>
<StackPanel Orientation="Horizontal">
<Button Name="MinimizeButton"
Content="&#xE921;"
Content="&#xE738;"
Theme="{StaticResource FA_SystemCaptionButton}" />
<Button Name="MaxRestoreButton"
Content="&#xE922;"
Content="&#xE739;"
Theme="{StaticResource FA_SystemCaptionButton}" />
<Button Name="CloseButton"
Classes="Close"
Content="&#xE8BB;"
Content="&#xE711;"
FontSize="16"
Theme="{StaticResource FA_SystemCaptionButton}" />
</StackPanel>
</ControlTemplate>
</Setter>

<Style Selector="^:maximized /template/ Button#MaxRestoreButton">
<Setter Property="Content" Value="&#xE923;" />
<Setter Property="FontSize" Value="16" />
</Style>
</ControlTheme>

Expand Down
32 changes: 15 additions & 17 deletions src/Beutl.Controls/Styling/OptionsDisplayItem.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@
</Transitions>
</Setter>
</Style>
<Style Selector="^ /template/ Border#LayoutRoot:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
</Style>
<Style Selector="^:pressed /template/ Border#LayoutRoot:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
</Style>

<Style Selector="^:navigates">
<Style Selector="^ /template/ Border#LayoutRoot:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
</Style>
<Style Selector="^:pressed /template/ Border#LayoutRoot:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
</Style>
<Style Selector="^ /template/ ui|SymbolIcon#Chevron">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Symbol" Value="ChevronRight" />
Expand All @@ -154,15 +154,6 @@
</Style>

<Style Selector="^:expands">
<Style Selector="^ /template/ Border#LayoutRoot:pointerover">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
</Style>
<Style Selector="^:pressed /template/ Border#LayoutRoot">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
</Style>

<Style Selector="^ /template/ ui|SymbolIcon#Chevron">
<Setter Property="IsVisible" Value="True" />
<Setter Property="Symbol" Value="ChevronDown" />
Expand Down Expand Up @@ -238,6 +229,13 @@
</ControlTemplate>
</Setter>
</Style>

<!-- LayoutRoot -->
<Style Selector="^:disabled /template/ Border#LayoutRoot">
<Setter Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDisabledBrush}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
</Style>
</ControlTheme>
</Styles.Resources>
</Styles>
1 change: 1 addition & 0 deletions src/Beutl.Core/Beutl.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Beutl.Utilities\Beutl.Utilities.csproj" />
<ProjectReference Include="..\Beutl.Language\Beutl.Language.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Core/BeutlApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static BeutlApplication()
public BeutlApplication()
{
Items = new HierarchicalList<ProjectItem>(this);

}

public static BeutlApplication Current { get; } = new();
Expand Down
19 changes: 15 additions & 4 deletions src/Beutl.Core/CommandRecorder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using System.ComponentModel;
using System.Diagnostics;

using Beutl.Services;
using Beutl.Language;

using Microsoft.Extensions.Logging;

namespace Beutl;

public enum CommandType
Expand All @@ -18,6 +23,7 @@ public class CommandRecorder : INotifyPropertyChanged
private static readonly PropertyChangedEventArgs s_canUndoArgs = new(nameof(CanUndo));
private static readonly PropertyChangedEventArgs s_canRedoArgs = new(nameof(CanRedo));
private static readonly PropertyChangedEventArgs s_lastExecutedTimeArgs = new(nameof(LastExecutedTime));
private static readonly ILogger<CommandRecorder> s_logger = BeutlApplication.Current.LoggerFactory.CreateLogger<CommandRecorder>();
private readonly RingStack<IRecordableCommand> _undoStack = new(20000);
private readonly RingStack<IRecordableCommand> _redoStack = new(20000);
private bool _isExecuting;
Expand Down Expand Up @@ -103,9 +109,10 @@ public void DoAndPush(IRecordableCommand command)
_redoStack.Clear();
CanRedo = _redoStack.Count > 0;
}
catch
catch (Exception ex)
{
Debug.Fail("Commandの実行中に例外が発生。");
s_logger.LogError(ex, "An exception occurred while executing the command. {Command}", command);
NotificationService.ShowError(string.Empty, Message.OperationCouldNotBeExecuted);
Canceled?.Invoke(null, EventArgs.Empty);
}

Expand All @@ -131,8 +138,10 @@ public void Undo()
_redoStack.Push(command);
CanRedo = _redoStack.Count > 0;
}
catch
catch (Exception ex)
{
s_logger.LogError(ex, "An exception occurred while executing the undo command. {Command}", command);
NotificationService.ShowError(string.Empty, Message.OperationCouldNotBeExecuted);
}

_isExecuting = false;
Expand All @@ -158,8 +167,10 @@ public void Redo()
_undoStack.Push(command);
CanUndo = _undoStack.Count > 0;
}
catch
catch (Exception ex)
{
s_logger.LogError(ex, "An exception occurred while executing the redo command. {Command}", command);
NotificationService.ShowError(string.Empty, Message.OperationCouldNotBeExecuted);
}

_isExecuting = false;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[assembly: InternalsVisibleTo("Beutl")]
[assembly: InternalsVisibleTo("Beutl.Core.UnitTests")]
[assembly: InternalsVisibleTo("Beutl.Engine.UnitTests")]
[assembly: InternalsVisibleTo("Beutl.Configuration")]
[assembly: InternalsVisibleTo("Beutl.Engine")]
[assembly: InternalsVisibleTo("Beutl.ProjectSystem")]
24 changes: 24 additions & 0 deletions src/Beutl.Engine/Rendering/GlContexts/Cgl/CGLError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Beutl.Rendering.GlContexts;

internal enum CGLError
{
kCGLNoError = 0,
kCGLBadAttribute = 10000,
kCGLBadProperty = 10001,
kCGLBadPixelFormat = 10002,
kCGLBadRendererInfo = 10003,
kCGLBadContext = 10004,
kCGLBadDrawable = 10005,
kCGLBadDisplay = 10006,
kCGLBadState = 10007,
kCGLBadValue = 10008,
kCGLBadMatch = 10009,
kCGLBadEnumeration = 10010,
kCGLBadOffScreen = 10011,
kCGLBadFullScreen = 10012,
kCGLBadWindow = 10013,
kCGLBadAddress = 10014,
kCGLBadCodeModule = 10015,
kCGLBadAlloc = 10016,
kCGLBadConnection = 10017,
}
9 changes: 9 additions & 0 deletions src/Beutl.Engine/Rendering/GlContexts/Cgl/CGLOpenGLProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Beutl.Rendering.GlContexts;

internal enum CGLOpenGLProfile
{
kCGLOGLPVersion_Legacy = 0x1000,
kCGLOGLPVersion_3_2_Core = 0x3200,
kCGLOGLPVersion_GL3_Core = 0x3200,
kCGLOGLPVersion_GL4_Core = 0x4100,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace Beutl.Rendering.GlContexts;

internal enum CGLPixelFormatAttribute
{
kCGLPFANone = 0,
kCGLPFAAllRenderers = 1,
kCGLPFATripleBuffer = 3,
kCGLPFADoubleBuffer = 5,
kCGLPFAColorSize = 8,
kCGLPFAAlphaSize = 11,
kCGLPFADepthSize = 12,
kCGLPFAStencilSize = 13,
kCGLPFAMinimumPolicy = 51,
kCGLPFAMaximumPolicy = 52,
kCGLPFASampleBuffers = 55,
kCGLPFASamples = 56,
kCGLPFAColorFloat = 58,
kCGLPFAMultisample = 59,
kCGLPFASupersample = 60,
kCGLPFASampleAlpha = 61,
kCGLPFARendererID = 70,
kCGLPFANoRecovery = 72,
kCGLPFAAccelerated = 73,
kCGLPFAClosestPolicy = 74,
kCGLPFABackingStore = 76,
kCGLPFABackingVolatile = 77,
kCGLPFADisplayMask = 84,
kCGLPFAAllowOfflineRenderers = 96,
kCGLPFAAcceleratedCompute = 97,
kCGLPFAOpenGLProfile = 99,
kCGLPFASupportsAutomaticGraphicsSwitching = 101,
kCGLPFAVirtualScreenCount = 128,
}
49 changes: 49 additions & 0 deletions src/Beutl.Engine/Rendering/GlContexts/Cgl/Cgl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Runtime.InteropServices;

#pragma warning disable SYSLIB1054
#pragma warning disable IDE1006

namespace Beutl.Rendering.GlContexts;

internal class Cgl
{
private const string libGL = "/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL";

public const int GL_TEXTURE_2D = 0x0DE1;
public const int GL_UNSIGNED_BYTE = 0x1401;
public const int GL_RGBA = 0x1908;
public const int GL_RGBA8 = 0x8058;

[DllImport(libGL)]
public static extern void CGLGetVersion(out int majorvers, out int minorvers);

[DllImport(libGL)]
public static extern CGLError CGLChoosePixelFormat([In] CGLPixelFormatAttribute[] attribs, out IntPtr pix, out int npix);

[DllImport(libGL)]
public static extern CGLError CGLCreateContext(IntPtr pix, IntPtr share, out IntPtr ctx);

[DllImport(libGL)]
public static extern CGLError CGLReleasePixelFormat(IntPtr pix);

[DllImport(libGL)]
public static extern CGLError CGLSetCurrentContext(IntPtr ctx);

[DllImport(libGL)]
public static extern void CGLReleaseContext(IntPtr ctx);

[DllImport(libGL)]
public static extern CGLError CGLFlushDrawable(IntPtr ctx);

[DllImport(libGL)]
public static extern void glGenTextures(int n, uint[] textures);

[DllImport(libGL)]
public static extern void glDeleteTextures(int n, uint[] textures);

[DllImport(libGL)]
public static extern void glBindTexture(uint target, uint texture);

[DllImport(libGL)]
public static extern void glTexImage2D(uint target, int level, int internalformat, int width, int height, int border, uint format, uint type, IntPtr pixels);
}
Loading

0 comments on commit 4381927

Please sign in to comment.