Skip to content

Commit 359e3c8

Browse files
Merge pull request #248 from Pear-231/AudioEditorUpdate
Added a useable version of the Audio Editor tool
2 parents b6bc7f2 + 83d795d commit 359e3c8

File tree

175 files changed

+8384
-4868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+8384
-4868
lines changed

Diff for: AssetEditor/Themes/Controls.xaml

+72
Original file line numberDiff line numberDiff line change
@@ -2791,6 +2791,78 @@
27912791
</Setter>
27922792
</Style>
27932793

2794+
<Style x:Key="ExpanderDownHeaderWithBorderBackgroundStyle" TargetType="{x:Type ToggleButton}">
2795+
<Setter Property="Template">
2796+
<Setter.Value>
2797+
<ControlTemplate TargetType="{x:Type ToggleButton}">
2798+
<Border Background="{DynamicResource Button.Static.Background}" BorderBrush="{DynamicResource Button.Static.Border}" BorderThickness="1, 1, 1, 0" Padding="5, 0, 0, 0">
2799+
<Grid Background="Transparent" SnapsToDevicePixels="False">
2800+
<Grid.ColumnDefinitions>
2801+
<ColumnDefinition Width="19"/>
2802+
<ColumnDefinition Width="*"/>
2803+
</Grid.ColumnDefinitions>
2804+
<Ellipse x:Name="circle" Fill="{DynamicResource Expander.Static.Circle.Fill}" HorizontalAlignment="Center" Height="19" Stroke="{DynamicResource Expander.Static.Circle.Stroke}" VerticalAlignment="Center" Width="19"/>
2805+
<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="{DynamicResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center"/>
2806+
<ContentPresenter Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
2807+
</Grid>
2808+
</Border>
2809+
<ControlTemplate.Triggers>
2810+
<Trigger Property="IsChecked" Value="true">
2811+
<Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
2812+
</Trigger>
2813+
<Trigger Property="IsMouseOver" Value="true">
2814+
<Setter Property="Stroke" TargetName="circle" Value="{DynamicResource Expander.MouseOver.Circle.Stroke}"/>
2815+
<Setter Property="Fill" TargetName="circle" Value="{DynamicResource Expander.MouseOver.Circle.Fill}"/>
2816+
<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource Expander.MouseOver.Arrow.Stroke}"/>
2817+
</Trigger>
2818+
<Trigger Property="IsPressed" Value="true">
2819+
<Setter Property="Stroke" TargetName="circle" Value="{DynamicResource Expander.Pressed.Circle.Stroke}"/>
2820+
<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
2821+
<Setter Property="Fill" TargetName="circle" Value="{DynamicResource Expander.Pressed.Circle.Fill}"/>
2822+
<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource Expander.Pressed.Arrow.Stroke}"/>
2823+
</Trigger>
2824+
<Trigger Property="IsEnabled" Value="false">
2825+
<Setter Property="Stroke" TargetName="circle" Value="{DynamicResource Expander.Disabled.Circle.Stroke}"/>
2826+
<Setter Property="Fill" TargetName="circle" Value="{DynamicResource Expander.Disabled.Circle.Fill}"/>
2827+
<Setter Property="Stroke" TargetName="arrow" Value="{DynamicResource Expander.Disabled.Arrow.Stroke}"/>
2828+
</Trigger>
2829+
</ControlTemplate.Triggers>
2830+
</ControlTemplate>
2831+
</Setter.Value>
2832+
</Setter>
2833+
</Style>
2834+
2835+
<Style x:Key="ExpanderWithBorderBackground" TargetType="{x:Type Expander}">
2836+
<Setter Property="Foreground" Value="{DynamicResource ABrush.Foreground.Static}"/>
2837+
<Setter Property="Background" Value="Transparent"/>
2838+
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
2839+
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
2840+
<Setter Property="BorderBrush" Value="Transparent"/>
2841+
<Setter Property="BorderThickness" Value="0"/>
2842+
<Setter Property="Template">
2843+
<Setter.Value>
2844+
<ControlTemplate TargetType="{x:Type Expander}">
2845+
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" SnapsToDevicePixels="true">
2846+
<DockPanel >
2847+
<ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderWithBorderBackgroundStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
2848+
<Border BorderBrush="{DynamicResource Button.Static.Border}" BorderThickness="1, 1, 1, 0" >
2849+
<ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
2850+
</Border>
2851+
</DockPanel>
2852+
</Border>
2853+
<ControlTemplate.Triggers>
2854+
<Trigger Property="IsExpanded" Value="true">
2855+
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
2856+
</Trigger>
2857+
<Trigger Property="IsEnabled" Value="false">
2858+
<Setter Property="Foreground" Value="{DynamicResource ABrush.Foreground.Disabled}"/>
2859+
</Trigger>
2860+
</ControlTemplate.Triggers>
2861+
</ControlTemplate>
2862+
</Setter.Value>
2863+
</Setter>
2864+
</Style>
2865+
27942866
<Style TargetType="{x:Type Expander}">
27952867
<Setter Property="Foreground" Value="{DynamicResource ABrush.Foreground.Static}"/>
27962868
<Setter Property="Background" Value="Transparent"/>

Diff for: Editors/Audio/AudioEditor/AudioEditorData.cs

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<UserControl
2+
x:Class="Editors.Audio.AudioEditor.AudioEditorMenu.AudioEditorMenuView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="clr-namespace:Editors.Audio.AudioEditor.AudioEditorMenu"
8+
mc:Ignorable="d"
9+
d:DesignHeight="450" d:DesignWidth="800">
10+
11+
<Grid>
12+
<Grid.RowDefinitions>
13+
<RowDefinition
14+
Height="Auto"/>
15+
</Grid.RowDefinitions>
16+
17+
<Menu
18+
Grid.Row="0"
19+
Margin="0, 5, 5, 0">
20+
<MenuItem
21+
Header="_File"
22+
HorizontalAlignment="Left">
23+
<MenuItem
24+
Header="New Audio Project"
25+
Command="{Binding NewAudioProjectCommand}"/>
26+
<MenuItem
27+
Header="Open Audio Project"
28+
Command="{Binding LoadAudioProjectCommand}"/>
29+
<MenuItem
30+
Header="Save Audio Project"
31+
Command="{Binding SaveAudioProjectCommand}"/>
32+
<MenuItem
33+
Header="Compile Audio Project"
34+
Command="{Binding CompileAudioProjectCommand}"/>
35+
</MenuItem>
36+
</Menu>
37+
</Grid>
38+
</UserControl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Editors.Audio.AudioEditor.AudioEditorMenu
17+
{
18+
/// <summary>
19+
/// Interaction logic for AudioEditorMenuView.xaml
20+
/// </summary>
21+
public partial class AudioEditorMenuView : UserControl
22+
{
23+
public AudioEditorMenuView()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using CommunityToolkit.Mvvm.Input;
2+
using Editors.Audio.AudioEditor.AudioProjectData.AudioProjectService;
3+
using Editors.Audio.AudioEditor.NewAudioProject;
4+
using Shared.Core.PackFiles;
5+
using Shared.Core.Services;
6+
7+
namespace Editors.Audio.AudioEditor.AudioEditorMenu
8+
{
9+
public partial class AudioEditorMenuViewModel
10+
{
11+
public AudioEditorViewModel AudioEditorViewModel { get; set; }
12+
private readonly IPackFileService _packFileService;
13+
private readonly IAudioProjectService _audioProjectService;
14+
private readonly IStandardDialogs _packFileUiProvider;
15+
16+
public AudioEditorMenuViewModel(
17+
IPackFileService packFileService,
18+
IAudioProjectService audioProjectService,
19+
IStandardDialogs packFileUiProvider)
20+
{
21+
_packFileService = packFileService;
22+
_audioProjectService = audioProjectService;
23+
_packFileUiProvider = packFileUiProvider;
24+
}
25+
26+
[RelayCommand] public void NewAudioProject()
27+
{
28+
NewAudioProjectWindow.Show(AudioEditorViewModel, _packFileService, _audioProjectService, _packFileUiProvider);
29+
}
30+
31+
[RelayCommand] public void SaveAudioProject()
32+
{
33+
_audioProjectService.SaveAudioProject();
34+
}
35+
36+
[RelayCommand] public void LoadAudioProject()
37+
{
38+
_audioProjectService.LoadAudioProject(AudioEditorViewModel);
39+
}
40+
41+
[RelayCommand] public void CompileAudioProject()
42+
{
43+
_audioProjectService.CompileAudioProject();
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)