mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-13 03:34:55 +08:00
Compare commits
62 Commits
v1.0.147.0
...
v1.1.166.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e6ba725d2 | ||
|
|
ffb0c58a58 | ||
|
|
3b61f568d0 | ||
|
|
b925a10d69 | ||
|
|
720f4b311e | ||
|
|
6c03002051 | ||
|
|
9cebd56bd5 | ||
|
|
f0a4c1251d | ||
|
|
a8418d4234 | ||
|
|
53abc4526c | ||
|
|
4d3b982904 | ||
|
|
5faace562d | ||
|
|
290b7f38b4 | ||
|
|
6f02a1a46c | ||
|
|
4f74e48cfb | ||
|
|
06f08558cc | ||
|
|
a2b21ed3d5 | ||
|
|
4cb1ca0bb3 | ||
|
|
81ed341e47 | ||
|
|
a9f92f4cb7 | ||
|
|
62719ed513 | ||
|
|
c9bd7725d0 | ||
|
|
b60952916c | ||
|
|
ec0917b6c8 | ||
|
|
583fa106ce | ||
|
|
88488e4813 | ||
|
|
6e65310b6d | ||
|
|
22bd7c2252 | ||
|
|
5c50bd569a | ||
|
|
401c33003c | ||
|
|
664451c530 | ||
|
|
657c81add5 | ||
|
|
1dd63ab9ba | ||
|
|
0a9b9bf484 | ||
|
|
794079f20b | ||
|
|
be9a67f57d | ||
|
|
5b5d62d688 | ||
|
|
dfe428645e | ||
|
|
8e2c977a44 | ||
|
|
47806c924d | ||
|
|
bbda1cd797 | ||
|
|
2099332f02 | ||
|
|
016d9a626f | ||
|
|
cff6f202d6 | ||
|
|
f643f86567 | ||
|
|
e9b50c84ac | ||
|
|
4c590bcf6f | ||
|
|
68a1c6a465 | ||
|
|
f46364a491 | ||
|
|
75f047e389 | ||
|
|
1cb21b1373 | ||
|
|
4592be10e8 | ||
|
|
c0217150c1 | ||
|
|
0705bde0e2 | ||
|
|
3f5122c93f | ||
|
|
97f061d887 | ||
|
|
77525a62ff | ||
|
|
ad473bbd1d | ||
|
|
b1126026c2 | ||
|
|
2f84155e6e | ||
|
|
1769167811 | ||
|
|
551da8c0b0 |
@@ -12,7 +12,7 @@
|
||||
<Identity
|
||||
Name="37412.BetterLyrics"
|
||||
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
|
||||
Version="1.0.147.0" />
|
||||
Version="1.1.166.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
<converter:IntToDoubleConverter x:Key="IntToDoubleConverter" />
|
||||
<converter:MillisecondsToSecondsConverter x:Key="MillisecondsToSecondsConverter" />
|
||||
<converter:PictureInfosToImageSourceConverter x:Key="PictureInfosToImageSourceConverter" />
|
||||
<converter:LyricsFontWeightToFontWeightConverter x:Key="LyricsFontWeightToFontWeightConverter" />
|
||||
<converter:TextAlignmentTypeToHorizontalAlignmentConverter x:Key="TextAlignmentTypeToHorizontalAlignmentConverter" />
|
||||
<converter:LyricsLayoutOrientationToOrientationConverter x:Key="LyricsLayoutOrientationToOrientationConverter" />
|
||||
<converter:LyricsLayoutOrientationNegationToOrientationConverter x:Key="LyricsLayoutOrientationNegationToOrientationConverter" />
|
||||
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
|
||||
@@ -13,7 +13,6 @@ using BetterLyrics.WinUI3.Services.ResourceService;
|
||||
using BetterLyrics.WinUI3.Services.SettingsService;
|
||||
using BetterLyrics.WinUI3.Services.TranslateService;
|
||||
using BetterLyrics.WinUI3.ViewModels;
|
||||
using BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel;
|
||||
using BetterLyrics.WinUI3.Views;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -69,7 +68,7 @@ namespace BetterLyrics.WinUI3
|
||||
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
WindowHook.OpenOrShowWindow<LyricsWindow>();
|
||||
WindowHook.OpenOrShowWindow<NowPlayingWindow>();
|
||||
if (Ioc.Default.GetRequiredService<ISettingsService>().AppSettings.MusicGallerySettings.AutoOpen)
|
||||
{
|
||||
WindowHook.OpenOrShowWindow<MusicGalleryWindow>();
|
||||
@@ -110,13 +109,12 @@ namespace BetterLyrics.WinUI3
|
||||
.AddSingleton<LyricsWindowSettingsControlViewModel>()
|
||||
.AddSingleton<LyricsWindowSwitchControlViewModel>()
|
||||
.AddSingleton<LyricsWindowSwitchWindowViewModel>()
|
||||
.AddSingleton<LyricsWindowViewModel>()
|
||||
.AddSingleton<NowPlayingWindowViewModel>()
|
||||
.AddSingleton<SettingsWindowViewModel>()
|
||||
.AddSingleton<SystemTrayViewModel>()
|
||||
.AddSingleton<SettingsPageViewModel>()
|
||||
.AddSingleton<LyricsPageViewModel>()
|
||||
.AddSingleton<NowPlayingPageViewModel>()
|
||||
.AddSingleton<MusicGalleryViewModel>()
|
||||
.AddSingleton<LyricsRendererViewModel>()
|
||||
.AddSingleton<AboutControlViewModel>()
|
||||
.BuildServiceProvider()
|
||||
);
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
<None Remove="Assets\Segoe Fluent Icons.ttf" />
|
||||
<None Remove="Assets\Wiki82.profile.xml" />
|
||||
<None Remove="Controls\AboutControl.xaml" />
|
||||
<None Remove="Controls\AlbumArtLayoutSettingsControl.xaml" />
|
||||
<None Remove="Controls\AlbumArtAreaEffectSettingsControl.xaml" />
|
||||
<None Remove="Controls\AppSettingsControl.xaml" />
|
||||
<None Remove="Controls\DemoWindowGrid.xaml" />
|
||||
<None Remove="Controls\ExtendedSlider.xaml" />
|
||||
<None Remove="Controls\FontFamilyAutoSuggestBox.xaml" />
|
||||
<None Remove="Controls\ImageSwitcher.xaml" />
|
||||
<None Remove="Controls\LyricsSearchControl.xaml" />
|
||||
<None Remove="Controls\LyricsStyleSettingsControl.xaml" />
|
||||
<None Remove="Controls\LyricsWindowSettingsControl.xaml" />
|
||||
@@ -37,6 +38,7 @@
|
||||
<None Remove="Controls\PropertyRow.xaml" />
|
||||
<None Remove="Controls\ShortcutTextBox.xaml" />
|
||||
<None Remove="Controls\SystemTray.xaml" />
|
||||
<None Remove="Controls\WindowSettingsControl.xaml" />
|
||||
<None Remove="Views\LyricsSearchWindow.xaml" />
|
||||
<None Remove="Views\LyricsWindowSwitchWindow.xaml" />
|
||||
<None Remove="Views\MusicGalleryPage.xaml" />
|
||||
@@ -65,7 +67,7 @@
|
||||
<PackageReference Include="ComputeSharp.D2D1.WinUI" Version="3.2.0" />
|
||||
<PackageReference Include="csharp-kana" Version="1.0.2" />
|
||||
<PackageReference Include="csharp-pinyin" Version="1.0.1" />
|
||||
<PackageReference Include="DevWinUI.Controls" Version="9.5.0" />
|
||||
<PackageReference Include="DevWinUI.Controls" Version="9.6.0" />
|
||||
<PackageReference Include="Dubya.WindowsMediaController" Version="2.5.5" />
|
||||
<PackageReference Include="F23.StringSimilarity" Version="7.0.0" />
|
||||
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.3.2" />
|
||||
@@ -80,7 +82,7 @@
|
||||
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
||||
<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
|
||||
<PackageReference Include="NTextCat" Version="0.3.65" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.3-dev-02320" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="10.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.0" />
|
||||
@@ -93,7 +95,7 @@
|
||||
<PackageReference Include="Vanara.Windows.Shell" Version="4.2.1" />
|
||||
<PackageReference Include="VCollab.DiscordRichPresence" Version="1.7.0" />
|
||||
<PackageReference Include="WinUIEx" Version="2.9.0" />
|
||||
<PackageReference Include="z440.atl.core" Version="7.8.0" />
|
||||
<PackageReference Include="z440.atl.core" Version="7.9.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ColorThief.WinUI3\ColorThief.WinUI3.csproj" />
|
||||
@@ -292,7 +294,7 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\AlbumArtLayoutSettingsControl.xaml">
|
||||
<Page Update="Controls\AlbumArtAreaStyleSettingsControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
@@ -334,6 +336,26 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="TemplateSelector\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\WindowSettingsControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\AlbumArtAreaEffectSettingsControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\ImageSwitcher.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\ShadowImage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\PropertyRow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
public class ExtendedGenreFiled
|
||||
{
|
||||
public const string NetEaseCloudMusicTrackID = "NCM-";
|
||||
public const string QQMusicTrackID = "QQ-";
|
||||
public const string FileName = "FILENAME-";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public static class Link
|
||||
{
|
||||
public const string MicrosoftStore = "https://apps.microsoft.com/detail/9p1wcd1p597r";
|
||||
|
||||
|
||||
public const string GitHub = "https://github.com/jayfunc/BetterLyrics";
|
||||
public const string ShareHub = $"{GitHub}/blob/dev/ShareHub/index.md";
|
||||
public const string TermsOfService = $"{GitHub}/blob/dev/TermsofService.md";
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
public const string Edge = "MSEdge";
|
||||
public const string BetterLyrics = "37412.BetterLyrics_rd1g0rsrrtxw8!App";
|
||||
public const string BetterLyricsDebug = "37412.BetterLyrics_c8mj3v9sysxb4!App";
|
||||
public const string SaltPlayerForWindows = "Sakawish.SaltPlayerforWindows_q65q631pyh094!SaltPlayerforWindows";
|
||||
public const string SaltPlayerForWindowsMS = "Sakawish.SaltPlayerforWindows_q65q631pyh094!SaltPlayerforWindows";
|
||||
public const string SaltPlayerForWindowsSteam = "Salt Player for Windows.exe";
|
||||
public const string MoeKoeMusic = "cn.MoeKoe.Music";
|
||||
public const string MoeKoeMusicAlternative = "electron.app.MoeKoe Music";
|
||||
public const string Listen1 = "com.listen1.listen1";
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
public const string Edge = "Microsoft Edge";
|
||||
public const string BetterLyrics = "BetterLyrics";
|
||||
public const string BetterLyricsDebug = "BetterLyrics (Debug)";
|
||||
public const string SaltPlayerForWindows = "Salt Player for Windows";
|
||||
public const string SaltPlayerForWindowsMS = "Salt Player for Windows (Microsoft Store)";
|
||||
public const string SaltPlayerForWindowsSteam = "Salt Player for Windows (Steam)";
|
||||
public const string MoeKoeMusic = "MoeKoe Music";
|
||||
public const string Listen1 = "Listen 1";
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace BetterLyrics.WinUI3.Constants
|
||||
{
|
||||
public static class Time
|
||||
{
|
||||
public static readonly TimeSpan DebounceTimeout = TimeSpan.FromMilliseconds(300);
|
||||
public static readonly TimeSpan AnimationDuration = TimeSpan.FromMilliseconds(300);
|
||||
public static readonly TimeSpan DebounceTimeout = TimeSpan.FromMilliseconds(250);
|
||||
public static readonly TimeSpan AnimationDuration = TimeSpan.FromMilliseconds(350);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Controls.AlbumArtAreaEffectSettingsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dev="using:DevWinUI"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<ScrollViewer Style="{StaticResource SettingsScrollViewerStyle}">
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock x:Uid="SettingsPageAlbumEffect" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageImageSwitchType" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind AlbumArtAreaEffectSettings.ImageSwitchType, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageCrossfade" />
|
||||
<ComboBoxItem x:Uid="SettingsPageSlide" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,37 @@
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls;
|
||||
|
||||
public sealed partial class AlbumArtAreaEffectSettingsControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty AlbumArtAreaEffectSettingsProperty =
|
||||
DependencyProperty.Register(nameof(AlbumArtAreaEffectSettings), typeof(AlbumArtAreaEffectSettings), typeof(AlbumArtAreaEffectSettingsControl), new PropertyMetadata(default));
|
||||
|
||||
public AlbumArtAreaEffectSettings AlbumArtAreaEffectSettings
|
||||
{
|
||||
get => (AlbumArtAreaEffectSettings)GetValue(AlbumArtAreaEffectSettingsProperty);
|
||||
set => SetValue(AlbumArtAreaEffectSettingsProperty, value);
|
||||
}
|
||||
|
||||
public AlbumArtAreaEffectSettingsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Controls.AlbumArtLayoutSettingsControl"
|
||||
x:Class="BetterLyrics.WinUI3.Controls.AlbumArtAreaStyleSettingsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||
@@ -16,29 +16,40 @@
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock x:Uid="SettingsPageAlbumStyle" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<!-- 整体对齐 -->
|
||||
<dev:SettingsCard x:Uid="SettingsPageAlignment" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind AlbumArtLayoutSettings.SongInfoAlignmentType, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageLeft" />
|
||||
<ComboBoxItem x:Uid="SettingsPageCenter" />
|
||||
<ComboBoxItem x:Uid="SettingsPageRight" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<TextBlock x:Uid="SettingsPageAlbumArt" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<!-- 专辑高度 -->
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAlbumArtSize"
|
||||
x:Uid="SettingsPageAlbumArtHeight"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageAutoAdjust">
|
||||
<ToggleSwitch IsOn="{x:Bind AlbumArtLayoutSettings.AutoAlbumArtSize, Mode=TwoWay}" />
|
||||
<ToggleSwitch IsOn="{x:Bind AlbumArtLayoutSettings.IsAutoCoverImageHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard IsEnabled="{x:Bind AlbumArtLayoutSettings.AutoAlbumArtSize, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}">
|
||||
<dev:SettingsCard IsEnabled="{x:Bind AlbumArtLayoutSettings.IsAutoCoverImageHeight, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}">
|
||||
<local:ExtendedSlider
|
||||
Frequency="2"
|
||||
Maximum="800"
|
||||
Minimum="10"
|
||||
ResetButtonVisibility="Collapsed"
|
||||
Maximum="512"
|
||||
Minimum="0"
|
||||
Unit="px"
|
||||
Value="{x:Bind AlbumArtLayoutSettings.AlbumArtSize, Mode=TwoWay}" />
|
||||
Value="{x:Bind AlbumArtLayoutSettings.CoverImageHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<!-- 专辑圆角 -->
|
||||
<dev:SettingsCard x:Uid="SettingsPageAlbumRadius" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
Default="12"
|
||||
@@ -48,6 +59,7 @@
|
||||
Value="{x:Bind AlbumArtLayoutSettings.CoverImageRadius, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<!-- 专辑阴影 -->
|
||||
<dev:SettingsCard x:Uid="SettingsPageAlbumShadowAmount" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
Default="12"
|
||||
@@ -58,14 +70,6 @@
|
||||
|
||||
<TextBlock x:Uid="SettingsPageSongInfo" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageSongInfoAlignment" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind AlbumArtLayoutSettings.SongInfoAlignmentType, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageSongInfoLeft" />
|
||||
<ComboBoxItem x:Uid="SettingsPageSongInfoCenter" />
|
||||
<ComboBoxItem x:Uid="SettingsPageSongInfoRight" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageLyricsFontSize"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
@@ -87,21 +91,15 @@
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageShowTitle"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowTitle" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind AlbumArtLayoutSettings.ShowTitle, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowArtists">
|
||||
<ToggleSwitch IsEnabled="{x:Bind AlbumArtLayoutSettings.ShowTitle, Mode=OneWay}" IsOn="{x:Bind AlbumArtLayoutSettings.ShowArtists, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowAlbum">
|
||||
<ToggleSwitch IsEnabled="{x:Bind AlbumArtLayoutSettings.ShowTitle, Mode=OneWay}" IsOn="{x:Bind AlbumArtLayoutSettings.ShowAlbum, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowArtists" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind AlbumArtLayoutSettings.ShowArtists, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowAlbum" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind AlbumArtLayoutSettings.ShowAlbum, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -7,18 +7,18 @@ using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
public sealed partial class AlbumArtLayoutSettingsControl : UserControl
|
||||
public sealed partial class AlbumArtAreaStyleSettingsControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty AlbumArtLayoutSettingsProperty =
|
||||
DependencyProperty.Register(nameof(AlbumArtLayoutSettings), typeof(AlbumArtLayoutSettings), typeof(AlbumArtLayoutSettingsControl), new PropertyMetadata(default));
|
||||
DependencyProperty.Register(nameof(AlbumArtLayoutSettings), typeof(AlbumArtAreaStyleSettings), typeof(AlbumArtAreaStyleSettingsControl), new PropertyMetadata(default));
|
||||
|
||||
public AlbumArtLayoutSettings AlbumArtLayoutSettings
|
||||
public AlbumArtAreaStyleSettings AlbumArtLayoutSettings
|
||||
{
|
||||
get => (AlbumArtLayoutSettings)GetValue(AlbumArtLayoutSettingsProperty);
|
||||
get => (AlbumArtAreaStyleSettings)GetValue(AlbumArtLayoutSettingsProperty);
|
||||
set => SetValue(AlbumArtLayoutSettingsProperty, value);
|
||||
}
|
||||
|
||||
public AlbumArtLayoutSettingsControl()
|
||||
public AlbumArtAreaStyleSettingsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -6,25 +6,54 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="using:BetterLyrics.WinUI3.Models"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<TextBlock
|
||||
x:Name="SelectedLocalizedFontFamilyTextBlock"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{StaticResource TextFillColorSecondaryBrush}"
|
||||
IsTextSelectionEnabled="True" />
|
||||
<AutoSuggestBox
|
||||
x:Name="AutoSuggestBox"
|
||||
Width="150"
|
||||
MinWidth="180"
|
||||
GotFocus="AutoSuggestBox_GotFocus"
|
||||
LostFocus="AutoSuggestBox_LostFocus"
|
||||
SuggestionChosen="AutoSuggestBox_SuggestionChosen"
|
||||
Text="{x:Bind SelectedFontFamily, Mode=OneWay}"
|
||||
TextChanged="AutoSuggestBox_TextChanged" />
|
||||
TextChanged="AutoSuggestBox_TextChanged">
|
||||
<!--<AutoSuggestBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="models:ExtendedFontFamily">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{x:Bind LocalizedFontFamily}" TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind FontFamily}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</AutoSuggestBox.ItemTemplate>-->
|
||||
</AutoSuggestBox>
|
||||
<Button
|
||||
Click="Button_Click"
|
||||
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
FontSize=12,
|
||||
Glyph=}"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
Style="{StaticResource GhostButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="SettingsPageRefreshDropdown" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<Button Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, FontSize=12, Glyph=}" Style="{StaticResource GhostButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="SettingsPageCollapseDropdown" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Services.SettingsService;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
@@ -11,11 +18,15 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
public sealed partial class FontFamilyAutoSuggestBox : UserControl
|
||||
{
|
||||
private List<string> SystemFontNames { get; set; } = [.. FontHelper.SystemFontFamilies];
|
||||
private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
|
||||
|
||||
//private List<ExtendedFontFamily> FontFamilies { get; set; } = [];
|
||||
private List<string> FontFamilies { get; set; } = [];
|
||||
|
||||
public FontFamilyAutoSuggestBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
RefreshFontFamilies();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedFontFamilyProperty =
|
||||
@@ -27,20 +38,47 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
set => SetValue(SelectedFontFamilyProperty, value);
|
||||
}
|
||||
|
||||
private void RefreshFontFamilies()
|
||||
{
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// var fontFamilies = FontHelper.SystemFontFamilies.Select(x => new ExtendedFontFamily()
|
||||
// {
|
||||
// FontFamily = x,
|
||||
// LocalizedFontFamily = FontHelper.GetLocalizedFontFamilyName(x, _settingsService.AppSettings.GeneralSettings.LanguageCode)
|
||||
// }).OrderBy(x => x.LocalizedFontFamily).ToList();
|
||||
// DispatcherQueue.TryEnqueue(() =>
|
||||
// {
|
||||
// FontFamilies = fontFamilies;
|
||||
// });
|
||||
//});
|
||||
FontFamilies = FontHelper.SystemFontFamilies.OrderBy(x => x).ToList();
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
|
||||
{
|
||||
SelectedFontFamily = args.SelectedItem.ToString() ?? "";
|
||||
if (args.SelectedItem is ExtendedFontFamily extendedFontFamily)
|
||||
{
|
||||
SelectedFontFamily = extendedFontFamily.FontFamily;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedFontFamily = args.SelectedItem.ToString() ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAutoSuggestBoxItemsSource()
|
||||
private void UpdateAutoSuggestBoxItemsSource(string? query = null)
|
||||
{
|
||||
query ??= AutoSuggestBox.Text;
|
||||
|
||||
//var suitableItems = new List<ExtendedFontFamily>();
|
||||
var suitableItems = new List<string>();
|
||||
var splitText = AutoSuggestBox.Text.ToLower().Split(" ");
|
||||
foreach (var fontFamily in SystemFontNames)
|
||||
var splitText = query.ToLower().Split(" ");
|
||||
foreach (var fontFamily in FontFamilies)
|
||||
{
|
||||
var found = splitText.All((key) =>
|
||||
bool found = splitText.All((key) =>
|
||||
{
|
||||
//return fontFamily.FontFamily.ToLower().Contains(key) || fontFamily.LocalizedFontFamily.ToLower().Contains(key);
|
||||
return fontFamily.ToLower().Contains(key);
|
||||
});
|
||||
if (found)
|
||||
@@ -50,9 +88,15 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
}
|
||||
if (suitableItems.Count == 0)
|
||||
{
|
||||
//suitableItems.Add(new ExtendedFontFamily()
|
||||
//{
|
||||
// FontFamily = "",
|
||||
// LocalizedFontFamily = "N/A"
|
||||
//});
|
||||
suitableItems.Add("N/A");
|
||||
}
|
||||
AutoSuggestBox.ItemsSource = suitableItems.Order();
|
||||
//AutoSuggestBox.ItemsSource = suitableItems.OrderBy(x => x.LocalizedFontFamily);
|
||||
AutoSuggestBox.ItemsSource = suitableItems.OrderBy(x => x);
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
||||
@@ -63,16 +107,18 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
UpdateAutoSuggestBoxItemsSource();
|
||||
}
|
||||
|
||||
SelectedLocalizedFontFamilyTextBlock.Text = FontHelper.GetLocalizedFontFamilyName(SelectedFontFamily, _settingsService.AppSettings.GeneralSettings.LanguageCode);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SystemFontNames = [.. FontHelper.SystemFontFamilies];
|
||||
RefreshFontFamilies();
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateAutoSuggestBoxItemsSource();
|
||||
UpdateAutoSuggestBoxItemsSource("");
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_LostFocus(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Controls.ImageSwitcher"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:const="using:BetterLyrics.WinUI3.Constants"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.OpacityTransition>
|
||||
<ScalarTransition Duration="{x:Bind const:Time.AnimationDuration}" />
|
||||
</Grid.OpacityTransition>
|
||||
<local:ShadowImage
|
||||
x:Name="LastAlbumArtImage"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadiusAmount="{x:Bind CornerRadiusAmount, Mode=OneWay}"
|
||||
ShadowAmount="{x:Bind ShadowAmount, Mode=OneWay}" />
|
||||
<local:ShadowImage
|
||||
x:Name="AlbumArtImage"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadiusAmount="{x:Bind CornerRadiusAmount, Mode=OneWay}"
|
||||
ShadowAmount="{x:Bind ShadowAmount, Mode=OneWay}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,145 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls;
|
||||
|
||||
public sealed partial class ImageSwitcher : UserControl
|
||||
{
|
||||
public int CornerRadiusAmount
|
||||
{
|
||||
get { return (int)GetValue(CornerRadiusAmountProperty); }
|
||||
set { SetValue(CornerRadiusAmountProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CornerRadiusAmountProperty =
|
||||
DependencyProperty.Register(nameof(CornerRadiusAmount), typeof(int), typeof(ImageSwitcher), new PropertyMetadata(0));
|
||||
|
||||
public int ShadowAmount
|
||||
{
|
||||
get { return (int)GetValue(ShadowAmountProperty); }
|
||||
set { SetValue(ShadowAmountProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShadowAmountProperty =
|
||||
DependencyProperty.Register(nameof(ShadowAmount), typeof(int), typeof(ImageSwitcher), new PropertyMetadata(0));
|
||||
|
||||
public ImageSource? Source
|
||||
{
|
||||
get { return (ImageSource?)GetValue(SourceProperty); }
|
||||
set { SetValue(SourceProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty =
|
||||
DependencyProperty.Register(nameof(Source), typeof(ImageSource), typeof(ImageSwitcher), new PropertyMetadata(null, OnDependencyPropertyChanged));
|
||||
|
||||
public ImageSwitchType SwitchType
|
||||
{
|
||||
get { return (ImageSwitchType)GetValue(SwitchTypeProperty); }
|
||||
set { SetValue(SwitchTypeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SwitchTypeProperty =
|
||||
DependencyProperty.Register(nameof(SwitchType), typeof(ImageSwitchType), typeof(ImageSwitcher), new PropertyMetadata(ImageSwitchType.Crossfade));
|
||||
|
||||
public ImageSwitcher()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void UpdateSource()
|
||||
{
|
||||
switch (SwitchType)
|
||||
{
|
||||
case ImageSwitchType.Crossfade:
|
||||
UpdateSourceCrossfade();
|
||||
break;
|
||||
case ImageSwitchType.Slide:
|
||||
UpdateSourceSlide();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSourceCrossfade()
|
||||
{
|
||||
// Ϊ<><CEAA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD>þ<EFBFBD>Դ
|
||||
LastAlbumArtImage.Source = AlbumArtImage.Source;
|
||||
// ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
||||
LastAlbumArtImage.TranslationTransition = null;
|
||||
LastAlbumArtImage.OpacityTransition = null;
|
||||
LastAlbumArtImage.Translation = new();
|
||||
LastAlbumArtImage.Opacity = 1;
|
||||
LastAlbumArtImage.OpacityTransition = new ScalarTransition { Duration = Constants.Time.AnimationDuration };
|
||||
|
||||
// ʹǰ<CAB9><C7B0>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
||||
AlbumArtImage.TranslationTransition = null;
|
||||
AlbumArtImage.OpacityTransition = null;
|
||||
AlbumArtImage.Translation = new();
|
||||
AlbumArtImage.Opacity = 0;
|
||||
AlbumArtImage.OpacityTransition = new ScalarTransition { Duration = Constants.Time.AnimationDuration };
|
||||
// ֮<><D6AE>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
AlbumArtImage.Source = Source;
|
||||
|
||||
// <20><><EFBFBD>浭<EFBFBD><E6B5AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LastAlbumArtImage.Opacity = 0;
|
||||
AlbumArtImage.Opacity = 1;
|
||||
}
|
||||
|
||||
private void UpdateSourceSlide()
|
||||
{
|
||||
// Ϊ<><CEAA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD>þ<EFBFBD>Դ
|
||||
LastAlbumArtImage.Source = AlbumArtImage.Source;
|
||||
// ʹ<><CAB9><EFBFBD><EFBFBD>λ
|
||||
LastAlbumArtImage.TranslationTransition = null;
|
||||
LastAlbumArtImage.OpacityTransition = null;
|
||||
LastAlbumArtImage.Translation = new();
|
||||
LastAlbumArtImage.Opacity = 1;
|
||||
LastAlbumArtImage.TranslationTransition = new Vector3Transition { Duration = Constants.Time.AnimationDuration };
|
||||
LastAlbumArtImage.OpacityTransition = new ScalarTransition { Duration = Constants.Time.AnimationDuration };
|
||||
|
||||
// ʹǰ<CAB9><C7B0>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
||||
AlbumArtImage.TranslationTransition = null;
|
||||
AlbumArtImage.OpacityTransition = null;
|
||||
AlbumArtImage.Translation = new(-(float)ActualWidth, 0, 0);
|
||||
AlbumArtImage.Opacity = 0;
|
||||
AlbumArtImage.TranslationTransition = new Vector3Transition { Duration = Constants.Time.AnimationDuration };
|
||||
AlbumArtImage.OpacityTransition = new ScalarTransition { Duration = Constants.Time.AnimationDuration };
|
||||
// ֮<><D6AE>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
AlbumArtImage.Source = Source;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
LastAlbumArtImage.Opacity = 0;
|
||||
AlbumArtImage.Opacity = 1;
|
||||
LastAlbumArtImage.Translation = new(-(float)ActualWidth, 0, 0);
|
||||
AlbumArtImage.Translation = new();
|
||||
}
|
||||
|
||||
private static void OnDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ImageSwitcher imageSwitcher)
|
||||
{
|
||||
if (e.Property == SourceProperty)
|
||||
{
|
||||
imageSwitcher.UpdateSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
public static class InstantTip
|
||||
{
|
||||
public static readonly DependencyProperty ContentProperty =
|
||||
DependencyProperty.RegisterAttached("Content", typeof(object), typeof(InstantTip), new PropertyMetadata(null, OnContentChanged));
|
||||
|
||||
public static void SetContent(DependencyObject element, object value) => element.SetValue(ContentProperty, value);
|
||||
public static object GetContent(DependencyObject element) => element.GetValue(ContentProperty);
|
||||
|
||||
private static Dictionary<int, Popup> _activePopups = [];
|
||||
|
||||
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is FrameworkElement element)
|
||||
{
|
||||
element.PointerEntered -= Element_PointerEntered;
|
||||
element.PointerExited -= Element_PointerExited;
|
||||
element.Unloaded -= Element_Unloaded;
|
||||
|
||||
if (e.NewValue != null)
|
||||
{
|
||||
element.PointerEntered += Element_PointerEntered;
|
||||
element.PointerExited += Element_PointerExited;
|
||||
element.Unloaded += Element_Unloaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Element_PointerEntered(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (sender is FrameworkElement element)
|
||||
{
|
||||
int hashCode = element.GetHashCode();
|
||||
|
||||
if (_activePopups.ContainsKey(hashCode))
|
||||
{
|
||||
_activePopups.TryGetValue(hashCode, out var popup);
|
||||
if (popup != null)
|
||||
{
|
||||
popup.IsOpen = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var rawContent = GetContent(element);
|
||||
|
||||
if (rawContent == null) return;
|
||||
|
||||
// 创建可视卡片容器 (Visual Card)
|
||||
var visualCard = new Grid
|
||||
{
|
||||
Background = (Brush)Application.Current.Resources["AcrylicBackgroundFillColorDefaultBrush"],
|
||||
CornerRadius = new CornerRadius(4),
|
||||
Shadow = new ThemeShadow(),
|
||||
Translation = new Vector3(0, 0, 32),
|
||||
Padding = new Thickness(8, 4, 8, 4)
|
||||
};
|
||||
|
||||
var popupContent = new Grid
|
||||
{
|
||||
IsHitTestVisible = false,
|
||||
Opacity = 0,
|
||||
Padding = new Thickness(16)
|
||||
};
|
||||
popupContent.Children.Add(visualCard);
|
||||
|
||||
var popup = new Popup
|
||||
{
|
||||
Child = popupContent,
|
||||
IsHitTestVisible = false,
|
||||
ShouldConstrainToRootBounds = false,
|
||||
XamlRoot = element.XamlRoot,
|
||||
};
|
||||
|
||||
object finalContent = rawContent;
|
||||
|
||||
if (rawContent is ToolTip toolTipWrapper)
|
||||
{
|
||||
finalContent = toolTipWrapper.Content;
|
||||
}
|
||||
|
||||
if (finalContent is string text)
|
||||
{
|
||||
var textBlock = new TextBlock
|
||||
{
|
||||
Text = text,
|
||||
FontSize = 12,
|
||||
MaxWidth = 320,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Foreground = (Brush)Application.Current.Resources["TextFillColorPrimaryBrush"]
|
||||
};
|
||||
visualCard.Children.Add(textBlock);
|
||||
}
|
||||
else if (finalContent != null)
|
||||
{
|
||||
var textBlock = new TextBlock
|
||||
{
|
||||
Text = finalContent.ToString(),
|
||||
FontSize = 12,
|
||||
MaxWidth = 320,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
Foreground = (Brush)Application.Current.Resources["TextFillColorPrimaryBrush"]
|
||||
};
|
||||
visualCard.Children.Add(textBlock);
|
||||
}
|
||||
|
||||
var transform = element.TransformToVisual(null);
|
||||
var point = transform.TransformPoint(new Point(0, element.ActualHeight));
|
||||
|
||||
popup.VerticalOffset = point.Y;
|
||||
popup.HorizontalOffset = point.X - popupContent.Padding.Left;
|
||||
|
||||
popup.IsOpen = true;
|
||||
|
||||
App.Current.Resources.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, () =>
|
||||
{
|
||||
popupContent.OpacityTransition = new ScalarTransition();
|
||||
popupContent.Opacity = 1;
|
||||
});
|
||||
|
||||
_activePopups.Add(hashCode, popup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Element_PointerExited(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
var element = sender as FrameworkElement;
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
int hashCode = element.GetHashCode();
|
||||
|
||||
if (!_activePopups.ContainsKey(hashCode))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_activePopups.TryGetValue(hashCode, out var popup);
|
||||
if (popup != null)
|
||||
{
|
||||
if (popup.Child is Grid popupContent)
|
||||
{
|
||||
popupContent.Opacity = 0;
|
||||
}
|
||||
popup.IsOpen = false;
|
||||
_activePopups.Remove(hashCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Element_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is FrameworkElement element)
|
||||
{
|
||||
element.PointerEntered -= Element_PointerEntered;
|
||||
element.PointerExited -= Element_PointerExited;
|
||||
element.Unloaded -= Element_Unloaded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock x:Uid="SettingsPageBackgroundOverlay" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageTheme" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox x:Name="ThemeComboBox" SelectedIndex="{x:Bind LyricsBackgroundSettings.LyricsBackgroundTheme, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
@@ -47,51 +47,6 @@
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAlbumArtLayer"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageOpacity" IsEnabled="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="100"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsBackgroundSettings.CoverOverlayOpacity, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageSpeed" IsEnabled="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="50"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsBackgroundSettings.CoverOverlaySpeed, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageBlurAmount" IsEnabled="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="100"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{x:Bind LyricsBackgroundSettings.CoverOverlayBlurAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageBackgroundAcrylicEffectAmount" IsEnabled="{x:Bind LyricsBackgroundSettings.IsCoverOverlayEnabled, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="0"
|
||||
Maximum="10"
|
||||
Minimum="0"
|
||||
Value="{x:Bind LyricsBackgroundSettings.CoverAcrylicEffectAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageFluidLayer"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
@@ -162,6 +117,21 @@
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageSpectrumLayerStyle" IsEnabled="{x:Bind LyricsBackgroundSettings.IsSpectrumOverlayEnabled, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsBackgroundSettings.SpectrumStyle, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageSpectrumStyleCurve" />
|
||||
<ComboBoxItem x:Uid="SettingsPageSpectrumStyleBar" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageAmount" IsEnabled="{x:Bind LyricsBackgroundSettings.IsSpectrumOverlayEnabled, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="128"
|
||||
Maximum="1024"
|
||||
Minimum="1"
|
||||
Value="{x:Bind LyricsBackgroundSettings.SpectrumCount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Renderer.LyricsRenderer"
|
||||
x:Class="BetterLyrics.WinUI3.Controls.LyricsCanvas"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Renderer"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Unloaded="LyricsCanvas_Unloaded"
|
||||
Unloaded="Canvas_Unloaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<canvas:CanvasAnimatedControl
|
||||
x:Name="LyricsCanvas"
|
||||
CreateResources="LyricsCanvas_CreateResources"
|
||||
Draw="LyricsCanvas_Draw"
|
||||
Update="LyricsCanvas_Update" />
|
||||
x:Name="Canvas"
|
||||
CreateResources="Canvas_CreateResources"
|
||||
Draw="Canvas_Draw"
|
||||
Update="Canvas_Update" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,849 @@
|
||||
// 2025/6/23 by Zhe Fang
|
||||
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Logic;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using BetterLyrics.WinUI3.Renderer;
|
||||
using BetterLyrics.WinUI3.Services.LastFMService;
|
||||
using BetterLyrics.WinUI3.Services.LiveStatesService;
|
||||
using BetterLyrics.WinUI3.Services.MediaSessionsService;
|
||||
using BetterLyrics.WinUI3.Services.SettingsService;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
public sealed partial class LyricsCanvas : UserControl,
|
||||
IRecipient<PropertyChangedMessage<int>>,
|
||||
IRecipient<PropertyChangedMessage<AlbumArtThemeColors>>,
|
||||
IRecipient<PropertyChangedMessage<TimeSpan>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsData?>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsWindowStatus>>,
|
||||
IRecipient<PropertyChangedMessage<double>>,
|
||||
IRecipient<PropertyChangedMessage<bool>>,
|
||||
IRecipient<PropertyChangedMessage<TextAlignmentType>>,
|
||||
IRecipient<PropertyChangedMessage<SongInfo?>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsFontWeight>>,
|
||||
IRecipient<PropertyChangedMessage<string>>
|
||||
{
|
||||
private readonly ISettingsService _settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
|
||||
private readonly ILiveStatesService _liveStatesService = Ioc.Default.GetRequiredService<ILiveStatesService>();
|
||||
private readonly IMediaSessionsService _mediaSessionsService = Ioc.Default.GetRequiredService<IMediaSessionsService>();
|
||||
private readonly ILastFMService _lastFMService = Ioc.Default.GetRequiredService<ILastFMService>();
|
||||
|
||||
private readonly LyricsRenderer _lyricsRenderer = new();
|
||||
private readonly FluidBackgroundRenderer _fluidRenderer = new();
|
||||
private readonly PureColorBackgroundRenderer _pureColorRenderer = new();
|
||||
private readonly SnowRenderer _snowRenderer = new();
|
||||
private readonly FogRenderer _fogRenderer = new();
|
||||
private readonly SpectrumRenderer _spectrumRenderer = new();
|
||||
|
||||
private readonly LyricsSynchronizer _synchronizer = new();
|
||||
private readonly LyricsAnimator _animator = new();
|
||||
|
||||
private readonly SpectrumAnalyzer _spectrumAnalyzer = new();
|
||||
|
||||
private readonly ValueTransition<Color> _immersiveBgColorTransition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
private readonly ValueTransition<double> _immersiveBgOpacityTransition = new(
|
||||
initialValue: 1f,
|
||||
durationSeconds: 0.3f
|
||||
);
|
||||
private readonly ValueTransition<Color> _accentColor1Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
private readonly ValueTransition<Color> _accentColor2Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
private readonly ValueTransition<Color> _accentColor3Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
private readonly ValueTransition<Color> _accentColor4Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
private readonly ValueTransition<double> _canvasYScrollTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
private readonly ValueTransition<double> _mouseYScrollTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
|
||||
private TimeSpan _songPosition; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
private TimeSpan _totalPlayedTime; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>ŵ<EFBFBD>ʱ<EFBFBD>䣩
|
||||
private bool _isLastFMTracked = false;
|
||||
|
||||
private double _renderLyricsStartX = 0;
|
||||
private double _renderLyricsStartY = 0;
|
||||
private double _renderLyricsWidth = 0;
|
||||
private double _renderLyricsHeight = 0;
|
||||
private double _renderLyricsOpacity = 0;
|
||||
|
||||
private Point _mousePosition = new(0, 0);
|
||||
private int _mouseHoverLineIndex = -1;
|
||||
private bool _isMouseInLyricsArea = false;
|
||||
private bool _isMousePressing = false;
|
||||
private bool _isMouseScrolling = false;
|
||||
|
||||
private LyricsData? _lyricsData;
|
||||
|
||||
private bool _isLayoutChanged = true;
|
||||
private bool _isMouseScrollingChanged = false;
|
||||
|
||||
private int _playingLineIndex;
|
||||
private (int Start, int End) _visibleRange;
|
||||
private double _canvasTargetScrollOffset;
|
||||
|
||||
public TimeSpan SongPosition => _songPosition;
|
||||
public double CurrentCanvasYScroll => _canvasYScrollTransition.Value;
|
||||
public double ActualLyricsHeight => LyricsLayoutManager.CalculateActualHeight(_lyricsData?.LyricsLines);
|
||||
public int CurrentHoveringLineIndex => _mouseHoverLineIndex;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC> X <20><><EFBFBD><EFBFBD>
|
||||
public double LyricsStartX
|
||||
{
|
||||
get { return (double)GetValue(LyricsStartXProperty); }
|
||||
set { SetValue(LyricsStartXProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LyricsStartXProperty =
|
||||
DependencyProperty.Register(nameof(LyricsStartX), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ Y <20><><EFBFBD><EFBFBD>
|
||||
public double LyricsStartY
|
||||
{
|
||||
get { return (double)GetValue(LyricsStartYProperty); }
|
||||
set { SetValue(LyricsStartYProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LyricsStartYProperty =
|
||||
DependencyProperty.Register(nameof(LyricsStartY), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
public double LyricsWidth
|
||||
{
|
||||
get { return (double)GetValue(LyricsWidthProperty); }
|
||||
set { SetValue(LyricsWidthProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LyricsWidthProperty =
|
||||
DependencyProperty.Register(nameof(LyricsWidth), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
||||
public double LyricsHeight
|
||||
{
|
||||
get { return (double)GetValue(LyricsHeightProperty); }
|
||||
set { SetValue(LyricsHeightProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LyricsHeightProperty =
|
||||
DependencyProperty.Register(nameof(LyricsHeight), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
||||
public double LyricsOpacity
|
||||
{
|
||||
get { return (double)GetValue(LyricsOpacityProperty); }
|
||||
set { SetValue(LyricsOpacityProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LyricsOpacityProperty =
|
||||
DependencyProperty.Register(nameof(LyricsOpacity), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
/// <summary>
|
||||
/// <20>û<EFBFBD><C3BB>ٿ<EFBFBD><D9BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>루<EFBFBD><EBA3A8> 0 <20><>ʼ<EFBFBD>㣩
|
||||
/// </summary>
|
||||
public double MouseScrollOffset
|
||||
{
|
||||
get { return (double)GetValue(MouseScrollOffsetProperty); }
|
||||
set { SetValue(MouseScrollOffsetProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MouseScrollOffsetProperty =
|
||||
DependencyProperty.Register(nameof(MouseScrollOffset), typeof(double), typeof(LyricsCanvas), new PropertyMetadata(0.0, OnLayoutPropChanged));
|
||||
|
||||
/// <summary>
|
||||
/// <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD>굱ǰ<EAB5B1><C7B0>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻǣ<CFBD>
|
||||
/// </summary>
|
||||
public Point MousePosition
|
||||
{
|
||||
get { return (Point)GetValue(MousePositionProperty); }
|
||||
set { SetValue(MousePositionProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MousePositionProperty =
|
||||
DependencyProperty.Register(nameof(MousePosition), typeof(Point), typeof(LyricsCanvas), new PropertyMetadata(new Point(0, 0), OnLayoutPropChanged));
|
||||
|
||||
public bool IsMouseInLyricsArea
|
||||
{
|
||||
get { return (bool)GetValue(IsMouseInLyricsAreaProperty); }
|
||||
set { SetValue(IsMouseInLyricsAreaProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsMouseInLyricsAreaProperty =
|
||||
DependencyProperty.Register(nameof(IsMouseInLyricsArea), typeof(bool), typeof(LyricsCanvas), new PropertyMetadata(false, OnLayoutPropChanged));
|
||||
|
||||
public bool IsMousePressing
|
||||
{
|
||||
get { return (bool)GetValue(IsMousePressingProperty); }
|
||||
set { SetValue(IsMousePressingProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsMousePressingProperty =
|
||||
DependencyProperty.Register(nameof(IsMousePressing), typeof(bool), typeof(LyricsCanvas), new PropertyMetadata(false, OnLayoutPropChanged));
|
||||
|
||||
public bool IsMouseScrolling
|
||||
{
|
||||
get { return (bool)GetValue(IsMouseScrollingProperty); }
|
||||
set { SetValue(IsMouseScrollingProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsMouseScrollingProperty =
|
||||
DependencyProperty.Register(nameof(IsMouseScrolling), typeof(bool), typeof(LyricsCanvas), new PropertyMetadata(false, OnLayoutPropChanged));
|
||||
|
||||
public LyricsCanvas()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<int>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<AlbumArtThemeColors>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<TimeSpan>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<LyricsData?>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<LyricsWindowStatus>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<double>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<bool>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<TextAlignmentType>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<SongInfo?>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<LyricsFontWeight>>(this);
|
||||
WeakReferenceMessenger.Default.Register<PropertyChangedMessage<string>>(this);
|
||||
}
|
||||
|
||||
private static void OnLayoutPropChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is LyricsCanvas canvas)
|
||||
{
|
||||
if (e.Property == LyricsStartXProperty)
|
||||
{
|
||||
canvas._renderLyricsStartX = Convert.ToDouble(e.NewValue);
|
||||
canvas._isLayoutChanged = true;
|
||||
}
|
||||
else if (e.Property == LyricsStartYProperty)
|
||||
{
|
||||
canvas._renderLyricsStartY = Convert.ToDouble(e.NewValue);
|
||||
canvas._isLayoutChanged = true;
|
||||
}
|
||||
else if (e.Property == LyricsWidthProperty)
|
||||
{
|
||||
canvas._renderLyricsWidth = Convert.ToDouble(e.NewValue);
|
||||
canvas._isLayoutChanged = true;
|
||||
}
|
||||
else if (e.Property == LyricsHeightProperty)
|
||||
{
|
||||
canvas._renderLyricsHeight = Convert.ToDouble(e.NewValue);
|
||||
canvas._isLayoutChanged = true;
|
||||
}
|
||||
else if (e.Property == LyricsOpacityProperty)
|
||||
{
|
||||
canvas._renderLyricsOpacity = Convert.ToDouble(e.NewValue);
|
||||
canvas._isLayoutChanged = true;
|
||||
}
|
||||
else if (e.Property == MouseScrollOffsetProperty)
|
||||
{
|
||||
canvas._mouseYScrollTransition.StartTransition(Convert.ToDouble(e.NewValue));
|
||||
}
|
||||
else if (e.Property == MousePositionProperty)
|
||||
{
|
||||
canvas._mousePosition = (Point)e.NewValue;
|
||||
}
|
||||
else if (e.Property == IsMouseInLyricsAreaProperty)
|
||||
{
|
||||
canvas._isMouseInLyricsArea = (bool)e.NewValue;
|
||||
}
|
||||
else if (e.Property == IsMousePressingProperty)
|
||||
{
|
||||
canvas._isMousePressing = (bool)e.NewValue;
|
||||
}
|
||||
else if (e.Property == IsMouseScrollingProperty)
|
||||
{
|
||||
var value = (bool)e.NewValue;
|
||||
if (canvas._isMouseScrolling != value)
|
||||
{
|
||||
canvas._isMouseScrollingChanged = true;
|
||||
}
|
||||
canvas._isMouseScrolling = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
|
||||
private void Canvas_Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
|
||||
{
|
||||
var bounds = new Rect(0, 0, sender.Size.Width, sender.Size.Height);
|
||||
|
||||
var status = _liveStatesService.LiveStates.LyricsWindowStatus;
|
||||
var albumArtLayout = status.AlbumArtLayoutSettings;
|
||||
var lyricsBg = status.LyricsBackgroundSettings;
|
||||
var lyricsStyle = status.LyricsStyleSettings;
|
||||
var lyricsEffect = status.LyricsEffectSettings;
|
||||
|
||||
double songDuration = _mediaSessionsService.CurrentSongInfo?.DurationMs ?? 0;
|
||||
bool isForceWordByWord = _settingsService.AppSettings.GeneralSettings.IsForceWordByWordEffect;
|
||||
|
||||
double fixedSongPositionMs = _songPosition.TotalMilliseconds + (_mediaSessionsService.CurrentMediaSourceProviderInfo?.PositionOffset ?? 0);
|
||||
|
||||
var lyricsThemeColors = _mediaSessionsService.AlbumArtThemeColors;
|
||||
|
||||
Color overlayColor;
|
||||
double finalOpacity;
|
||||
|
||||
if (status.IsAdaptToEnvironment)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>Ӧɫ
|
||||
overlayColor = _immersiveBgColorTransition.Value;
|
||||
finalOpacity = _immersiveBgOpacityTransition.Value * lyricsBg.PureColorOverlayOpacity / 100.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ר<><D7A8>ɫ
|
||||
overlayColor = _accentColor1Transition.Value;
|
||||
finalOpacity = lyricsBg.PureColorOverlayOpacity / 100.0;
|
||||
}
|
||||
|
||||
_pureColorRenderer.Draw(
|
||||
args.DrawingSession,
|
||||
bounds,
|
||||
overlayColor,
|
||||
finalOpacity,
|
||||
lyricsBg.IsPureColorOverlayEnabled
|
||||
);
|
||||
|
||||
_fluidRenderer.Opacity = lyricsBg.FluidOverlayOpacity;
|
||||
_fluidRenderer.IsEnabled = lyricsBg.IsFluidOverlayEnabled;
|
||||
_fluidRenderer.Draw(sender, args.DrawingSession);
|
||||
|
||||
_snowRenderer.Draw(sender, args.DrawingSession);
|
||||
|
||||
_fogRenderer.Draw(sender, args.DrawingSession);
|
||||
|
||||
_lyricsRenderer.Draw(
|
||||
control: sender,
|
||||
ds: args.DrawingSession,
|
||||
lyricsData: _lyricsData,
|
||||
playingLineIndex: _playingLineIndex,
|
||||
mouseHoverLineIndex: _mouseHoverLineIndex,
|
||||
isMousePressing: _isMousePressing,
|
||||
startVisibleIndex: _visibleRange.Start,
|
||||
endVisibleIndex: _visibleRange.End,
|
||||
lyricsX: _renderLyricsStartX,
|
||||
lyricsY: _renderLyricsStartY,
|
||||
lyricsWidth: _renderLyricsWidth,
|
||||
lyricsHeight: _renderLyricsHeight,
|
||||
userScrollOffset: _mouseYScrollTransition.Value,
|
||||
lyricsOpacity: _renderLyricsOpacity,
|
||||
playingLineTopOffsetFactor: lyricsStyle.PlayingLineTopOffset / 100.0,
|
||||
windowStatus: status,
|
||||
strokeColor: lyricsThemeColors.StrokeFontColor,
|
||||
bgColor: lyricsThemeColors.BgFontColor,
|
||||
fgColor: lyricsThemeColors.FgFontColor,
|
||||
getPlaybackState: (lineIndex) =>
|
||||
{
|
||||
if (_lyricsData == null) return new LinePlaybackState();
|
||||
|
||||
var line = _lyricsData.LyricsLines.ElementAtOrDefault(lineIndex);
|
||||
if (line == null) return new LinePlaybackState();
|
||||
|
||||
var nextLine = _lyricsData.LyricsLines.ElementAtOrDefault(lineIndex + 1);
|
||||
|
||||
return _synchronizer.GetLinePlayingProgress(
|
||||
fixedSongPositionMs,
|
||||
line,
|
||||
nextLine,
|
||||
songDuration,
|
||||
isForceWordByWord
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (_spectrumAnalyzer.IsCapturing)
|
||||
{
|
||||
_spectrumRenderer.Draw(
|
||||
resourceCreator: sender,
|
||||
ds: args.DrawingSession,
|
||||
spectrumData: _spectrumAnalyzer?.SmoothSpectrum,
|
||||
barCount: _spectrumAnalyzer?.BarCount ?? 1,
|
||||
isEnabled: lyricsBg.IsSpectrumOverlayEnabled,
|
||||
placement: lyricsBg.SpectrumPlacement,
|
||||
style: lyricsBg.SpectrumStyle,
|
||||
canvasWidth: sender.Size.Width,
|
||||
canvasHeight: sender.Size.Height,
|
||||
fillColor: lyricsThemeColors.BgFontColor
|
||||
);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
args.DrawingSession.DrawText(
|
||||
$"Lyrics render start pos: ({(int)_renderLyricsStartX}, {(int)_renderLyricsStartY})\n" +
|
||||
$"Lyrics render size: [{(int)_renderLyricsWidth} x {(int)_renderLyricsHeight}]\n" +
|
||||
$"Lyrics actual height: {LyricsLayoutManager.CalculateActualHeight(_lyricsData?.LyricsLines)}\n" +
|
||||
$"Playing line (idx): {_playingLineIndex}\n" +
|
||||
$"Mouse hovering line (idx): {_mouseHoverLineIndex}\n" +
|
||||
$"Visible lines range (idx): [{_visibleRange.Start}, {_visibleRange.End}]\n" +
|
||||
$"Total line count: {LyricsLayoutManager.CalculateMaxRange(_lyricsData?.LyricsLines).End + 1}\n" +
|
||||
$"Played: {TimeSpan.FromMilliseconds(fixedSongPositionMs)} / {TimeSpan.FromMilliseconds(_mediaSessionsService.CurrentSongInfo?.DurationMs ?? 0)}\n" +
|
||||
$"Y offset: {_canvasYScrollTransition.Value}\n" +
|
||||
$"User scroll offset: {_mouseYScrollTransition.Value}",
|
||||
new Vector2(0, 0), Colors.Red);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
private void Canvas_Update(ICanvasAnimatedControl sender, CanvasAnimatedUpdateEventArgs args)
|
||||
{
|
||||
var lyricsBg = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings;
|
||||
var lyricsStyle = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings;
|
||||
var lyricsEffect = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings;
|
||||
var albumArtThemeColors = _mediaSessionsService.AlbumArtThemeColors;
|
||||
|
||||
TimeSpan elapsedTime = args.Timing.ElapsedTime;
|
||||
|
||||
_accentColor1Transition.Update(elapsedTime);
|
||||
_accentColor2Transition.Update(elapsedTime);
|
||||
_accentColor3Transition.Update(elapsedTime);
|
||||
_accentColor4Transition.Update(elapsedTime);
|
||||
|
||||
_immersiveBgOpacityTransition.Update(elapsedTime);
|
||||
_immersiveBgColorTransition.Update(elapsedTime);
|
||||
|
||||
UpdatePlaybackState(elapsedTime);
|
||||
|
||||
TriggerRelayout();
|
||||
|
||||
#region UpdatePlayingLineIndex
|
||||
|
||||
int newPlayingIndex = _synchronizer.GetCurrentLineIndex(_songPosition.TotalMilliseconds, _lyricsData);
|
||||
bool isPlayingLineChanged = newPlayingIndex != _playingLineIndex;
|
||||
_playingLineIndex = newPlayingIndex;
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateTargetScrollOffset
|
||||
|
||||
if (isPlayingLineChanged || _isLayoutChanged)
|
||||
{
|
||||
var targetScroll = LyricsLayoutManager.CalculateTargetScrollOffset(_lyricsData, _playingLineIndex);
|
||||
if (targetScroll.HasValue) _canvasTargetScrollOffset = targetScroll.Value;
|
||||
|
||||
_canvasYScrollTransition.SetEasingType(lyricsEffect.LyricsScrollEasingType);
|
||||
_canvasYScrollTransition.SetDuration(lyricsEffect.LyricsScrollDuration / 1000.0);
|
||||
_canvasYScrollTransition.StartTransition(_canvasTargetScrollOffset, _isLayoutChanged);
|
||||
}
|
||||
_canvasYScrollTransition.Update(elapsedTime);
|
||||
|
||||
#endregion
|
||||
|
||||
_mouseYScrollTransition.Update(elapsedTime);
|
||||
|
||||
_mouseHoverLineIndex = LyricsLayoutManager.FindMouseHoverLineIndex(
|
||||
_lyricsData?.LyricsLines,
|
||||
_isMouseInLyricsArea,
|
||||
_mousePosition,
|
||||
_canvasYScrollTransition.Value + _mouseYScrollTransition.Value,
|
||||
_renderLyricsStartY,
|
||||
_renderLyricsHeight,
|
||||
lyricsStyle.PlayingLineTopOffset / 100.0
|
||||
);
|
||||
|
||||
_visibleRange = LyricsLayoutManager.CalculateVisibleRange(
|
||||
_lyricsData?.LyricsLines,
|
||||
_canvasYScrollTransition.Value + _mouseYScrollTransition.Value, // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
_renderLyricsStartY,
|
||||
_renderLyricsHeight,
|
||||
sender.Size.Height,
|
||||
lyricsStyle.PlayingLineTopOffset / 100.0
|
||||
);
|
||||
|
||||
var maxRange = LyricsLayoutManager.CalculateMaxRange(_lyricsData?.LyricsLines);
|
||||
|
||||
_animator.UpdateLines(
|
||||
_lyricsData,
|
||||
_isMouseScrolling ? maxRange.Start : _visibleRange.Start,
|
||||
_isMouseScrolling ? maxRange.End : _visibleRange.End,
|
||||
_playingLineIndex,
|
||||
sender.Size.Height,
|
||||
_canvasTargetScrollOffset,
|
||||
lyricsStyle.PlayingLineTopOffset / 100.0,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings,
|
||||
_canvasYScrollTransition,
|
||||
albumArtThemeColors.BgFontColor,
|
||||
albumArtThemeColors.FgFontColor,
|
||||
elapsedTime,
|
||||
_isMouseScrolling,
|
||||
_isLayoutChanged,
|
||||
isPlayingLineChanged,
|
||||
_isMouseScrollingChanged
|
||||
);
|
||||
|
||||
_isMouseScrollingChanged = false;
|
||||
|
||||
_lyricsRenderer.CalculateLyrics3DMatrix(
|
||||
lyricsEffect: lyricsEffect,
|
||||
lyricsX: _renderLyricsStartX,
|
||||
lyricsY: _renderLyricsStartY,
|
||||
lyricsWidth: _renderLyricsWidth,
|
||||
canvasHeight: sender.Size.Height
|
||||
);
|
||||
|
||||
_isLayoutChanged = false;
|
||||
|
||||
if (_fluidRenderer.IsEnabled)
|
||||
{
|
||||
_fluidRenderer.UpdateColors(
|
||||
_accentColor1Transition.Value,
|
||||
_accentColor2Transition.Value,
|
||||
_accentColor3Transition.Value,
|
||||
_accentColor4Transition.Value
|
||||
);
|
||||
_fluidRenderer.Update(elapsedTime);
|
||||
}
|
||||
|
||||
_snowRenderer.IsEnabled = lyricsBg.IsSnowFlakeOverlayEnabled;
|
||||
_snowRenderer.Amount = lyricsBg.SnowFlakeOverlayAmount / 100f;
|
||||
_snowRenderer.Speed = lyricsBg.SnowFlakeOverlaySpeed;
|
||||
_snowRenderer.Update(elapsedTime.TotalSeconds);
|
||||
|
||||
_fogRenderer.IsEnabled = lyricsBg.IsFogOverlayEnabled;
|
||||
_fogRenderer.Update(elapsedTime.TotalSeconds);
|
||||
|
||||
if (lyricsBg.IsSpectrumOverlayEnabled && !_spectrumAnalyzer.IsCapturing)
|
||||
{
|
||||
_spectrumAnalyzer.BarCount = lyricsBg.SpectrumCount;
|
||||
_spectrumAnalyzer.StartCapture();
|
||||
}
|
||||
else if (!lyricsBg.IsSpectrumOverlayEnabled && _spectrumAnalyzer.IsCapturing)
|
||||
{
|
||||
_spectrumAnalyzer.StopCapture();
|
||||
}
|
||||
if (_spectrumAnalyzer.IsCapturing)
|
||||
{
|
||||
_spectrumAnalyzer.UpdateSmoothSpectrum();
|
||||
}
|
||||
}
|
||||
|
||||
private void Canvas_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Canvas.RemoveFromVisualTree();
|
||||
Canvas = null;
|
||||
|
||||
_fluidRenderer.Dispose();
|
||||
_snowRenderer.Dispose();
|
||||
_fogRenderer.Dispose();
|
||||
_spectrumRenderer.Dispose();
|
||||
DisposeAnalyzer();
|
||||
}
|
||||
|
||||
private async void Canvas_CreateResources(CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
|
||||
{
|
||||
args.TrackAsyncAction(_fluidRenderer.LoadResourcesAsync().AsAsyncAction());
|
||||
_snowRenderer.LoadResources();
|
||||
_fogRenderer.LoadResources();
|
||||
|
||||
_isLayoutChanged = true;
|
||||
TriggerRelayout();
|
||||
}
|
||||
|
||||
// ====
|
||||
|
||||
private void DisposeAnalyzer()
|
||||
{
|
||||
if (_spectrumAnalyzer.IsCapturing)
|
||||
{
|
||||
_spectrumAnalyzer.StopCapture();
|
||||
}
|
||||
_spectrumAnalyzer.Dispose();
|
||||
}
|
||||
|
||||
private void TriggerRelayout()
|
||||
{
|
||||
if (_lyricsData == null || !_isLayoutChanged) return;
|
||||
|
||||
LyricsLayoutManager.MeasureAndArrange(
|
||||
resourceCreator: Canvas,
|
||||
lyricsData: _lyricsData,
|
||||
status: _liveStatesService.LiveStates.LyricsWindowStatus,
|
||||
appSettings: _settingsService.AppSettings,
|
||||
canvasWidth: Canvas.Size.Width,
|
||||
canvasHeight: Canvas.Size.Height,
|
||||
lyricsWidth: _renderLyricsWidth,
|
||||
lyricsHeight: _renderLyricsHeight
|
||||
);
|
||||
}
|
||||
|
||||
private void UpdatePlaybackState(TimeSpan elapsedTime)
|
||||
{
|
||||
if (_mediaSessionsService.CurrentIsPlaying)
|
||||
{
|
||||
_songPosition += elapsedTime;
|
||||
_totalPlayedTime += elapsedTime;
|
||||
CheckAndScrobbleLastFM();
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckAndScrobbleLastFM()
|
||||
{
|
||||
bool isEnabled = _mediaSessionsService.CurrentMediaSourceProviderInfo?.IsLastFMTrackEnabled ?? false;
|
||||
if (!isEnabled || _isLastFMTracked) return;
|
||||
|
||||
var songInfo = _mediaSessionsService.CurrentSongInfo;
|
||||
if (songInfo == null || songInfo.Duration <= 0) return;
|
||||
|
||||
if (_totalPlayedTime.TotalSeconds >= songInfo.Duration * 0.5)
|
||||
{
|
||||
_isLastFMTracked = true;
|
||||
_lastFMService.TrackAsync(songInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetPlaybackState()
|
||||
{
|
||||
_totalPlayedTime = TimeSpan.Zero;
|
||||
_totalPlayedTime = TimeSpan.Zero;
|
||||
_isLastFMTracked = false;
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<AlbumArtThemeColors> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.AlbumArtThemeColors))
|
||||
{
|
||||
var lyricsThemeColors = message.NewValue;
|
||||
_immersiveBgColorTransition.StartTransition(lyricsThemeColors.EnvColor);
|
||||
_accentColor1Transition.StartTransition(lyricsThemeColors.AccentColor1);
|
||||
_accentColor2Transition.StartTransition(lyricsThemeColors.AccentColor2);
|
||||
_accentColor3Transition.StartTransition(lyricsThemeColors.AccentColor3);
|
||||
_accentColor4Transition.StartTransition(lyricsThemeColors.AccentColor4);
|
||||
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<TimeSpan> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.CurrentPosition))
|
||||
{
|
||||
var realPosition = message.NewValue;
|
||||
|
||||
var diff = Math.Abs(_songPosition.TotalMilliseconds - realPosition.TotalMilliseconds);
|
||||
var timelineSyncThreshold = _mediaSessionsService.CurrentMediaSourceProviderInfo?.TimelineSyncThreshold ?? 0;
|
||||
|
||||
// ƫ<><C6AB> or seek
|
||||
if (diff >= timelineSyncThreshold)
|
||||
{
|
||||
_songPosition = realPosition;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LastFM ͳ<><CDB3>״̬
|
||||
if (_songPosition.TotalSeconds <= 1)
|
||||
{
|
||||
_totalPlayedTime = TimeSpan.Zero;
|
||||
_isLastFMTracked = false;
|
||||
}
|
||||
}
|
||||
|
||||
// <20>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (diff >= timelineSyncThreshold + 5000)
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsData?> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.CurrentLyricsData))
|
||||
{
|
||||
_lyricsData = message.NewValue;
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsWindowStatus> message)
|
||||
{
|
||||
if (message.Sender is LiveStates)
|
||||
{
|
||||
if (message.PropertyName == nameof(LiveStates.LyricsWindowStatus))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<int> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.PhoneticLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.OriginalLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.TranslatedLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFontStrokeWidth))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.PlayingLineTopOffset))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollTopDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollBottomDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollTopDelay))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollBottomDelay))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.FanLyricsAngle))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<double> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsLineSpacingFactor))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<bool> message)
|
||||
{
|
||||
if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.IsFanLyricsEnabled))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.IsLyricsBlurEffectEnabled))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.IsDynamicLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<TextAlignmentType> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsAlignmentType))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<SongInfo?> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.CurrentSongInfo))
|
||||
{
|
||||
ResetPlaybackState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsFontWeight> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFontWeight))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<string> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCJKFontFamily))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsWesternFontFamily))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,147 +18,30 @@
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<!-- Effect -->
|
||||
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageLyricsEffect"
|
||||
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="Effect" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsVerticalEdgeOpacity" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
x:Uid="SettingsPageLyricsVerticalEdgeOpacitySlider"
|
||||
Default="0"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsEffectSettings.LyricsVerticalEdgeOpacity, Mode=TwoWay}" />
|
||||
<!-- 模糊效果 -->
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsBlurEffect" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsBlurEffectEnabled, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsBlurAmount" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
x:Uid="SettingsPageLyricsBlurAmountExtendedSlider"
|
||||
Default="5"
|
||||
Maximum="10"
|
||||
Minimum="0"
|
||||
Value="{x:Bind LyricsEffectSettings.LyricsBlurAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsLineFade" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsLineFadeEnabled, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<!-- 高亮 -->
|
||||
<dev:SettingsExpander x:Uid="SettingsPageLyricsHighlight" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<dev:SettingsExpander.Items>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPagePhoneticText">
|
||||
<local:ExtendedSlider
|
||||
Default="60"
|
||||
Frequency="5"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsEffectSettings.PhoneticLyricsHighlightAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsHighlightScope">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsEffectSettings.OriginalLyricsHighlightScope, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeLineStartToCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentLine" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageOriginalText">
|
||||
<local:ExtendedSlider
|
||||
Default="60"
|
||||
Frequency="5"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsEffectSettings.OriginalLyricsHighlightAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageTranslatedText">
|
||||
<local:ExtendedSlider
|
||||
Default="60"
|
||||
Frequency="5"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsEffectSettings.TranslatedLyricsHighlightAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<!-- 阴影 -->
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageLyricsShadow"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind LyricsEffectSettings.IsLyricsShadowEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsShadowEnabled, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageScope" IsEnabled="{x:Bind LyricsEffectSettings.IsLyricsShadowEnabled, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsEffectSettings.LyricsShadowScope, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeLineStartToCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentLine" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageAmount" IsEnabled="{x:Bind LyricsEffectSettings.IsLyricsShadowEnabled, Mode=OneWay}">
|
||||
<local:ExtendedSlider
|
||||
Default="8"
|
||||
Maximum="20"
|
||||
Minimum="1"
|
||||
Value="{x:Bind LyricsEffectSettings.LyricsShadowAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<!-- 辉光效果 -->
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageLyricsGlowEffect"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind LyricsEffectSettings.IsLyricsGlowEffectEnabled, Mode=OneWay}">
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsGlowEffect" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsGlowEffectEnabled, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageScope" IsEnabled="{x:Bind LyricsEffectSettings.IsLyricsGlowEffectEnabled, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsEffectSettings.LyricsGlowEffectScope, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeLineStartToCurrentChar" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRendingScopeCurrentLine" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageAmount" IsEnabled="{x:Bind LyricsEffectSettings.IsLyricsGlowEffectEnabled, Mode=OneWay}">
|
||||
<local:ExtendedSlider
|
||||
Default="8"
|
||||
Maximum="20"
|
||||
Minimum="1"
|
||||
Value="{x:Bind LyricsEffectSettings.LyricsGlowEffectAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<!-- 缩放效果 -->
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsScaleEffect" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsScaleEffectEnabled, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<!-- 浮动动画 -->
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageLyricsFloatAnimation"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsFloatAnimation" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsEffectSettings.IsLyricsFloatAnimationEnabled, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageAmount" IsEnabled="{x:Bind LyricsEffectSettings.IsLyricsGlowEffectEnabled, Mode=OneWay}">
|
||||
<local:ExtendedSlider
|
||||
Default="1"
|
||||
Maximum="4"
|
||||
Minimum="1"
|
||||
Value="{x:Bind LyricsEffectSettings.LyricsFloatAmount, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<!-- 扇形歌词 -->
|
||||
<dev:SettingsExpander
|
||||
|
||||
@@ -323,31 +323,29 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<RelativePanel>
|
||||
<TextBlock
|
||||
x:Uid="LyricsSearchControlHelp"
|
||||
Margin="0,0,24,0"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
RelativePanel.AlignVerticalCenterWithPanel="True"
|
||||
RelativePanel.LeftOf="Reset"
|
||||
TextWrapping="Wrap" />
|
||||
<Button
|
||||
x:Name="Reset"
|
||||
x:Uid="LyricsSearchControlReset"
|
||||
Margin="0,0,6,0"
|
||||
Command="{x:Bind ViewModel.ResetCommand}"
|
||||
RelativePanel.AlignVerticalCenterWithPanel="True"
|
||||
RelativePanel.LeftOf="SaveChanges" />
|
||||
<Button
|
||||
x:Name="SaveChanges"
|
||||
x:Uid="LyricsSearchControlSaveChanges"
|
||||
Command="{x:Bind ViewModel.SaveCommand}"
|
||||
RelativePanel.AlignRightWithPanel="True"
|
||||
RelativePanel.AlignVerticalCenterWithPanel="True"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
</RelativePanel>
|
||||
<Grid Grid.Row="1" ColumnSpacing="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="LyricsSearchControlHelp"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
<Button
|
||||
x:Uid="LyricsSearchControlReset"
|
||||
Grid.Column="2"
|
||||
Command="{x:Bind ViewModel.ResetCommand}" />
|
||||
<Button
|
||||
x:Uid="LyricsSearchControlSaveChanges"
|
||||
Grid.Column="3"
|
||||
Command="{x:Bind ViewModel.SaveCommand}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.ViewModels;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Documents;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
@@ -23,12 +23,32 @@
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsAlignment" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsStyleSettings.LyricsAlignmentType, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsLeft" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsCenter" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLyricsRight" />
|
||||
<ComboBoxItem x:Uid="SettingsPageLeft" />
|
||||
<ComboBoxItem x:Uid="SettingsPageCenter" />
|
||||
<ComboBoxItem x:Uid="SettingsPageRight" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsCenterTopOffset" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
Default="50"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsStyleSettings.PlayingLineTopOffset, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsLineSpacingFactor" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
x:Uid="SettingsPageLyricsLineSpacingFactorSlider"
|
||||
Default="0.5"
|
||||
Frequency="0.1"
|
||||
Maximum="2"
|
||||
Minimum="0"
|
||||
Unit="x"
|
||||
Value="{x:Bind LyricsStyleSettings.LyricsLineSpacingFactor, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsExpander x:Uid="SettingsPageLyricsFontFamily" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageCJK">
|
||||
@@ -56,15 +76,6 @@
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsBgFontOpacity" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
Default="30"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Unit="%"
|
||||
Value="{x:Bind LyricsStyleSettings.LyricsBgFontOpacity, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsFontStrokeWidth" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
Default="0"
|
||||
@@ -216,24 +227,6 @@
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsLineSpacingFactor" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<local:ExtendedSlider
|
||||
x:Uid="SettingsPageLyricsLineSpacingFactorSlider"
|
||||
Default="0.5"
|
||||
Frequency="0.1"
|
||||
Maximum="2"
|
||||
Minimum="0"
|
||||
Unit="x"
|
||||
Value="{x:Bind LyricsStyleSettings.LyricsLineSpacingFactor, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageLyricsTranslationSeparator" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<TextBox AcceptsReturn="True" Text="{x:Bind LyricsStyleSettings.LyricsTranslationSeparator, Mode=TwoWay}" />
|
||||
<Button Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, FontSize=12, Glyph=}" Style="{StaticResource GhostButtonStyle}" />
|
||||
</StackPanel>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -13,21 +13,32 @@
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid ColumnSpacing="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid>
|
||||
|
||||
<Grid x:Name="DisplayGrid" SizeChanged="DisplayGrid_SizeChanged">
|
||||
<ScrollViewer Style="{StaticResource SettingsScrollViewerStyle}">
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageRecordedWindowStatus"
|
||||
RelativePanel.AlignLeftWithPanel="True"
|
||||
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageRecordedWindowStatus"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Margin="0,30,0,0"
|
||||
Command="{x:Bind ViewModel.OpenConfigPanelCommand}"
|
||||
Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock x:Uid="LyricsWindowSettingsControlCurrentLyricsWindowConfig" />
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="3">
|
||||
|
||||
@@ -114,16 +125,44 @@
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
|
||||
<Grid
|
||||
x:Name="ConfigGrid"
|
||||
Background="{ThemeResource AcrylicBackgroundFillColorDefaultBrush}"
|
||||
Opacity="{x:Bind ViewModel.IsConfigPanelOpened, Mode=OneWay, Converter={StaticResource BoolToOpacityConverter}}"
|
||||
Translation="{x:Bind ViewModel.ConfigPanelTranslation, Mode=OneWay}">
|
||||
<Grid.OpacityTransition>
|
||||
<ScalarTransition />
|
||||
</Grid.OpacityTransition>
|
||||
<Grid.TranslationTransition>
|
||||
<Vector3Transition />
|
||||
</Grid.TranslationTransition>
|
||||
|
||||
<Grid Padding="36,0" Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock x:Uid="LyricsWindowSettingsControlCurrentLyricsWindowConfig" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="LyricsWindowSettingsControlCurrentLyricsWindowConfig"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Margin="0,30,0,0"
|
||||
Command="{x:Bind ViewModel.CloseConfigPanelCommand}"
|
||||
Content="{ui:FontIcon FontSize=16,
|
||||
FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
</Grid>
|
||||
|
||||
<Pivot SelectionChanged="Pivot_SelectionChanged">
|
||||
|
||||
<PivotItem Tag="General">
|
||||
<PivotItem Tag="Window">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
x:Uid="AppSettingsControlGeneral"
|
||||
@@ -132,6 +171,15 @@
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
<PivotItem Tag="Layout">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageLayout"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource BodyTextBlockStyle}" />
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
<PivotItem Tag="AlbumArtStyle">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
@@ -141,6 +189,15 @@
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
<PivotItem Tag="AlbumArtEffect">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageAlbumEffect"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource BodyTextBlockStyle}" />
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
<PivotItem Tag="LyricsStyle">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
@@ -168,15 +225,6 @@
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
<PivotItem Tag="Advanced">
|
||||
<PivotItem.Header>
|
||||
<TextBlock
|
||||
x:Uid="SettingsPageAdvanced"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource BodyTextBlockStyle}" />
|
||||
</PivotItem.Header>
|
||||
</PivotItem>
|
||||
|
||||
</Pivot>
|
||||
|
||||
</StackPanel>
|
||||
@@ -189,29 +237,20 @@
|
||||
</TransitionCollection>
|
||||
</controls:SwitchPresenter.ContentTransitions>
|
||||
|
||||
<!-- General -->
|
||||
<controls:Case Value="General">
|
||||
<!-- Window -->
|
||||
<controls:Case Value="Window">
|
||||
<uc:WindowSettingsControl LyricsWindowStatus="{x:Bind ViewModel.LiveStates.LyricsWindowStatus, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
|
||||
<!-- Layout -->
|
||||
<controls:Case Value="Layout">
|
||||
<ScrollViewer Style="{StaticResource SettingsScrollViewerStyle}">
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
<TextBlock x:Uid="SettingsPageLayout" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageConfigName" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<StackPanel
|
||||
Margin="0,6,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
<TextBox Text="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.Name, Mode=TwoWay}" TextWrapping="Wrap" />
|
||||
<Button Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, FontSize=12, Glyph=}" Style="{StaticResource GhostButtonStyle}" />
|
||||
</StackPanel>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageDisplayTypeSwitcher"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsExpander x:Uid="SettingsPageDisplayTypeSwitcher" IsExpanded="True">
|
||||
<ComboBox SelectedIndex="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.LyricsDisplayType, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="MainPageAlbumArtOnly" />
|
||||
<ComboBoxItem x:Uid="MainPageLyriscOnly" />
|
||||
@@ -227,115 +266,6 @@
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageWorkArea"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsWorkArea, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageWorkAreaHeight" IsEnabled="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<uc:ExtendedSlider
|
||||
Default="64"
|
||||
Maximum="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.MonitorBounds.Height, Mode=OneWay}"
|
||||
Minimum="64"
|
||||
Unit="px"
|
||||
Value="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.DockHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDockPlacement" IsEnabled="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.DockPlacement, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageDockPlacementTop" />
|
||||
<ComboBoxItem x:Uid="SettingsPageDockPlacementBottom" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDockMonitor" IsEnabled="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<ComboBox ItemsSource="{x:Bind ViewModel.MonitorDeviceNames, Mode=OneWay}" SelectedItem="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.MonitorDeviceName, Mode=TwoWay}" />
|
||||
<Button
|
||||
Command="{x:Bind ViewModel.RefreshMonitorDeviceNamesCommand}"
|
||||
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
FontSize=12,
|
||||
Glyph=}"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
</StackPanel>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAdaptEnvColor"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAdaptToEnvironment, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAdaptToEnvironment, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard
|
||||
x:Uid="SettingsPageEnvColorSample"
|
||||
Header="Environment color sample mode"
|
||||
IsEnabled="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAdaptToEnvironment, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.EnvironmentSampleMode, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleBelow" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleAbove" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleInner" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleEdge" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageWindowBounds"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard Header="X">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.WindowX, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard Header="Y">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.WindowY, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageWidth">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.WindowWidth, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageHeight">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.WindowHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAOT"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAlwaysOnTop, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageForceAlwaysOnTop" IsEnabled="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAlwaysOnTop, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsAlwaysOnTopPolling, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageHideWindow" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AutoShowOrHideWindow, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
@@ -343,7 +273,12 @@
|
||||
|
||||
<!-- Album art area style -->
|
||||
<controls:Case Value="AlbumArtStyle">
|
||||
<uc:AlbumArtLayoutSettingsControl AlbumArtLayoutSettings="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings, Mode=OneWay}" />
|
||||
<uc:AlbumArtAreaStyleSettingsControl AlbumArtLayoutSettings="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
|
||||
<!-- Album art area effect -->
|
||||
<controls:Case Value="AlbumArtEffect">
|
||||
<uc:AlbumArtAreaEffectSettingsControl AlbumArtAreaEffectSettings="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.AlbumArtAreaEffectSettings, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
|
||||
<!-- Lyrics style -->
|
||||
@@ -361,39 +296,9 @@
|
||||
<uc:LyricsBackgroundSettingsControl LyricsBackgroundSettings="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
|
||||
<!-- Advanced -->
|
||||
<controls:Case Value="Advanced">
|
||||
<ScrollViewer Style="{StaticResource SettingsScrollViewerStyle}">
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowInSwitchers" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsShownInSwitchers, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageClickThrough" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsClickThrough, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageBorderless" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.IsBorderless, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDragArea" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind ViewModel.LiveStates.LyricsWindowStatus.TitleBarArea, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaNone" />
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaTop" />
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaWhole" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</controls:Case>
|
||||
|
||||
</controls:SwitchPresenter>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
StorageFile? file;
|
||||
if (this.Parent is FlyoutPresenter)
|
||||
{
|
||||
file = await PickerHelper.PickSaveFileAsync<LyricsWindow>(fileTypeChoices);
|
||||
file = await PickerHelper.PickSaveFileAsync<NowPlayingWindow>(fileTypeChoices);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
StorageFile? file;
|
||||
if (this.Parent is FlyoutPresenter)
|
||||
{
|
||||
file = await PickerHelper.PickSingleFileAsync<LyricsWindow>(fileTypeFilter);
|
||||
file = await PickerHelper.PickSingleFileAsync<NowPlayingWindow>(fileTypeFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,5 +149,10 @@ namespace BetterLyrics.WinUI3.Controls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayGrid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
ViewModel.DisplayPanelHeight = e.NewSize.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Controls.ShadowImage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:const="using:BetterLyrics.WinUI3.Constants"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.OpacityTransition>
|
||||
<ScalarTransition />
|
||||
</UserControl.OpacityTransition>
|
||||
|
||||
<Grid Margin="-32" Padding="32">
|
||||
<Grid
|
||||
x:Name="ShadowCastGrid"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
SizeChanged="ShadowCastGrid_SizeChanged">
|
||||
<Image Source="{x:Bind Source, Mode=OneWay}" Stretch="Uniform" />
|
||||
</Grid>
|
||||
<Border
|
||||
x:Name="ShadowRect"
|
||||
Loaded="ShadowRect_Loaded"
|
||||
SizeChanged="ShadowRect_SizeChanged"
|
||||
Translation="0,0,0">
|
||||
<Border.Shadow>
|
||||
<ThemeShadow x:Name="Shadow" />
|
||||
</Border.Shadow>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,103 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls
|
||||
{
|
||||
public sealed partial class ShadowImage : UserControl
|
||||
{
|
||||
public int CornerRadiusAmount
|
||||
{
|
||||
get { return (int)GetValue(CornerRadiusAmountProperty); }
|
||||
set { SetValue(CornerRadiusAmountProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CornerRadiusAmountProperty =
|
||||
DependencyProperty.Register(nameof(CornerRadiusAmount), typeof(int), typeof(ShadowImage), new PropertyMetadata(0, OnDependencyPropertyChanged));
|
||||
|
||||
public int ShadowAmount
|
||||
{
|
||||
get { return (int)GetValue(ShadowAmountProperty); }
|
||||
set { SetValue(ShadowAmountProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShadowAmountProperty =
|
||||
DependencyProperty.Register(nameof(ShadowAmount), typeof(int), typeof(ShadowImage), new PropertyMetadata(0, OnDependencyPropertyChanged));
|
||||
|
||||
public ImageSource? Source
|
||||
{
|
||||
get { return (ImageSource?)GetValue(SourceProperty); }
|
||||
set { SetValue(SourceProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SourceProperty =
|
||||
DependencyProperty.Register(nameof(Source), typeof(ImageSource), typeof(ShadowImage), new PropertyMetadata(null));
|
||||
|
||||
public ShadowImage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private static void OnDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ShadowImage shadowImage)
|
||||
{
|
||||
if (e.Property == CornerRadiusAmountProperty)
|
||||
{
|
||||
shadowImage.UpdateShadowCastGridCornerRadius();
|
||||
shadowImage.UpdateShadowRectCornerRadius();
|
||||
}
|
||||
else if (e.Property == ShadowAmountProperty)
|
||||
{
|
||||
shadowImage.UpdateShadowRectShadow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateShadowRectShadow()
|
||||
{
|
||||
ShadowRect.Translation = new(0, 0, ShadowAmount);
|
||||
}
|
||||
|
||||
private void UpdateShadowCastGridCornerRadius()
|
||||
{
|
||||
var minSize = Math.Min(ShadowCastGrid.ActualHeight, ShadowCastGrid.ActualWidth);
|
||||
ShadowCastGrid.CornerRadius = new(CornerRadiusAmount / 100.0 * minSize);
|
||||
}
|
||||
|
||||
private void UpdateShadowRectCornerRadius()
|
||||
{
|
||||
var minSize = Math.Min(ShadowRect.ActualHeight, ShadowRect.ActualWidth);
|
||||
ShadowRect.CornerRadius = new(CornerRadiusAmount / 100.0 * minSize);
|
||||
}
|
||||
|
||||
private void ShadowCastGrid_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
UpdateShadowCastGridCornerRadius();
|
||||
}
|
||||
|
||||
private void ShadowRect_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
UpdateShadowRectCornerRadius();
|
||||
}
|
||||
|
||||
private void ShadowRect_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Shadow.Receivers.Add(ShadowCastGrid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,11 @@
|
||||
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
FontSize=12,
|
||||
Glyph=}"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
Style="{StaticResource GhostButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="SettingsPageClear" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<Button
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
@@ -31,7 +35,11 @@
|
||||
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
FontSize=12,
|
||||
Glyph=}"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
Style="{StaticResource GhostButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="SettingsPageCheckShortcut" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
x:Uid="SystemTrayMusicGallery"
|
||||
Command="{x:Bind ViewModel.OpenMusicGalleryCommand}"
|
||||
Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}" />
|
||||
Glyph=}" />
|
||||
<MenuFlyoutItem
|
||||
x:Uid="SystemTraySettings"
|
||||
Command="{x:Bind ViewModel.OpenSettingsCommand}"
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="BetterLyrics.WinUI3.Controls.WindowSettingsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dev="using:DevWinUI"
|
||||
xmlns:local="using:BetterLyrics.WinUI3.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<ScrollViewer Style="{StaticResource SettingsScrollViewerStyle}">
|
||||
<Grid Style="{StaticResource SettingsGridStyle}">
|
||||
<StackPanel Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock x:Uid="AppSettingsControlGeneral" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageConfigName" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<StackPanel
|
||||
Margin="0,6,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="6">
|
||||
<TextBox Text="{x:Bind LyricsWindowStatus.Name, Mode=TwoWay}" TextWrapping="Wrap" />
|
||||
<Button Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, FontSize=12, Glyph=}" Style="{StaticResource GhostButtonStyle}" />
|
||||
</StackPanel>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageWorkArea"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsWorkArea, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageWorkAreaHeight" IsEnabled="{x:Bind LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<local:ExtendedSlider
|
||||
Default="64"
|
||||
Maximum="{x:Bind LyricsWindowStatus.MonitorBounds.Height, Mode=OneWay}"
|
||||
Minimum="64"
|
||||
Unit="px"
|
||||
Value="{x:Bind LyricsWindowStatus.DockHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDockPlacement" IsEnabled="{x:Bind LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsWindowStatus.DockPlacement, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageDockPlacementTop" />
|
||||
<ComboBoxItem x:Uid="SettingsPageDockPlacementBottom" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDockMonitor" IsEnabled="{x:Bind LyricsWindowStatus.IsWorkArea, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<ComboBox ItemsSource="{x:Bind MonitorDeviceNames, Mode=OneWay}" SelectedItem="{x:Bind LyricsWindowStatus.MonitorDeviceName, Mode=TwoWay}" />
|
||||
<Button
|
||||
Click="RefreshMonitorButton_Click"
|
||||
Content="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
FontSize=12,
|
||||
Glyph=}"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
</StackPanel>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAdaptEnvColor"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="{x:Bind LyricsWindowStatus.IsAdaptToEnvironment, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsAdaptToEnvironment, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard
|
||||
x:Uid="SettingsPageEnvColorSample"
|
||||
Header="Environment color sample mode"
|
||||
IsEnabled="{x:Bind LyricsWindowStatus.IsAdaptToEnvironment, Mode=OneWay}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsWindowStatus.EnvironmentSampleMode, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleBelow" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleAbove" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleInner" />
|
||||
<ComboBoxItem x:Uid="SettingsPageEnvColorSampleEdge" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageWindowBounds"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard Header="X">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind LyricsWindowStatus.WindowX, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard Header="Y">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind LyricsWindowStatus.WindowY, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageWidth">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind LyricsWindowStatus.WindowWidth, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
<dev:SettingsCard x:Uid="SettingsPageHeight">
|
||||
<NumberBox
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
Value="{x:Bind LyricsWindowStatus.WindowHeight, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsExpander
|
||||
x:Uid="SettingsPageAOT"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
|
||||
Glyph=}"
|
||||
IsExpanded="True">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsAlwaysOnTop, Mode=TwoWay}" />
|
||||
<dev:SettingsExpander.Items>
|
||||
<dev:SettingsCard x:Uid="SettingsPageForceAlwaysOnTop" IsEnabled="{x:Bind LyricsWindowStatus.IsAlwaysOnTop, Mode=OneWay}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsAlwaysOnTopPolling, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
</dev:SettingsExpander.Items>
|
||||
</dev:SettingsExpander>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageHideWindow" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.AutoShowOrHideWindow, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageShowInSwitchers" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsShownInSwitchers, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageClickThrough" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsClickThrough, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageBorderless" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind LyricsWindowStatus.IsBorderless, Mode=TwoWay}" />
|
||||
</dev:SettingsCard>
|
||||
|
||||
<dev:SettingsCard x:Uid="SettingsPageDragArea" HeaderIcon="{ui:FontIcon FontFamily={StaticResource IconFontFamily}, Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind LyricsWindowStatus.TitleBarArea, Mode=TwoWay, Converter={StaticResource EnumToIntConverter}}">
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaNone" />
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaTop" />
|
||||
<ComboBoxItem x:Uid="SettingsPageTitleBarAreaWhole" />
|
||||
</ComboBox>
|
||||
</dev:SettingsCard>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,56 @@
|
||||
using BetterLyrics.WinUI3.Hooks;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace BetterLyrics.WinUI3.Controls;
|
||||
|
||||
public sealed partial class WindowSettingsControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty LyricsWindowStatusProperty =
|
||||
DependencyProperty.Register(nameof(LyricsWindowStatus), typeof(AlbumArtAreaEffectSettings), typeof(WindowSettingsControl), new PropertyMetadata(default));
|
||||
|
||||
public LyricsWindowStatus LyricsWindowStatus
|
||||
{
|
||||
get => (LyricsWindowStatus)GetValue(LyricsWindowStatusProperty);
|
||||
set => SetValue(LyricsWindowStatusProperty, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<string> MonitorDeviceNames { get; set; } = [];
|
||||
|
||||
public WindowSettingsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
MonitorDeviceNames = [.. MonitorHook.GetAllMonitorDeviceNames()];
|
||||
}
|
||||
|
||||
private void RefreshMonitorDeviceNames()
|
||||
{
|
||||
MonitorDeviceNames = [.. MonitorHook.GetAllMonitorDeviceNames()];
|
||||
LyricsWindowStatus.MonitorDeviceName = MonitorDeviceNames.FirstOrDefault() ?? "";
|
||||
}
|
||||
|
||||
private void RefreshMonitorButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RefreshMonitorDeviceNames();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using Microsoft.UI.Text;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Converter
|
||||
{
|
||||
public partial class LyricsFontWeightToFontWeightConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is LyricsFontWeight weight)
|
||||
{
|
||||
return weight.ToFontWeight();
|
||||
}
|
||||
return FontWeights.Normal;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Converter
|
||||
{
|
||||
public partial class LyricsLayoutOrientationNegationToOrientationConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is LyricsLayoutOrientation orientation)
|
||||
{
|
||||
return orientation.ToOrientationInverse();
|
||||
}
|
||||
return Orientation.Horizontal;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Converter
|
||||
{
|
||||
public partial class LyricsLayoutOrientationToOrientationConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is LyricsLayoutOrientation orientation)
|
||||
{
|
||||
return orientation.ToOrientation();
|
||||
}
|
||||
return Orientation.Horizontal;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Converter
|
||||
{
|
||||
public partial class TextAlignmentTypeToHorizontalAlignmentConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is TextAlignmentType type)
|
||||
{
|
||||
return type.ToHorizontalAlignment();
|
||||
}
|
||||
return HorizontalAlignment.Left;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Enums
|
||||
{
|
||||
public enum ImageSwitchType
|
||||
{
|
||||
Crossfade,
|
||||
Slide
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace BetterLyrics.WinUI3.Enums
|
||||
{
|
||||
public enum SpectrumStyle
|
||||
{
|
||||
Curve,
|
||||
Bar
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// 2025/6/23 by Zhe Fang
|
||||
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Enums
|
||||
@@ -14,6 +15,17 @@ namespace BetterLyrics.WinUI3.Enums
|
||||
|
||||
public static class LyricsAlignmentTypeExtensions
|
||||
{
|
||||
public static HorizontalAlignment ToHorizontalAlignment(this TextAlignmentType alignmentType)
|
||||
{
|
||||
return alignmentType switch
|
||||
{
|
||||
TextAlignmentType.Left => HorizontalAlignment.Left,
|
||||
TextAlignmentType.Center => HorizontalAlignment.Center,
|
||||
TextAlignmentType.Right => HorizontalAlignment.Right,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(alignmentType), alignmentType, null),
|
||||
};
|
||||
}
|
||||
|
||||
public static CanvasHorizontalAlignment ToCanvasHorizontalAlignment(this TextAlignmentType alignmentType)
|
||||
{
|
||||
return alignmentType switch
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Extensions
|
||||
{
|
||||
public static class LyricsLayoutOrientationExtensions
|
||||
{
|
||||
extension(LyricsLayoutOrientation orientation)
|
||||
{
|
||||
public Orientation ToOrientation() => orientation switch
|
||||
{
|
||||
LyricsLayoutOrientation.Horizontal => Orientation.Horizontal,
|
||||
LyricsLayoutOrientation.Vertical => Orientation.Vertical,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(orientation)),
|
||||
};
|
||||
|
||||
public Orientation ToOrientationInverse() => orientation switch
|
||||
{
|
||||
LyricsLayoutOrientation.Horizontal => Orientation.Vertical,
|
||||
LyricsLayoutOrientation.Vertical => Orientation.Horizontal,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(orientation)),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace BetterLyrics.WinUI3.Extensions
|
||||
{
|
||||
Name = _resourceService.GetLocalizedString("FullscreenMode"),
|
||||
IsBorderless = true,
|
||||
IsAlwaysOnTop = false,
|
||||
IsAlwaysOnTop = true,
|
||||
TitleBarArea = TitleBarArea.None,
|
||||
LyricsLayoutOrientation = LyricsLayoutOrientation.Vertical,
|
||||
LyricsStyleSettings = new LyricsStyleSettings
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace BetterLyrics.WinUI3.Extensions
|
||||
extension(Point point)
|
||||
{
|
||||
public PointInt32 ToPointInt32() => new((int)point.X, (int)point.Y);
|
||||
|
||||
public Point AddX(double deltaX) => new(point.X + deltaX, point.Y);
|
||||
public Point AddY(double deltaY) => new(point.X, point.Y + deltaY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,41 @@ namespace BetterLyrics.WinUI3.Extensions
|
||||
rect.Width,
|
||||
rect.Height
|
||||
);
|
||||
|
||||
public Rect AddY(double y) => new(
|
||||
rect.X,
|
||||
rect.Y + y,
|
||||
rect.Width,
|
||||
rect.Height
|
||||
);
|
||||
|
||||
public Rect Extend(double left, double top, double right, double bottom) => new(
|
||||
rect.X - left,
|
||||
rect.Y - top,
|
||||
rect.Width + left + right,
|
||||
rect.Height + top + bottom
|
||||
);
|
||||
|
||||
public Rect Extend(double padding) => Extend(rect, padding, padding, padding, padding);
|
||||
|
||||
public Rect Scale(double scale)
|
||||
{
|
||||
double originalWidth = rect.Width;
|
||||
double originalHeight = rect.Height;
|
||||
|
||||
double scaledWidth = originalWidth * scale;
|
||||
double scaledHeight = originalHeight * scale;
|
||||
|
||||
double scaleOffsetX = (scaledWidth - originalWidth) / 2;
|
||||
double scaleOffsetY = (scaledHeight - originalHeight) / 2;
|
||||
|
||||
return new Rect(
|
||||
rect.X - scaleOffsetX,
|
||||
rect.Y - scaleOffsetY,
|
||||
scaledWidth,
|
||||
scaledHeight
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,14 @@ namespace BetterLyrics.WinUI3.Extensions
|
||||
{
|
||||
if (track.Path is string path)
|
||||
{
|
||||
return TagLib.File.Create(path).Tag.Lyrics;
|
||||
try
|
||||
{
|
||||
return TagLib.File.Create(path).Tag.Lyrics;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Brushes;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics.Effects;
|
||||
using Windows.UI;
|
||||
|
||||
@@ -17,351 +8,6 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
public class CanvasHelper
|
||||
{
|
||||
public static CanvasLinearGradientBrush CreateHorizontalFillBrush(
|
||||
ICanvasAnimatedControl control,
|
||||
List<(double position, double opacity)> stops,
|
||||
double startX,
|
||||
double width
|
||||
)
|
||||
{
|
||||
return new CanvasLinearGradientBrush(control, stops.Select(stops => new CanvasGradientStop
|
||||
{
|
||||
Position = (float)stops.position,
|
||||
Color = Color.FromArgb((byte)(stops.opacity * 255), 128, 128, 128),
|
||||
}).ToArray())
|
||||
{
|
||||
StartPoint = new Vector2((float)startX, 0),
|
||||
EndPoint = new Vector2((float)(startX + width), 0),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 背景层
|
||||
/// </summary>
|
||||
/// <param name="lyricsLayerOpacity">_lyricsOpacityTransition.Value</param>
|
||||
public static OpacityEffect CreateBackgroundEffect(LyricsLine lyricsLine, CanvasCommandList backgroundFontEffect, double lyricsLayerOpacity)
|
||||
{
|
||||
if (lyricsLine.BlurAmountTransition.Value == 0)
|
||||
{
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = backgroundFontEffect,
|
||||
Opacity = (float)(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity),
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = new GaussianBlurEffect
|
||||
{
|
||||
Source = backgroundFontEffect,
|
||||
BlurAmount = (float)Math.Max(lyricsLine.BlurAmountTransition.Value, 0),
|
||||
BorderMode = EffectBorderMode.Soft,
|
||||
Optimization = EffectOptimization.Speed,
|
||||
},
|
||||
Opacity = (float)Math.Max(lyricsLine.OpacityTransition.Value * lyricsLayerOpacity, 0),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreateFontEffect(LyricsLine lyricsLine, ICanvasAnimatedControl control, Color strokeColor, int strokeWidth, Color fontColor)
|
||||
{
|
||||
CanvasCommandList list = new(control);
|
||||
using var ds = list.CreateDrawingSession();
|
||||
|
||||
// 描边
|
||||
if (strokeWidth > 0)
|
||||
{
|
||||
if (lyricsLine.PhoneticCanvasGeometry != null)
|
||||
{
|
||||
ds.DrawGeometry(lyricsLine.PhoneticCanvasGeometry, lyricsLine.PhoneticPosition, strokeColor, strokeWidth);
|
||||
}
|
||||
if (lyricsLine.OriginalCanvasGeometry != null)
|
||||
{
|
||||
ds.DrawGeometry(lyricsLine.OriginalCanvasGeometry, lyricsLine.OriginalPosition, strokeColor, strokeWidth);
|
||||
}
|
||||
if (lyricsLine.TranslatedCanvasGeometry != null)
|
||||
{
|
||||
ds.DrawGeometry(lyricsLine.TranslatedCanvasGeometry, lyricsLine.TranslatedPosition, strokeColor, strokeWidth);
|
||||
}
|
||||
}
|
||||
|
||||
// 绘制文本(填充)
|
||||
if (lyricsLine.PhoneticCanvasTextLayout != null)
|
||||
{
|
||||
ds.DrawTextLayout(lyricsLine.PhoneticCanvasTextLayout, lyricsLine.PhoneticPosition, fontColor);
|
||||
}
|
||||
if (lyricsLine.OriginalCanvasTextLayout != null)
|
||||
{
|
||||
ds.DrawTextLayout(lyricsLine.OriginalCanvasTextLayout, lyricsLine.OriginalPosition, fontColor);
|
||||
}
|
||||
if (lyricsLine.TranslatedCanvasTextLayout != null)
|
||||
{
|
||||
ds.DrawTextLayout(lyricsLine.TranslatedCanvasTextLayout, lyricsLine.TranslatedPosition, fontColor);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建辉光效果层
|
||||
/// 仅需在布局重构 (Relayout) 时调用
|
||||
/// </summary>
|
||||
/// <param name="lineRenderingType">_lyricsGlowEffectScope</param>
|
||||
/// <param name="glowEffectAmount">_lyricsGlowEffectAmount</param>
|
||||
public static GaussianBlurEffect CreateForegroundBlurEffect(CanvasCommandList foregroundFontEffect, IGraphicsEffectSource mask, double glowEffectAmount)
|
||||
{
|
||||
return new GaussianBlurEffect
|
||||
{
|
||||
Source = new AlphaMaskEffect
|
||||
{
|
||||
Source = foregroundFontEffect,
|
||||
AlphaMask = mask,
|
||||
},
|
||||
BlurAmount = (float)glowEffectAmount,
|
||||
Optimization = EffectOptimization.Speed,
|
||||
};
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreateCharMask(ICanvasAnimatedControl control, LyricsLine lyricsLine, int charStartIndex, int charLength, double charProgress)
|
||||
{
|
||||
var mask = new CanvasCommandList(control);
|
||||
using var ds = mask.CreateDrawingSession();
|
||||
|
||||
if (lyricsLine.OriginalCanvasTextLayout == null)
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
|
||||
var highlightRegion = lyricsLine.OriginalCanvasTextLayout.GetCharacterRegions(charStartIndex, charLength).FirstOrDefault();
|
||||
|
||||
double highlightTotalWidth = (double)highlightRegion.LayoutBounds.Width;
|
||||
// Draw the highlight for the current character
|
||||
double highlightWidth = highlightTotalWidth * charProgress;
|
||||
|
||||
double fadingWidth = (double)highlightRegion.LayoutBounds.Height / 2;
|
||||
|
||||
// Rects
|
||||
var highlightRect = new Rect(
|
||||
highlightRegion.LayoutBounds.X,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
highlightWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
|
||||
var fadeInRect = new Rect(
|
||||
highlightRect.Right - fadingWidth,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
fadingWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
var fadeOutRect = new Rect(
|
||||
highlightRect.Right,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
fadingWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
|
||||
// Brushes
|
||||
using var fadeInBrush = CanvasHelper.CreateHorizontalFillBrush(
|
||||
control,
|
||||
[(0f, 0f), (1f, 1f)],
|
||||
(double)highlightRect.Right - fadingWidth,
|
||||
fadingWidth
|
||||
);
|
||||
using var fadeOutBrush = CanvasHelper.CreateHorizontalFillBrush(
|
||||
control,
|
||||
[(0f, 1f), (1f, 0f)],
|
||||
(double)highlightRect.Right,
|
||||
fadingWidth
|
||||
);
|
||||
|
||||
ds.FillRectangle(fadeInRect, fadeInBrush);
|
||||
ds.FillRectangle(fadeOutRect, fadeOutBrush);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreateLineStartToCharMask(ICanvasAnimatedControl control, LyricsLine lyricsLine, int charStartIndex, int charLength, double charProgress, bool fade)
|
||||
{
|
||||
var mask = new CanvasCommandList(control);
|
||||
|
||||
if (lyricsLine.OriginalCanvasTextLayout == null)
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
|
||||
using var ds = mask.CreateDrawingSession();
|
||||
|
||||
var regions = lyricsLine.OriginalCanvasTextLayout.GetCharacterRegions(0, charStartIndex);
|
||||
var highlightRegion = lyricsLine.OriginalCanvasTextLayout
|
||||
.GetCharacterRegions(charStartIndex, charLength)
|
||||
.FirstOrDefault();
|
||||
if (regions.Length > 0)
|
||||
{
|
||||
// Draw the mask for the current line
|
||||
for (int j = 0; j < regions.Length; j++)
|
||||
{
|
||||
var region = regions[j];
|
||||
var rect = new Rect(
|
||||
region.LayoutBounds.X,
|
||||
region.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
region.LayoutBounds.Width,
|
||||
region.LayoutBounds.Height
|
||||
);
|
||||
ds.FillRectangle(rect, Color.FromArgb(255, 128, 128, 128));
|
||||
}
|
||||
}
|
||||
|
||||
double highlightTotalWidth = (double)highlightRegion.LayoutBounds.Width;
|
||||
// Draw the highlight for the current character
|
||||
double highlightWidth = highlightTotalWidth * charProgress;
|
||||
|
||||
double fadingWidth = (double)highlightRegion.LayoutBounds.Height / 2;
|
||||
|
||||
// Rects
|
||||
var highlightRect = new Rect(
|
||||
highlightRegion.LayoutBounds.X,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
highlightWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
|
||||
var fadeInRect = new Rect(
|
||||
highlightRect.Right - fadingWidth,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
fadingWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
|
||||
ds.FillRectangle(highlightRect, Color.FromArgb(255, 128, 128, 128));
|
||||
|
||||
if (fade)
|
||||
{
|
||||
var fadeOutRect = new Rect(
|
||||
highlightRect.Right,
|
||||
highlightRegion.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
fadingWidth,
|
||||
highlightRegion.LayoutBounds.Height
|
||||
);
|
||||
using var fadeOutBrush = CreateHorizontalFillBrush(
|
||||
control,
|
||||
[(0f, 1f), (1f, 0f)],
|
||||
(double)highlightRect.Right,
|
||||
fadingWidth
|
||||
);
|
||||
ds.FillRectangle(fadeOutRect, fadeOutBrush);
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreateLineMask(ICanvasAnimatedControl control, LyricsLine lyricsLine)
|
||||
{
|
||||
var mask = new CanvasCommandList(control);
|
||||
using var ds = mask.CreateDrawingSession();
|
||||
|
||||
if (lyricsLine.OriginalCanvasTextLayout == null)
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
|
||||
var regions = lyricsLine.OriginalCanvasTextLayout.GetCharacterRegions(0, lyricsLine.OriginalText.Length);
|
||||
if (regions.Length > 0)
|
||||
{
|
||||
for (int j = 0; j < regions.Length; j++)
|
||||
{
|
||||
var region = regions[j];
|
||||
var rect = new Rect(
|
||||
region.LayoutBounds.X,
|
||||
region.LayoutBounds.Y + lyricsLine.OriginalPosition.Y,
|
||||
region.LayoutBounds.Width,
|
||||
region.LayoutBounds.Height
|
||||
);
|
||||
ds.FillRectangle(rect, Colors.White);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreatePhoneticHighlightMask(ICanvasAnimatedControl control, LyricsLine lyricsLine)
|
||||
{
|
||||
var mask = new CanvasCommandList(control);
|
||||
using var ds = mask.CreateDrawingSession();
|
||||
|
||||
if (lyricsLine.PhoneticCanvasTextLayout == null)
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
|
||||
var regions = lyricsLine.PhoneticCanvasTextLayout.GetCharacterRegions(0, lyricsLine.PhoneticText.Length);
|
||||
if (regions.Length > 0)
|
||||
{
|
||||
for (int j = 0; j < regions.Length; j++)
|
||||
{
|
||||
var region = regions[j];
|
||||
var rect = new Rect(
|
||||
region.LayoutBounds.X,
|
||||
region.LayoutBounds.Y + lyricsLine.PhoneticPosition.Y,
|
||||
region.LayoutBounds.Width,
|
||||
region.LayoutBounds.Height
|
||||
);
|
||||
ds.FillRectangle(rect, Colors.White);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static CanvasCommandList CreateTranslatedHighlightMask(ICanvasAnimatedControl control, LyricsLine lyricsLine)
|
||||
{
|
||||
var mask = new CanvasCommandList(control);
|
||||
using var ds = mask.CreateDrawingSession();
|
||||
|
||||
if (lyricsLine.TranslatedCanvasTextLayout == null)
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
|
||||
var regions = lyricsLine.TranslatedCanvasTextLayout.GetCharacterRegions(0, lyricsLine.TranslatedText.Length);
|
||||
if (regions.Length > 0)
|
||||
{
|
||||
for (int j = 0; j < regions.Length; j++)
|
||||
{
|
||||
var region = regions[j];
|
||||
var rect = new Rect(
|
||||
region.LayoutBounds.X,
|
||||
region.LayoutBounds.Y + lyricsLine.TranslatedPosition.Y,
|
||||
region.LayoutBounds.Width,
|
||||
region.LayoutBounds.Height
|
||||
);
|
||||
ds.FillRectangle(rect, Colors.White);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建高亮效果层
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
/// <param name="lineRenderingType"></param>
|
||||
public static OpacityEffect CreateForegroundHighlightEffect(CanvasCommandList foregroundFontEffect, IGraphicsEffectSource mask, double opacity)
|
||||
{
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = new AlphaMaskEffect
|
||||
{
|
||||
Source = foregroundFontEffect,
|
||||
AlphaMask = mask,
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
};
|
||||
}
|
||||
|
||||
public static ShadowEffect CreateForegroundShadowEffect(CanvasCommandList foregroundFontEffect, IGraphicsEffectSource mask, Color shadowColor, double shadowAmount)
|
||||
{
|
||||
return new ShadowEffect
|
||||
@@ -372,34 +18,10 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
AlphaMask = mask,
|
||||
},
|
||||
ShadowColor = shadowColor,
|
||||
BlurAmount = (float)shadowAmount,
|
||||
BlurAmount = (float)Math.Clamp(shadowAmount, 0, 100),
|
||||
Optimization = EffectOptimization.Speed,
|
||||
};
|
||||
}
|
||||
|
||||
public static OpacityEffect CreateForegroundTranslationEffect(CanvasCommandList foregroundFontEffect, IGraphicsEffectSource mask, double opacity)
|
||||
{
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = new AlphaMaskEffect
|
||||
{
|
||||
Source = foregroundFontEffect,
|
||||
AlphaMask = mask,
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
};
|
||||
}
|
||||
|
||||
public static IGraphicsEffectSource GetAlphaMask(ICanvasAnimatedControl control, IGraphicsEffectSource charMask, IGraphicsEffectSource lineStartToCharMask, IGraphicsEffectSource lineMask, LineRenderingType lineRenderingType)
|
||||
{
|
||||
var result = lineRenderingType switch
|
||||
{
|
||||
LineRenderingType.CurrentChar => charMask,
|
||||
LineRenderingType.LineStartToCurrentChar => lineStartToCharMask,
|
||||
LineRenderingType.CurrentLine => lineMask,
|
||||
_ => new CanvasCommandList(control),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,39 @@
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
public static class FontHelper
|
||||
{
|
||||
public static string[] SystemFontFamilies => CanvasTextFormat.GetSystemFontFamilies().Order().ToArray();
|
||||
|
||||
public static string GetLocalizedFontFamilyName(string sourceName, string langCode)
|
||||
{
|
||||
if (langCode == "")
|
||||
{
|
||||
langCode = CultureInfo.CurrentCulture.Name;
|
||||
}
|
||||
|
||||
foreach (var font in Fonts.SystemFontFamilies)
|
||||
{
|
||||
if (font.FamilyNames.TryGetValue(XmlLanguage.GetLanguage("en-us"), out string englishFamilyName) && englishFamilyName == sourceName)
|
||||
{
|
||||
if (font.FamilyNames.ContainsKey(XmlLanguage.GetLanguage(langCode)))
|
||||
{
|
||||
if (font.FamilyNames.TryGetValue(XmlLanguage.GetLanguage(langCode), out string localizedFamilyName))
|
||||
{
|
||||
return localizedFamilyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sourceName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<byte[]?> GetImageBytesFromUrlAsync(string url)
|
||||
public static async Task<byte[]?> GetImageByteArrayFromUrlAsync(string url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
@@ -186,6 +186,16 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
return buffer.AsStream().AsRandomAccessStream();
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(IBuffer buffer)
|
||||
{
|
||||
using (var dataReader = DataReader.FromBuffer(buffer))
|
||||
{
|
||||
byte[] byteArray = new byte[buffer.Length];
|
||||
dataReader.ReadBytes(byteArray);
|
||||
return byteArray;
|
||||
}
|
||||
}
|
||||
|
||||
public static IRandomAccessStream ToIRandomAccessStream(byte[] arr)
|
||||
{
|
||||
MemoryStream stream = new MemoryStream(arr);
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
public static class LyricsLayoutHelper
|
||||
{
|
||||
// 硬性限制
|
||||
private const float BaseMinFontSize = 14f;
|
||||
private const float BaseMaxFontSize = 80f;
|
||||
private const float TargetMinVisibleLines = 5f;
|
||||
private const float WidthPaddingRatio = 0.85f;
|
||||
|
||||
// 比例配置
|
||||
private const float RatioSongTitle = 1f;
|
||||
private const float RatioArtist = 0.85f;
|
||||
private const float RatioAlbum = 0.75f;
|
||||
private const float RatioTranslation = 0.7f;
|
||||
private const float RatioTransliteration = 0.55f;
|
||||
private const float AbsoluteMinReadableSize = 10f;
|
||||
|
||||
public static LyricsLayoutMetrics CalculateLayout(double width, double height)
|
||||
{
|
||||
float baseSize = CalculateBaseFontSize(width, height);
|
||||
|
||||
return new LyricsLayoutMetrics
|
||||
{
|
||||
MainLyricsSize = baseSize,
|
||||
TranslationSize = ApplyRatio(baseSize, RatioTranslation),
|
||||
TransliterationSize = ApplyRatio(baseSize, RatioTransliteration),
|
||||
SongTitleSize = ApplyRatio(baseSize, RatioSongTitle),
|
||||
ArtistNameSize = ApplyRatio(baseSize, RatioArtist),
|
||||
AlbumNameSize = ApplyRatio(baseSize, RatioAlbum)
|
||||
};
|
||||
}
|
||||
|
||||
private static float CalculateBaseFontSize(double width, double height)
|
||||
{
|
||||
float usableWidth = (float)width * WidthPaddingRatio;
|
||||
|
||||
// 宽度 300~500px 时,除以 14 (字大)
|
||||
// 宽度 >1000px 时,除以 30 (字适中,展示更多内容)
|
||||
float targetCharsPerLine;
|
||||
if (width < 500)
|
||||
{
|
||||
targetCharsPerLine = 14f;
|
||||
}
|
||||
else if (width > 1000)
|
||||
{
|
||||
targetCharsPerLine = 30f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 平滑过渡
|
||||
float t = (float)(width - 500) / 500f;
|
||||
targetCharsPerLine = 14f + 16f * t;
|
||||
}
|
||||
|
||||
float sizeByWidth = usableWidth / targetCharsPerLine;
|
||||
float sizeByHeight = (float)height / TargetMinVisibleLines;
|
||||
|
||||
float targetSize = Math.Min(sizeByWidth, sizeByHeight);
|
||||
|
||||
// 窄屏时底线设高一点 (16px),宽屏如果高度不够可能允许更小
|
||||
float currentMinLimit = (width < 400) ? 16f : BaseMinFontSize;
|
||||
|
||||
return Math.Clamp(targetSize, currentMinLimit, BaseMaxFontSize);
|
||||
}
|
||||
|
||||
private static float ApplyRatio(float baseSize, float ratio)
|
||||
{
|
||||
return Math.Max(baseSize * ratio, AbsoluteMinReadableSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using F23.StringSimilarity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -48,7 +48,8 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
PlayerID.Edge => PlayerName.Edge,
|
||||
PlayerID.BetterLyrics => PlayerName.BetterLyrics,
|
||||
PlayerID.BetterLyricsDebug => PlayerName.BetterLyricsDebug,
|
||||
PlayerID.SaltPlayerForWindows => PlayerName.SaltPlayerForWindows,
|
||||
PlayerID.SaltPlayerForWindowsMS => PlayerName.SaltPlayerForWindowsMS,
|
||||
PlayerID.SaltPlayerForWindowsSteam => PlayerName.SaltPlayerForWindowsSteam,
|
||||
PlayerID.MoeKoeMusic => PlayerName.MoeKoeMusic,
|
||||
PlayerID.MoeKoeMusicAlternative => PlayerName.MoeKoeMusic,
|
||||
PlayerID.Listen1 => PlayerName.Listen1,
|
||||
@@ -75,7 +76,8 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
PlayerID.Edge => PathHelper.EdgeLogoPath,
|
||||
PlayerID.BetterLyrics => PathHelper.LogoPath,
|
||||
PlayerID.BetterLyricsDebug => PathHelper.LogoPath,
|
||||
PlayerID.SaltPlayerForWindows => PathHelper.SaltPlayerForWindowsLogoPath,
|
||||
PlayerID.SaltPlayerForWindowsMS => PathHelper.SaltPlayerForWindowsLogoPath,
|
||||
PlayerID.SaltPlayerForWindowsSteam => PathHelper.SaltPlayerForWindowsLogoPath,
|
||||
PlayerID.MoeKoeMusic => PathHelper.MoeKoeMusicLogoPath,
|
||||
PlayerID.MoeKoeMusicAlternative => PathHelper.MoeKoeMusicLogoPath,
|
||||
PlayerID.Listen1 => PathHelper.Listen1LogoPath,
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
public partial class SpectrumAnalyzer : IDisposable
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private WasapiLoopbackCapture? _capture;
|
||||
|
||||
private int _sampleRate = 48000;
|
||||
@@ -28,7 +29,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
private float[]? _currentSpectrum;
|
||||
public float[]? SmoothSpectrum { get; private set; }
|
||||
|
||||
public int BarCount { get; set; } = 16;
|
||||
public int BarCount { get; set; } = 64;
|
||||
public int Sensitivity { get; set; } = 100;
|
||||
public float SmoothingFactor { get; set; } = 0.95f;
|
||||
public bool IsCapturing { get; private set; } = false;
|
||||
@@ -121,12 +122,15 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
Array.Copy(_spectrumRightData, 0, _spectrumData, _spectrumLeftData.Length, _spectrumRightData.Length);
|
||||
}
|
||||
|
||||
for (int i = 0; i < BarCount; i++)
|
||||
lock (_lock)
|
||||
{
|
||||
int index = (int)((float)i / BarCount * _spectrumData.Length);
|
||||
if (index < _spectrumData.Length)
|
||||
for (int i = 0; i < BarCount; i++)
|
||||
{
|
||||
_currentSpectrum[i] = _spectrumData[index] * 250f * Sensitivity;
|
||||
int index = (int)((float)i / BarCount * _spectrumData.Length);
|
||||
if (index < _spectrumData.Length)
|
||||
{
|
||||
_currentSpectrum[i] = _spectrumData[index] * 250f * Sensitivity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,10 +143,13 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BarCount; i++)
|
||||
lock (_lock)
|
||||
{
|
||||
SmoothSpectrum[i] = SmoothSpectrum[i] * SmoothingFactor +
|
||||
_currentSpectrum[i] * (1 - SmoothingFactor);
|
||||
for (int i = 0; i < BarCount; i++)
|
||||
{
|
||||
SmoothSpectrum[i] = SmoothSpectrum[i] * SmoothingFactor +
|
||||
_currentSpectrum[i] * (1 - SmoothingFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,10 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
|
||||
public bool IsTransitioning => _isTransitioning;
|
||||
public T Value => _currentValue;
|
||||
public T StartValue => _startValue;
|
||||
public T TargetValue => _targetValue;
|
||||
public EasingType? EasingType => _easingType;
|
||||
public double Progress => _progress;
|
||||
|
||||
public ValueTransition(T initialValue, double durationSeconds, Func<T, T, double, T>? interpolator = null, EasingType? easingType = null, double delaySeconds = 0)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
|
||||
public static void CloseWindow<T>()
|
||||
{
|
||||
if (typeof(T) == typeof(LyricsWindow))
|
||||
if (typeof(T) == typeof(NowPlayingWindow))
|
||||
{
|
||||
EnsureDockModeReleased();
|
||||
}
|
||||
@@ -55,6 +55,15 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
}
|
||||
}
|
||||
|
||||
public static void MinimizeWindow<T>()
|
||||
{
|
||||
var window = _activeWindows.Find(w => w is T);
|
||||
if (window is Window w)
|
||||
{
|
||||
w.Minimize();
|
||||
}
|
||||
}
|
||||
|
||||
public static T? GetWindow<T>()
|
||||
{
|
||||
foreach (var window in _activeWindows)
|
||||
@@ -93,10 +102,10 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
var window = _activeWindows.Find(w => w is T);
|
||||
if (window == null)
|
||||
{
|
||||
if (typeof(T) == typeof(LyricsWindow))
|
||||
if (typeof(T) == typeof(NowPlayingWindow))
|
||||
{
|
||||
window = new LyricsWindow();
|
||||
((LyricsWindow)window).SystemBackdrop = SystemBackdropHelper.CreateSystemBackdrop(BackdropType.Transparent);
|
||||
window = new NowPlayingWindow();
|
||||
((NowPlayingWindow)window).SystemBackdrop = SystemBackdropHelper.CreateSystemBackdrop(BackdropType.Transparent);
|
||||
}
|
||||
else if (typeof(T) == typeof(SettingsWindow))
|
||||
{
|
||||
@@ -124,7 +133,7 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
castedWindow.Restore();
|
||||
castedWindow.Activate();
|
||||
|
||||
if (typeof(T) == typeof(LyricsWindow))
|
||||
if (typeof(T) == typeof(NowPlayingWindow))
|
||||
{
|
||||
_liveStatesService.InitLyricsWindowStatus();
|
||||
|
||||
@@ -132,7 +141,7 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
_defaultWindowStyle.Add(hwnd, castedWindow.GetWindowStyle());
|
||||
_defaultExtendedWindowStyle.Add(hwnd, castedWindow.GetExtendedWindowStyle());
|
||||
|
||||
var lyricsWindow = (LyricsWindow)window;
|
||||
var lyricsWindow = (NowPlayingWindow)window;
|
||||
lyricsWindow.ViewModel.InitShortcuts();
|
||||
lyricsWindow.ViewModel.InitFgWindowWatcher();
|
||||
|
||||
@@ -186,7 +195,7 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
|
||||
private static void EnsureDockModeReleased()
|
||||
{
|
||||
SetIsWorkArea<LyricsWindow>(false);
|
||||
SetIsWorkArea<NowPlayingWindow>(false);
|
||||
}
|
||||
|
||||
private static void TrackWindow(object window)
|
||||
@@ -292,9 +301,9 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
|
||||
public static void SetTitleBarArea<T>(TitleBarArea titleBarArea)
|
||||
{
|
||||
if (typeof(T) == typeof(LyricsWindow))
|
||||
if (typeof(T) == typeof(NowPlayingWindow))
|
||||
{
|
||||
LyricsWindow? lyricsWindow = GetWindow<LyricsWindow>();
|
||||
NowPlayingWindow? lyricsWindow = GetWindow<NowPlayingWindow>();
|
||||
lyricsWindow?.SetTitleBarArea(titleBarArea);
|
||||
}
|
||||
else
|
||||
@@ -395,7 +404,7 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
|
||||
_setLyricsWindowVisibilityByPlayingStatusTimer.Debounce(() =>
|
||||
{
|
||||
var window = GetWindow<LyricsWindow>();
|
||||
var window = GetWindow<NowPlayingWindow>();
|
||||
if (window == null) return;
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.AutoShowOrHideWindow && !_mediaSessionsService.CurrentIsPlaying)
|
||||
@@ -403,23 +412,23 @@ namespace BetterLyrics.WinUI3.Hooks
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
_liveStatesService.LiveStates.IsLyricsWindowStatusRefreshing = true;
|
||||
SetIsWorkArea<LyricsWindow>(false);
|
||||
SetIsWorkArea<NowPlayingWindow>(false);
|
||||
_liveStatesService.LiveStates.IsLyricsWindowStatusRefreshing = false;
|
||||
}
|
||||
HideWindow<LyricsWindow>();
|
||||
HideWindow<NowPlayingWindow>();
|
||||
}
|
||||
else if (_liveStatesService.LiveStates.LyricsWindowStatus.AutoShowOrHideWindow && _mediaSessionsService.CurrentIsPlaying)
|
||||
{
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
_liveStatesService.LiveStates.IsLyricsWindowStatusRefreshing = true;
|
||||
SetIsWorkArea<LyricsWindow>(true);
|
||||
SetIsWorkArea<NowPlayingWindow>(true);
|
||||
_liveStatesService.LiveStates.IsLyricsWindowStatusRefreshing = false;
|
||||
}
|
||||
OpenOrShowWindow<LyricsWindow>();
|
||||
OpenOrShowWindow<NowPlayingWindow>();
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
MoveAndResize<LyricsWindow>(_liveStatesService.LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
MoveAndResize<NowPlayingWindow>(_liveStatesService.LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
}
|
||||
}
|
||||
}, Constants.Time.DebounceTimeout);
|
||||
|
||||
137
BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs
Normal file
137
BetterLyrics.WinUI3/BetterLyrics.WinUI3/Logic/LyricsAnimator.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Logic
|
||||
{
|
||||
public class LyricsAnimator
|
||||
{
|
||||
private readonly double _defaultScale = 0.75f;
|
||||
private readonly double _highlightedScale = 1.0f;
|
||||
|
||||
public void UpdateLines(
|
||||
LyricsData? lyricsData,
|
||||
int startIndex,
|
||||
int endIndex,
|
||||
int playingLineIndex,
|
||||
double canvasHeight,
|
||||
double targetYScrollOffset,
|
||||
double playingLineTopOffsetFactor,
|
||||
LyricsEffectSettings lyricsEffect,
|
||||
ValueTransition<double> canvasYScrollTransition,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
TimeSpan elapsedTime,
|
||||
bool isMouseScrolling,
|
||||
bool isLayoutChanged,
|
||||
bool isPlayingLineChanged,
|
||||
bool isMouseScrollingChanged
|
||||
)
|
||||
{
|
||||
if (lyricsData == null) return;
|
||||
|
||||
var currentPlayingLine = lyricsData.LyricsLines.ElementAtOrDefault(playingLineIndex);
|
||||
if (currentPlayingLine == null) return;
|
||||
|
||||
for (int i = startIndex; i <= endIndex + 1; i++)
|
||||
{
|
||||
var line = lyricsData.LyricsLines.ElementAtOrDefault(i);
|
||||
if (line == null) continue;
|
||||
|
||||
if (isLayoutChanged || isPlayingLineChanged || isMouseScrollingChanged)
|
||||
{
|
||||
int lineCountDelta = i - playingLineIndex;
|
||||
int absLineCountDelta = Math.Abs(lineCountDelta);
|
||||
double distanceFromPlayingLine = Math.Abs(line.OriginalPosition.Y - currentPlayingLine.OriginalPosition.Y);
|
||||
|
||||
double distanceFactor = 0;
|
||||
if (lineCountDelta < 0)
|
||||
{
|
||||
distanceFactor = Math.Clamp(distanceFromPlayingLine / (canvasHeight * playingLineTopOffsetFactor), 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
distanceFactor = Math.Clamp(distanceFromPlayingLine / (canvasHeight * (1 - playingLineTopOffsetFactor)), 0, 1);
|
||||
}
|
||||
|
||||
double yScrollDuration;
|
||||
double yScrollDelay;
|
||||
|
||||
if (lineCountDelta < 0)
|
||||
{
|
||||
yScrollDuration =
|
||||
canvasYScrollTransition.DurationSeconds +
|
||||
distanceFactor * (lyricsEffect.LyricsScrollTopDuration / 1000.0 - canvasYScrollTransition.DurationSeconds);
|
||||
yScrollDelay = distanceFactor * lyricsEffect.LyricsScrollTopDelay / 1000.0;
|
||||
}
|
||||
else if (lineCountDelta == 0)
|
||||
{
|
||||
yScrollDuration = canvasYScrollTransition.DurationSeconds;
|
||||
yScrollDelay = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
yScrollDuration =
|
||||
canvasYScrollTransition.DurationSeconds +
|
||||
distanceFactor * (lyricsEffect.LyricsScrollBottomDuration / 1000.0 - canvasYScrollTransition.DurationSeconds);
|
||||
yScrollDelay = distanceFactor * lyricsEffect.LyricsScrollBottomDelay / 1000.0;
|
||||
}
|
||||
|
||||
line.BlurAmountTransition.SetDuration(yScrollDuration);
|
||||
line.BlurAmountTransition.SetDelay(yScrollDelay);
|
||||
line.BlurAmountTransition.StartTransition(isMouseScrolling ? 0 : (lyricsEffect.IsLyricsBlurEffectEnabled ? (5 * distanceFactor) : 0));
|
||||
|
||||
line.ScaleTransition.SetDuration(yScrollDuration);
|
||||
line.ScaleTransition.SetDelay(yScrollDelay);
|
||||
line.ScaleTransition.StartTransition(_highlightedScale - distanceFactor * (_highlightedScale - _defaultScale));
|
||||
|
||||
line.PhoneticOpacityTransition.SetDuration(yScrollDuration);
|
||||
line.PhoneticOpacityTransition.SetDelay(yScrollDelay);
|
||||
line.PhoneticOpacityTransition.StartTransition(absLineCountDelta == 0 ? 0.6 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3));
|
||||
|
||||
line.PlayedOriginalOpacityTransition.SetDuration(yScrollDuration);
|
||||
line.PlayedOriginalOpacityTransition.SetDelay(yScrollDelay);
|
||||
line.PlayedOriginalOpacityTransition.StartTransition(absLineCountDelta == 0 ? 1 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3));
|
||||
|
||||
line.UnplayedOriginalOpacityTransition.SetDuration(yScrollDuration);
|
||||
line.UnplayedOriginalOpacityTransition.SetDelay(yScrollDelay);
|
||||
line.UnplayedOriginalOpacityTransition.StartTransition(absLineCountDelta == 0 ? 0.3 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3));
|
||||
|
||||
line.TranslatedOpacityTransition.SetDuration(yScrollDuration);
|
||||
line.TranslatedOpacityTransition.SetDelay(yScrollDelay);
|
||||
line.TranslatedOpacityTransition.StartTransition(absLineCountDelta == 0 ? 0.6 : (isMouseScrolling ? 0.3 : (1 - distanceFactor) * 0.3));
|
||||
|
||||
line.ColorTransition.SetDuration(yScrollDuration);
|
||||
line.ColorTransition.SetDelay(yScrollDelay);
|
||||
line.ColorTransition.StartTransition(absLineCountDelta == 0 ? fgColor : bgColor);
|
||||
|
||||
line.AngleTransition.SetEasingType(canvasYScrollTransition.EasingType);
|
||||
line.AngleTransition.SetDuration(yScrollDuration);
|
||||
line.AngleTransition.SetDelay(yScrollDelay);
|
||||
line.AngleTransition.StartTransition(lyricsEffect.IsFanLyricsEnabled ?
|
||||
Math.PI * (lyricsEffect.FanLyricsAngle / 180.0) * distanceFactor * (i > playingLineIndex ? 1 : -1) : 0);
|
||||
|
||||
line.YOffsetTransition.SetEasingType(canvasYScrollTransition.EasingType);
|
||||
line.YOffsetTransition.SetDuration(yScrollDuration);
|
||||
line.YOffsetTransition.SetDelay(yScrollDelay);
|
||||
// 设计之初是当 isLayoutChanged 为真时 jumpTo
|
||||
// 但考虑到动画视觉,强制使用动画
|
||||
line.YOffsetTransition.StartTransition(targetYScrollOffset);
|
||||
}
|
||||
|
||||
line.AngleTransition.Update(elapsedTime);
|
||||
line.ScaleTransition.Update(elapsedTime);
|
||||
line.BlurAmountTransition.Update(elapsedTime);
|
||||
line.PhoneticOpacityTransition.Update(elapsedTime);
|
||||
line.PlayedOriginalOpacityTransition.Update(elapsedTime);
|
||||
line.UnplayedOriginalOpacityTransition.Update(elapsedTime);
|
||||
line.TranslatedOpacityTransition.Update(elapsedTime);
|
||||
line.YOffsetTransition.Update(elapsedTime);
|
||||
line.ColorTransition.Update(elapsedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Logic
|
||||
{
|
||||
public class LyricsLayoutManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 重排歌词,Y 轴从 0 刻度开始算
|
||||
/// </summary>
|
||||
/// <param name="resourceCreator"></param>
|
||||
/// <param name="lyricsData"></param>
|
||||
/// <param name="status"></param>
|
||||
/// <param name="appSettings"></param>
|
||||
/// <param name="canvasWidth"></param>
|
||||
/// <param name="canvasHeight"></param>
|
||||
/// <param name="lyricsWidth"></param>
|
||||
/// <param name="lyricsHeight"></param>
|
||||
public static void MeasureAndArrange(
|
||||
ICanvasAnimatedControl resourceCreator,
|
||||
LyricsData? lyricsData,
|
||||
LyricsWindowStatus status,
|
||||
AppSettings appSettings,
|
||||
double canvasWidth,
|
||||
double canvasHeight,
|
||||
double lyricsWidth,
|
||||
double lyricsHeight)
|
||||
{
|
||||
if (lyricsData == null || resourceCreator == null) return;
|
||||
|
||||
// 计算字体大小
|
||||
int originalFontSize, phoneticFontSize, translatedFontSize;
|
||||
var style = status.LyricsStyleSettings;
|
||||
|
||||
if (style.IsDynamicLyricsFontSize)
|
||||
{
|
||||
var lyricsLayoutMetrics = LyricsLayoutHelper.CalculateLayout(canvasWidth, canvasHeight);
|
||||
|
||||
phoneticFontSize = (int)lyricsLayoutMetrics.TransliterationSize;
|
||||
originalFontSize = (int)lyricsLayoutMetrics.MainLyricsSize;
|
||||
translatedFontSize = (int)lyricsLayoutMetrics.TranslationSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
phoneticFontSize = style.PhoneticLyricsFontSize;
|
||||
originalFontSize = style.OriginalLyricsFontSize;
|
||||
translatedFontSize = style.TranslatedLyricsFontSize;
|
||||
}
|
||||
|
||||
var fontWeight = style.LyricsFontWeight;
|
||||
|
||||
// 排版
|
||||
double currentY = 0;
|
||||
double actualWidth = 0;
|
||||
|
||||
foreach (var line in lyricsData.LyricsLines)
|
||||
{
|
||||
if (line == null) continue;
|
||||
|
||||
line.RecreateTextLayout(
|
||||
resourceCreator,
|
||||
appSettings.TranslationSettings.IsChineseRomanizationEnabled || appSettings.TranslationSettings.IsJapaneseRomanizationEnabled,
|
||||
appSettings.TranslationSettings.IsTranslationEnabled,
|
||||
phoneticFontSize, originalFontSize, translatedFontSize,
|
||||
fontWeight,
|
||||
style.LyricsCJKFontFamily, style.LyricsWesternFontFamily,
|
||||
lyricsWidth, lyricsHeight, style.LyricsAlignmentType
|
||||
);
|
||||
|
||||
line.RecreateTextGeometry();
|
||||
|
||||
// 左上角坐标
|
||||
line.TopLeftPosition = new Vector2(0, (float)currentY);
|
||||
// 注音层
|
||||
line.PhoneticPosition = line.TopLeftPosition;
|
||||
if (line.PhoneticCanvasTextLayout != null)
|
||||
{
|
||||
currentY += line.PhoneticCanvasTextLayout.LayoutBounds.Height;
|
||||
// 间距
|
||||
currentY += (line.PhoneticCanvasTextLayout.LayoutBounds.Height / line.PhoneticCanvasTextLayout.LineCount) * 0.1;
|
||||
|
||||
actualWidth = Math.Max(actualWidth, line.PhoneticCanvasTextLayout.LayoutBounds.Width);
|
||||
}
|
||||
|
||||
// 原文层
|
||||
line.OriginalPosition = new Vector2(0, (float)currentY);
|
||||
if (line.OriginalCanvasTextLayout != null)
|
||||
{
|
||||
currentY += line.OriginalCanvasTextLayout.LayoutBounds.Height;
|
||||
|
||||
actualWidth = Math.Max(actualWidth, line.OriginalCanvasTextLayout.LayoutBounds.Width);
|
||||
}
|
||||
|
||||
// 翻译层
|
||||
if (line.TranslatedCanvasTextLayout != null)
|
||||
{
|
||||
// 间距
|
||||
currentY += (line.TranslatedCanvasTextLayout.LayoutBounds.Height / line.TranslatedCanvasTextLayout.LineCount) * 0.1;
|
||||
}
|
||||
line.TranslatedPosition = new Vector2(0, (float)currentY);
|
||||
if (line.TranslatedCanvasTextLayout != null)
|
||||
{
|
||||
currentY += line.TranslatedCanvasTextLayout.LayoutBounds.Height;
|
||||
|
||||
actualWidth = Math.Max(actualWidth, line.TranslatedCanvasTextLayout.LayoutBounds.Width);
|
||||
}
|
||||
|
||||
// 右下角坐标
|
||||
line.BottomRightPosition = new Vector2(0 + (float)actualWidth, (float)currentY);
|
||||
|
||||
// 行间距
|
||||
if (line.OriginalCanvasTextLayout != null)
|
||||
{
|
||||
currentY += (line.OriginalCanvasTextLayout.LayoutBounds.Height / line.OriginalCanvasTextLayout.LineCount) * style.LyricsLineSpacingFactor;
|
||||
}
|
||||
|
||||
// 更新中心点
|
||||
line.UpdateCenterPosition(lyricsWidth, style.LyricsAlignmentType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算为了让当前歌词行的竖直几何中心点对齐到 0(原点),画布应该移动的距离(从画布最初始状态计算的值)
|
||||
/// </summary>
|
||||
public static double? CalculateTargetScrollOffset(
|
||||
LyricsData? lyricsData,
|
||||
int playingLineIndex)
|
||||
{
|
||||
var lines = lyricsData?.LyricsLines;
|
||||
if (lines == null || lines.Count == 0) return null;
|
||||
|
||||
var currentLine = lines.ElementAtOrDefault(playingLineIndex);
|
||||
var firstLine = lines.FirstOrDefault();
|
||||
|
||||
if (currentLine?.OriginalCanvasTextLayout == null || firstLine == null) return null;
|
||||
|
||||
return -currentLine.OriginalPosition.Y + firstLine.OriginalPosition.Y
|
||||
- (currentLine.BottomRightPosition.Y - currentLine.TopLeftPosition.Y) / 2.0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算当前屏幕可见的行范围
|
||||
/// 返回值: (StartVisibleIndex, EndVisibleIndex)
|
||||
/// </summary>
|
||||
public static (int Start, int End) CalculateVisibleRange(
|
||||
IList<LyricsLine>? lines,
|
||||
double currentScrollOffset,
|
||||
double lyricsY,
|
||||
double lyricsHeight,
|
||||
double canvasHeight,
|
||||
double playingLineTopOffsetFactor
|
||||
)
|
||||
{
|
||||
if (lines == null || lines.Count == 0) return (-1, -1);
|
||||
|
||||
double offset = currentScrollOffset + lyricsY + lyricsHeight * playingLineTopOffsetFactor;
|
||||
|
||||
int start = FindFirstVisibleLine(lines, offset, lyricsY);
|
||||
int end = FindLastVisibleLine(lines, offset, lyricsY, lyricsHeight, canvasHeight);
|
||||
|
||||
// 修正边界情况
|
||||
if (start != -1 && end == -1)
|
||||
{
|
||||
end = lines.Count - 1;
|
||||
}
|
||||
|
||||
return (start, end);
|
||||
}
|
||||
|
||||
public static (int Start, int End) CalculateMaxRange(IList<LyricsLine>? lines)
|
||||
{
|
||||
if (lines == null || lines.Count == 0) return (-1, -1);
|
||||
|
||||
return (0, lines.Count - 1);
|
||||
}
|
||||
|
||||
public static double CalculateActualHeight(IList<LyricsLine>? lines)
|
||||
{
|
||||
if (lines == null || lines.Count == 0) return 0;
|
||||
|
||||
return lines.Last().BottomRightPosition.Y;
|
||||
}
|
||||
|
||||
public static int FindMouseHoverLineIndex(
|
||||
IList<LyricsLine>? lines,
|
||||
bool isMouseInLyricsArea,
|
||||
Point mousePosition,
|
||||
double currentScrollOffset,
|
||||
double lyricsY,
|
||||
double lyricsHeight,
|
||||
double playingLineTopOffsetFactor
|
||||
)
|
||||
{
|
||||
if (!isMouseInLyricsArea) return -1;
|
||||
|
||||
if (lines == null || lines.Count == 0) return -1;
|
||||
|
||||
double offset = currentScrollOffset + lyricsY + lyricsHeight * playingLineTopOffsetFactor;
|
||||
|
||||
int left = 0, right = lines.Count - 1, result = -1;
|
||||
while (left <= right)
|
||||
{
|
||||
int mid = (left + right) / 2;
|
||||
var line = lines[mid];
|
||||
if (line.OriginalCanvasTextLayout == null) break;
|
||||
double value = offset + line.BottomRightPosition.Y;
|
||||
if (value >= mousePosition.Y) { result = mid; right = mid - 1; }
|
||||
else { left = mid + 1; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int FindFirstVisibleLine(IList<LyricsLine> lines, double offset, double lyricsY)
|
||||
{
|
||||
int left = 0, right = lines.Count - 1, result = -1;
|
||||
while (left <= right)
|
||||
{
|
||||
int mid = (left + right) / 2;
|
||||
var line = lines[mid];
|
||||
if (line.OriginalCanvasTextLayout == null) break;
|
||||
double value = offset + line.BottomRightPosition.Y;
|
||||
// 理论上说应该使用下面这一行来精确计算视野内的首个可见行,但是考虑到动画视觉效果,还是注释掉了
|
||||
//if (value >= lyricsY) { result = mid; right = mid - 1; }
|
||||
if (value >= 0) { result = mid; right = mid - 1; }
|
||||
else { left = mid + 1; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int FindLastVisibleLine(IList<LyricsLine> lines, double offset, double lyricsY, double lyricsHeight, double canvasHeight)
|
||||
{
|
||||
int left = 0, right = lines.Count - 1, result = -1;
|
||||
while (left <= right)
|
||||
{
|
||||
int mid = (left + right) / 2;
|
||||
var line = lines[mid];
|
||||
if (line.OriginalCanvasTextLayout == null) break;
|
||||
double value = offset + line.BottomRightPosition.Y;
|
||||
// 同理
|
||||
//if (value >= lyricsY + lyricsHeight) { result = mid; right = mid - 1; }
|
||||
if (value >= canvasHeight) { result = mid; right = mid - 1; }
|
||||
else { left = mid + 1; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Logic
|
||||
{
|
||||
public class LyricsSynchronizer
|
||||
{
|
||||
private int _lastFoundIndex = 0;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_lastFoundIndex = 0;
|
||||
}
|
||||
|
||||
public int GetCurrentLineIndex(double currentTimeMs, LyricsData? lyricsData)
|
||||
{
|
||||
if (lyricsData == null || lyricsData.LyricsLines.Count == 0) return 0;
|
||||
var lines = lyricsData.LyricsLines;
|
||||
|
||||
// Cache hit
|
||||
if (IsTimeInLine(currentTimeMs, lines, _lastFoundIndex)) return _lastFoundIndex;
|
||||
if (_lastFoundIndex + 1 < lines.Count && IsTimeInLine(currentTimeMs, lines, _lastFoundIndex + 1))
|
||||
{
|
||||
_lastFoundIndex++;
|
||||
return _lastFoundIndex;
|
||||
}
|
||||
|
||||
// Cache miss
|
||||
for (int i = 0; i < lines.Count; i++)
|
||||
{
|
||||
if (IsTimeInLine(currentTimeMs, lines, i))
|
||||
{
|
||||
_lastFoundIndex = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Default
|
||||
return Math.Min(_lastFoundIndex, lines.Count - 1);
|
||||
}
|
||||
|
||||
public LinePlaybackState GetLinePlayingProgress(
|
||||
double currentTimeMs,
|
||||
LyricsLine line,
|
||||
LyricsLine? nextLine,
|
||||
double songDurationMs,
|
||||
bool isForceWordByWord)
|
||||
{
|
||||
var state = new LinePlaybackState { SyllableStartIndex = 0, SyllableLength = 0, SyllableProgress = 0 };
|
||||
|
||||
if (line == null) return state;
|
||||
|
||||
double lineEndMs;
|
||||
if (line.EndMs != null) lineEndMs = line.EndMs.Value;
|
||||
else if (nextLine != null) lineEndMs = nextLine.StartMs;
|
||||
else lineEndMs = songDurationMs;
|
||||
|
||||
// 还没到
|
||||
if (currentTimeMs < line.StartMs) return state;
|
||||
|
||||
// 过了
|
||||
if (currentTimeMs > lineEndMs)
|
||||
{
|
||||
state.SyllableProgress = 1f;
|
||||
state.SyllableStartIndex = Math.Max(0, line.OriginalText.Length - 1);
|
||||
state.SyllableLength = 1;
|
||||
return state;
|
||||
}
|
||||
|
||||
// 逐字
|
||||
if (line.LyricsSyllables != null && line.LyricsSyllables.Count > 1)
|
||||
{
|
||||
return CalculateSyllableProgress(currentTimeMs, line, lineEndMs);
|
||||
}
|
||||
|
||||
// 强制逐字
|
||||
if (isForceWordByWord && line.OriginalText.Length > 0)
|
||||
{
|
||||
return CalculateSimulatedProgress(currentTimeMs, line, lineEndMs);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 普通行
|
||||
state.SyllableStartIndex = line.OriginalText.Length;
|
||||
state.SyllableProgress = 1f;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
private LinePlaybackState CalculateSyllableProgress(double time, LyricsLine line, double lineEndMs)
|
||||
{
|
||||
var state = new LinePlaybackState();
|
||||
int count = line.LyricsSyllables.Count;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var timing = line.LyricsSyllables[i];
|
||||
var nextTiming = (i + 1 < count) ? line.LyricsSyllables[i + 1] : null;
|
||||
|
||||
double timingEndMs = timing.EndMs ?? nextTiming?.StartMs ?? lineEndMs;
|
||||
|
||||
// 在当前字范围内
|
||||
if (time >= timing.StartMs && time <= timingEndMs)
|
||||
{
|
||||
state.SyllableStartIndex = timing.StartIndex;
|
||||
state.SyllableLength = timing.Text.Length;
|
||||
state.SyllableProgress = (timingEndMs > timing.StartMs)
|
||||
? (time - timing.StartMs) / (timingEndMs - timing.StartMs)
|
||||
: 0;
|
||||
return state;
|
||||
}
|
||||
// 在空隙中 (已过当前字,未到下个字)
|
||||
else if (time > timingEndMs && (nextTiming == null || time < nextTiming.StartMs))
|
||||
{
|
||||
state.SyllableProgress = 1f; // 保持上个字满进度
|
||||
state.SyllableStartIndex = timing.StartIndex;
|
||||
state.SyllableLength = timing.Text.Length;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
private LinePlaybackState CalculateSimulatedProgress(double time, LyricsLine line, double lineEndMs)
|
||||
{
|
||||
var state = new LinePlaybackState();
|
||||
int textLength = line.OriginalText.Length;
|
||||
|
||||
double progress = (time - line.StartMs) / (lineEndMs - line.StartMs);
|
||||
progress = Math.Clamp(progress, 0, 1);
|
||||
|
||||
double charFloatIndex = progress * textLength;
|
||||
int charIndex = (int)charFloatIndex;
|
||||
|
||||
state.SyllableStartIndex = Math.Clamp(charIndex, 0, textLength - 1);
|
||||
state.SyllableLength = 1;
|
||||
state.SyllableProgress = charFloatIndex - charIndex;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
private bool IsTimeInLine(double time, IList<LyricsLine> lines, int index)
|
||||
{
|
||||
if (index < 0 || index >= lines.Count) return false;
|
||||
var line = lines[index];
|
||||
var nextLine = (index + 1 < lines.Count) ? lines[index + 1] : null;
|
||||
if (time < line.StartMs) return false;
|
||||
if (nextLine != null && time >= nextLine.StartMs) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
public struct AlbumArtThemeColors
|
||||
{
|
||||
public Color BgFontColor;
|
||||
public Color FgFontColor;
|
||||
public Color StrokeFontColor;
|
||||
public Color EnvColor;
|
||||
|
||||
public Color AccentColor1;
|
||||
public Color AccentColor2;
|
||||
public Color AccentColor3;
|
||||
public Color AccentColor4;
|
||||
|
||||
public ElementTheme ThemeType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
public class ExtendedFontFamily
|
||||
{
|
||||
public string FontFamily { get; set; } = "";
|
||||
public string LocalizedFontFamily { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
public struct LinePlaybackState
|
||||
{
|
||||
public int SyllableStartIndex;
|
||||
public int SyllableLength;
|
||||
public double SyllableProgress;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
}
|
||||
public bool AutoGenerated { get; set; } = false;
|
||||
public string WrappedOriginalText => string.Join(StringHelper.NewLine, LyricsLines.Select(line => line.OriginalText));
|
||||
public bool IsWordByWord => LyricsLines.Any(x => x.LyricsChars.Count != 0);
|
||||
public bool IsWordByWord => LyricsLines.Any(x => x.LyricsSyllables.Count != 0);
|
||||
|
||||
public LyricsData()
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTranslatedText(LyricsData translationData, string separator, int toleranceMs = 0)
|
||||
public void SetTranslatedText(LyricsData translationData, int toleranceMs = 0)
|
||||
{
|
||||
foreach (var line in LyricsLines)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPhoneticText(LyricsData phoneticData, string separator, int toleranceMs = 0)
|
||||
public void SetPhoneticText(LyricsData phoneticData, int toleranceMs = 0)
|
||||
{
|
||||
foreach (var line in LyricsLines)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTranslation(string translation, string separator)
|
||||
public void SetTranslation(string translation)
|
||||
{
|
||||
List<string> translationArr = translation.Split(StringHelper.NewLine).ToList();
|
||||
int i = 0;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
public struct LyricsLayoutMetrics
|
||||
{
|
||||
public float MainLyricsSize;
|
||||
public float TranslationSize;
|
||||
public float TransliterationSize;
|
||||
|
||||
public float SongTitleSize;
|
||||
public float ArtistNameSize;
|
||||
public float AlbumNameSize;
|
||||
|
||||
public Thickness AlbumArtPadding;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,13 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.Graphics.Canvas.Geometry;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
@@ -17,30 +18,45 @@ namespace BetterLyrics.WinUI3.Models
|
||||
public double AnimationDuration { get; set; } = 0.3;
|
||||
public ValueTransition<double> AngleTransition { get; set; }
|
||||
public ValueTransition<double> BlurAmountTransition { get; set; }
|
||||
public ValueTransition<double> HighlightOpacityTransition { get; set; }
|
||||
public ValueTransition<double> OpacityTransition { get; set; }
|
||||
public ValueTransition<double> PhoneticOpacityTransition { get; set; }
|
||||
public ValueTransition<double> PlayedOriginalOpacityTransition { get; set; }
|
||||
public ValueTransition<double> UnplayedOriginalOpacityTransition { get; set; }
|
||||
public ValueTransition<double> TranslatedOpacityTransition { get; set; }
|
||||
public ValueTransition<double> ScaleTransition { get; set; }
|
||||
public ValueTransition<double> YOffsetTransition { get; set; }
|
||||
public ValueTransition<Color> ColorTransition { get; set; }
|
||||
|
||||
public CanvasTextLayout? OriginalCanvasTextLayout { get; private set; }
|
||||
public CanvasTextLayout? TranslatedCanvasTextLayout { get; private set; }
|
||||
public CanvasTextLayout? PhoneticCanvasTextLayout { get; private set; }
|
||||
|
||||
public Vector2 CenterPosition { get; private set; }
|
||||
/// <summary>
|
||||
/// 原文位置
|
||||
/// 原文坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 OriginalPosition { get; set; }
|
||||
/// <summary>
|
||||
/// 译文位置
|
||||
/// 译文坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 TranslatedPosition { get; set; }
|
||||
/// <summary>
|
||||
/// 注音位置
|
||||
/// 注音坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 PhoneticPosition { get; set; }
|
||||
|
||||
public List<LyricsChar> LyricsChars { get; set; } = [];
|
||||
/// <summary>
|
||||
/// 顶部坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 TopLeftPosition { get; set; }
|
||||
/// <summary>
|
||||
/// 中心坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 CenterPosition { get; private set; }
|
||||
/// <summary>
|
||||
/// 底部坐标(相对于坐标原点)
|
||||
/// </summary>
|
||||
public Vector2 BottomRightPosition { get; set; }
|
||||
|
||||
public List<LyricsSyllable> LyricsSyllables { get; set; } = [];
|
||||
|
||||
public int? DurationMs => EndMs - StartMs;
|
||||
public int? EndMs { get; set; }
|
||||
@@ -68,32 +84,47 @@ namespace BetterLyrics.WinUI3.Models
|
||||
AngleTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
BlurAmountTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
HighlightOpacityTransition = new(
|
||||
PhoneticOpacityTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
OpacityTransition = new(
|
||||
PlayedOriginalOpacityTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
UnplayedOriginalOpacityTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
TranslatedOpacityTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
ScaleTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
YOffsetTransition = new(
|
||||
initialValue: 0,
|
||||
durationSeconds: AnimationDuration,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
easingType: EasingType.EaseInOutSine
|
||||
);
|
||||
ColorTransition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,13 +135,13 @@ namespace BetterLyrics.WinUI3.Models
|
||||
return;
|
||||
}
|
||||
|
||||
double centerY = OriginalPosition.Y + (OriginalCanvasTextLayout?.LayoutBounds.Height ?? 0) / 2;
|
||||
double centerY = (TopLeftPosition.Y + BottomRightPosition.Y) / 2;
|
||||
|
||||
CenterPosition = type switch
|
||||
{
|
||||
TextAlignmentType.Left => new Vector2(OriginalPosition.X, (float)centerY),
|
||||
TextAlignmentType.Center => new Vector2((float)(OriginalPosition.X + maxWidth / 2.0), (float)centerY),
|
||||
TextAlignmentType.Right => new Vector2((float)(OriginalPosition.X + maxWidth), (float)centerY),
|
||||
TextAlignmentType.Left => new Vector2(0, (float)centerY),
|
||||
TextAlignmentType.Center => new Vector2((float)(0 + maxWidth / 2.0), (float)centerY),
|
||||
TextAlignmentType.Right => new Vector2((float)(0 + maxWidth), (float)centerY),
|
||||
_ => throw new System.ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
public class LyricsChar
|
||||
public class LyricsSyllable
|
||||
{
|
||||
public int? EndMs { get; set; }
|
||||
public int StartIndex { get; set; }
|
||||
public int StartMs { get; set; }
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public int? DurationMs => EndMs - StartMs;
|
||||
public bool IsLongDuration => DurationMs >= 700;
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,13 @@ namespace BetterLyrics.WinUI3.Models
|
||||
[ObservableProperty] public partial LyricsStyleSettings LyricsStyleSettings { get; set; } = new();
|
||||
[ObservableProperty] public partial LyricsEffectSettings LyricsEffectSettings { get; set; } = new(500, 500, 500, EasingType.EaseInOutQuad);
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsBackgroundSettings LyricsBackgroundSettings { get; set; } = new();
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial AlbumArtLayoutSettings AlbumArtLayoutSettings { get; set; } = new();
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial AlbumArtAreaStyleSettings AlbumArtLayoutSettings { get; set; } = new();
|
||||
[ObservableProperty] public partial AlbumArtAreaEffectSettings AlbumArtAreaEffectSettings { get; set; } = new();
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsAdaptToEnvironment { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial WindowPixelSampleMode EnvironmentSampleMode { get; set; } = WindowPixelSampleMode.WindowEdge;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool AutoShowOrHideWindow { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial TitleBarArea TitleBarArea { get; set; } = TitleBarArea.Top;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial double WindowX { get; set; } = 100;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial double WindowY { get; set; } = 100;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial double WindowWidth { get; set; } = 800;
|
||||
@@ -64,7 +66,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
newValue.PropertyChanged += OldLyricsBackgroundSettings_PropertyChanged;
|
||||
}
|
||||
|
||||
partial void OnAlbumArtLayoutSettingsChanged(AlbumArtLayoutSettings oldValue, AlbumArtLayoutSettings newValue)
|
||||
partial void OnAlbumArtLayoutSettingsChanged(AlbumArtAreaStyleSettings oldValue, AlbumArtAreaStyleSettings newValue)
|
||||
{
|
||||
oldValue.PropertyChanged -= OldAlbumArtLayoutSettings_PropertyChanged;
|
||||
newValue.PropertyChanged += OldAlbumArtLayoutSettings_PropertyChanged;
|
||||
@@ -102,7 +104,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
|
||||
public void UpdateMonitorNameAndBounds()
|
||||
{
|
||||
var lyricsWindow = WindowHook.GetWindow<LyricsWindow>();
|
||||
var lyricsWindow = WindowHook.GetWindow<NowPlayingWindow>();
|
||||
if (lyricsWindow == null) return;
|
||||
|
||||
var mointor = MonitorHook.GetMonitorInfoExFromWindow(lyricsWindow);
|
||||
@@ -183,19 +185,24 @@ namespace BetterLyrics.WinUI3.Models
|
||||
MonitorBounds = this.MonitorBounds,
|
||||
DemoMonitorBounds = this.DemoMonitorBounds,
|
||||
DockPlacement = this.DockPlacement,
|
||||
|
||||
LyricsStyleSettings = (LyricsStyleSettings)this.LyricsStyleSettings.Clone(),
|
||||
LyricsEffectSettings = (LyricsEffectSettings)this.LyricsEffectSettings.Clone(),
|
||||
LyricsBackgroundSettings = (LyricsBackgroundSettings)this.LyricsBackgroundSettings.Clone(),
|
||||
AlbumArtLayoutSettings = (AlbumArtLayoutSettings)this.AlbumArtLayoutSettings.Clone(),
|
||||
AlbumArtLayoutSettings = (AlbumArtAreaStyleSettings)this.AlbumArtLayoutSettings.Clone(),
|
||||
AlbumArtAreaEffectSettings = (AlbumArtAreaEffectSettings)this.AlbumArtAreaEffectSettings.Clone(),
|
||||
|
||||
IsAdaptToEnvironment = this.IsAdaptToEnvironment,
|
||||
EnvironmentSampleMode = this.EnvironmentSampleMode,
|
||||
AutoShowOrHideWindow = this.AutoShowOrHideWindow,
|
||||
TitleBarArea = this.TitleBarArea,
|
||||
|
||||
WindowX = this.WindowX,
|
||||
WindowY = this.WindowY,
|
||||
WindowWidth = this.WindowWidth,
|
||||
WindowHeight = this.WindowHeight,
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models.Settings
|
||||
{
|
||||
public partial class AlbumArtAreaEffectSettings : ObservableRecipient, ICloneable
|
||||
{
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial ImageSwitchType ImageSwitchType { get; set; } = ImageSwitchType.Slide;
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new AlbumArtAreaEffectSettings()
|
||||
{
|
||||
ImageSwitchType = this.ImageSwitchType,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,35 +4,39 @@ using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Models.Settings
|
||||
{
|
||||
public partial class AlbumArtLayoutSettings : ObservableRecipient, ICloneable
|
||||
public partial class AlbumArtAreaStyleSettings : ObservableRecipient, ICloneable
|
||||
{
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial TextAlignmentType SongInfoAlignmentType { get; set; } = TextAlignmentType.Left;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsAutoCoverImageHeight { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverImageHeight { get; set; } = 128;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverImageRadius { get; set; } = 12; // 12 % of the cover image size
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverImageShadowAmount { get; set; } = 12;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsAutoSongInfoFontSize { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int SongInfoFontSize { get; set; } = 18;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool ShowTitle { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool ShowArtists { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool ShowAlbum { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int AlbumArtSize { get; set; } = 64;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool AutoAlbumArtSize { get; set; } = true;
|
||||
|
||||
public AlbumArtLayoutSettings() { }
|
||||
public AlbumArtAreaStyleSettings() { }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new AlbumArtLayoutSettings
|
||||
return new AlbumArtAreaStyleSettings
|
||||
{
|
||||
SongInfoAlignmentType = this.SongInfoAlignmentType,
|
||||
|
||||
IsAutoCoverImageHeight = this.IsAutoCoverImageHeight,
|
||||
CoverImageHeight = this.CoverImageHeight,
|
||||
CoverImageRadius = this.CoverImageRadius,
|
||||
CoverImageShadowAmount = this.CoverImageShadowAmount,
|
||||
|
||||
IsAutoSongInfoFontSize = this.IsAutoSongInfoFontSize,
|
||||
SongInfoFontSize = this.SongInfoFontSize,
|
||||
ShowTitle = this.ShowTitle,
|
||||
ShowArtists = this.ShowArtists,
|
||||
ShowAlbum = this.ShowAlbum,
|
||||
AlbumArtSize = this.AlbumArtSize,
|
||||
AutoAlbumArtSize = this.AutoAlbumArtSize,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -12,18 +12,14 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsPureColorOverlayEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int PureColorOverlayOpacity { get; set; } = 100; // 100 % = 1.0
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsCoverOverlayEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverOverlayBlurAmount { get; set; } = 100; // 100 % of the cover image size
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverOverlayOpacity { get; set; } = 100; // 100 % = 1.0
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverOverlaySpeed { get; set; } = 50; // 50 % of the base rotate speed
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int CoverAcrylicEffectAmount { get; set; } = 0;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsFluidOverlayEnabled { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int FluidOverlayOpacity { get; set; } = 100;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial PaletteGeneratorType PaletteGeneratorType { get; set; } = PaletteGeneratorType.MedianCut;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsSpectrumOverlayEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial SpectrumPlacement SpectrumPlacement { get; set; } = SpectrumPlacement.Bottom;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial SpectrumStyle SpectrumStyle { get; set; } = SpectrumStyle.Bar;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int SpectrumCount { get; set; } = 128;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsSnowFlakeOverlayEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int SnowFlakeOverlayAmount { get; set; } = 10;
|
||||
@@ -43,12 +39,6 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
IsPureColorOverlayEnabled = this.IsPureColorOverlayEnabled,
|
||||
PureColorOverlayOpacity = this.PureColorOverlayOpacity,
|
||||
|
||||
IsCoverOverlayEnabled = this.IsCoverOverlayEnabled,
|
||||
CoverOverlayBlurAmount = this.CoverOverlayBlurAmount,
|
||||
CoverOverlayOpacity = this.CoverOverlayOpacity,
|
||||
CoverOverlaySpeed = this.CoverOverlaySpeed,
|
||||
CoverAcrylicEffectAmount = this.CoverAcrylicEffectAmount,
|
||||
|
||||
IsFluidOverlayEnabled = this.IsFluidOverlayEnabled,
|
||||
FluidOverlayOpacity = this.FluidOverlayOpacity,
|
||||
PaletteGeneratorType = this.PaletteGeneratorType,
|
||||
|
||||
@@ -6,25 +6,10 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
{
|
||||
public partial class LyricsEffectSettings : ObservableRecipient, ICloneable
|
||||
{
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsBlurAmount { get; set; } = 5;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsLineFadeEnabled { get; set; } = true;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsBlurEffectEnabled { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsGlowEffectEnabled { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LineRenderingType LyricsGlowEffectScope { get; set; } = LineRenderingType.CurrentChar;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsGlowEffectAmount { get; set; } = 8;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsShadowEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LineRenderingType LyricsShadowScope { get; set; } = LineRenderingType.LineStartToCurrentChar;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsShadowAmount { get; set; } = 8;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LineRenderingType OriginalLyricsHighlightScope { get; set; } = LineRenderingType.LineStartToCurrentChar;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int PhoneticLyricsHighlightAmount { get; set; } = 60; // 100% 是上界
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int OriginalLyricsHighlightAmount { get; set; } = 100; // 100% 是上界
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int TranslatedLyricsHighlightAmount { get; set; } = 60; // 100% 是上界
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsScaleEffectEnabled { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsLyricsFloatAnimationEnabled { get; set; } = true;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsFloatAmount { get; set; } = 1;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial EasingType LyricsScrollEasingType { get; set; }
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollDuration { get; set; }
|
||||
@@ -33,8 +18,6 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollTopDelay { get; set; } = 0;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsScrollBottomDelay { get; set; } = 0;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsVerticalEdgeOpacity { get; set; } = 0; // 0% opacity
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial bool IsFanLyricsEnabled { get; set; } = false;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int FanLyricsAngle { get; set; } = 30;
|
||||
|
||||
@@ -56,25 +39,10 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
{
|
||||
return new LyricsEffectSettings(this.LyricsScrollTopDuration, this.LyricsScrollDuration, this.LyricsScrollBottomDuration, this.LyricsScrollEasingType)
|
||||
{
|
||||
LyricsBlurAmount = this.LyricsBlurAmount,
|
||||
|
||||
IsLyricsLineFadeEnabled = this.IsLyricsLineFadeEnabled,
|
||||
|
||||
IsLyricsBlurEffectEnabled = this.IsLyricsBlurEffectEnabled,
|
||||
IsLyricsGlowEffectEnabled = this.IsLyricsGlowEffectEnabled,
|
||||
LyricsGlowEffectScope = this.LyricsGlowEffectScope,
|
||||
LyricsGlowEffectAmount = this.LyricsGlowEffectAmount,
|
||||
|
||||
IsLyricsShadowEnabled = this.IsLyricsShadowEnabled,
|
||||
LyricsShadowScope = this.LyricsShadowScope,
|
||||
LyricsShadowAmount = this.LyricsShadowAmount,
|
||||
|
||||
OriginalLyricsHighlightScope = this.OriginalLyricsHighlightScope,
|
||||
PhoneticLyricsHighlightAmount = this.PhoneticLyricsHighlightAmount,
|
||||
OriginalLyricsHighlightAmount = this.OriginalLyricsHighlightAmount,
|
||||
TranslatedLyricsHighlightAmount = this.TranslatedLyricsHighlightAmount,
|
||||
|
||||
IsLyricsScaleEffectEnabled = this.IsLyricsScaleEffectEnabled,
|
||||
IsLyricsFloatAnimationEnabled = this.IsLyricsFloatAnimationEnabled,
|
||||
LyricsFloatAmount = this.LyricsFloatAmount,
|
||||
|
||||
LyricsScrollEasingType = this.LyricsScrollEasingType,
|
||||
LyricsScrollDuration = this.LyricsScrollDuration,
|
||||
@@ -83,8 +51,6 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
LyricsScrollTopDelay = this.LyricsScrollTopDelay,
|
||||
LyricsScrollBottomDelay = this.LyricsScrollBottomDelay,
|
||||
|
||||
LyricsVerticalEdgeOpacity = this.LyricsVerticalEdgeOpacity,
|
||||
|
||||
IsFanLyricsEnabled = this.IsFanLyricsEnabled,
|
||||
FanLyricsAngle = this.FanLyricsAngle,
|
||||
|
||||
|
||||
@@ -14,21 +14,27 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int PhoneticLyricsFontSize { get; set; } = 12;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int OriginalLyricsFontSize { get; set; } = 24;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int TranslatedLyricsFontSize { get; set; } = 12;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial TextAlignmentType LyricsAlignmentType { get; set; } = TextAlignmentType.Left;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsBgFontOpacity { get; set; } = 30; // 30% opacity
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int LyricsFontStrokeWidth { get; set; } = 0;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial Color LyricsCustomBgFontColor { get; set; } = Colors.White;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial Color LyricsCustomFgFontColor { get; set; } = Colors.White;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial Color LyricsCustomStrokeFontColor { get; set; } = Colors.White;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsFontColorType LyricsBgFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsFontColorType LyricsFgFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsFontColorType LyricsStrokeFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsFontWeight LyricsFontWeight { get; set; } = LyricsFontWeight.Bold;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial double LyricsLineSpacingFactor { get; set; } = 0.5;
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial string LyricsTranslationSeparator { get; set; } = StringHelper.NewLine;
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial string LyricsCJKFontFamily { get; set; } = FontHelper.SystemFontFamilies.FirstOrDefault() ?? "";
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial string LyricsWesternFontFamily { get; set; } = FontHelper.SystemFontFamilies.FirstOrDefault() ?? "";
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial int PlayingLineTopOffset { get; set; } = 50; // 50 %
|
||||
|
||||
public LyricsStyleSettings() { }
|
||||
|
||||
public object Clone()
|
||||
@@ -40,7 +46,6 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
OriginalLyricsFontSize = this.OriginalLyricsFontSize,
|
||||
TranslatedLyricsFontSize = this.TranslatedLyricsFontSize,
|
||||
LyricsAlignmentType = this.LyricsAlignmentType,
|
||||
LyricsBgFontOpacity = this.LyricsBgFontOpacity,
|
||||
LyricsFontStrokeWidth = this.LyricsFontStrokeWidth,
|
||||
LyricsCustomBgFontColor = this.LyricsCustomBgFontColor,
|
||||
LyricsCustomFgFontColor = this.LyricsCustomFgFontColor,
|
||||
@@ -50,9 +55,10 @@ namespace BetterLyrics.WinUI3.Models.Settings
|
||||
LyricsStrokeFontColorType = this.LyricsStrokeFontColorType,
|
||||
LyricsFontWeight = this.LyricsFontWeight,
|
||||
LyricsLineSpacingFactor = this.LyricsLineSpacingFactor,
|
||||
LyricsTranslationSeparator = this.LyricsTranslationSeparator,
|
||||
LyricsCJKFontFamily = this.LyricsCJKFontFamily,
|
||||
LyricsWesternFontFamily = this.LyricsWesternFontFamily,
|
||||
|
||||
PlayingLineTopOffset = this.PlayingLineTopOffset,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var matches = syllableRegex.Matches(line);
|
||||
var syllables = new List<LyricsChar>();
|
||||
var syllables = new List<LyricsSyllable>();
|
||||
|
||||
int startIndex = 0;
|
||||
for (int i = 0; i < matches.Count; i++)
|
||||
@@ -36,7 +36,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
int totalMs = min * 60_000 + sec * 1000 + ms;
|
||||
string text = match.Groups[6].Value;
|
||||
|
||||
syllables.Add(new LyricsChar { StartMs = totalMs, Text = text, StartIndex = startIndex });
|
||||
syllables.Add(new LyricsSyllable { StartMs = totalMs, Text = text, StartIndex = startIndex });
|
||||
startIndex += text.Length;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
{
|
||||
StartMs = syllables[0].StartMs,
|
||||
OriginalText = string.Concat(syllables.Select(s => s.Text)),
|
||||
LyricsChars = syllables
|
||||
LyricsSyllables = syllables
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = lineRead.StartTime ?? 0,
|
||||
EndMs = lineRead.EndTime ?? 0,
|
||||
OriginalText = lineRead.Text,
|
||||
LyricsChars = [],
|
||||
LyricsSyllables = [],
|
||||
};
|
||||
|
||||
var syllables = (lineRead as Lyricify.Lyrics.Models.SyllableLineInfo)?.Syllables;
|
||||
@@ -36,14 +36,14 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
)
|
||||
{
|
||||
var syllable = syllables[syllableIndex];
|
||||
var charTiming = new LyricsChar
|
||||
var charTiming = new LyricsSyllable
|
||||
{
|
||||
StartMs = syllable.StartTime,
|
||||
EndMs = syllable.EndTime,
|
||||
Text = syllable.Text,
|
||||
StartIndex = startIndex,
|
||||
};
|
||||
lineWrite.LyricsChars.Add(charTiming);
|
||||
lineWrite.LyricsSyllables.Add(charTiming);
|
||||
startIndex += syllable.Text.Length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
// 拼接空白字符后的原文
|
||||
string originalText = string.Concat(originalTextSpans.Select(s => s.Value));
|
||||
|
||||
var originalCharTimings = new List<LyricsChar>();
|
||||
var originalCharTimings = new List<LyricsSyllable>();
|
||||
int originalStartIndex = 0;
|
||||
foreach (var span in originalTextSpans)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
string? sEnd = span.Attribute("end")?.Value;
|
||||
int sStartMs = ParseTtmlTime(sBegin);
|
||||
int sEndMs = ParseTtmlTime(sEnd);
|
||||
originalCharTimings.Add(new LyricsChar
|
||||
originalCharTimings.Add(new LyricsSyllable
|
||||
{
|
||||
StartMs = sStartMs,
|
||||
EndMs = sEndMs,
|
||||
@@ -77,7 +77,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = pStartMs,
|
||||
EndMs = pEndMs,
|
||||
OriginalText = originalText,
|
||||
LyricsChars = originalCharTimings,
|
||||
LyricsSyllables = originalCharTimings,
|
||||
});
|
||||
|
||||
// 解析 x-role
|
||||
@@ -108,7 +108,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
.ToList();
|
||||
|
||||
string text = string.Concat(textSpans.Select(s => s.Value));
|
||||
var charTimings = new List<LyricsChar>();
|
||||
var charTimings = new List<LyricsSyllable>();
|
||||
int startIndex = 0;
|
||||
foreach (var span in textSpans)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
string? sEnd = span.Attribute("end")?.Value;
|
||||
int sStartMs = ParseTtmlTime(sBegin);
|
||||
int sEndMs = ParseTtmlTime(sEnd);
|
||||
charTimings.Add(new LyricsChar
|
||||
charTimings.Add(new LyricsSyllable
|
||||
{
|
||||
StartMs = sStartMs,
|
||||
EndMs = sEndMs,
|
||||
@@ -132,7 +132,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = pStartMs,
|
||||
EndMs = pEndMs,
|
||||
OriginalText = text,
|
||||
LyricsChars = charTimings,
|
||||
LyricsSyllables = charTimings,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
|
||||
if (LyricsDataArr.Count == 0)
|
||||
{
|
||||
LyricsDataArr.Add(LyricsData.GetParseErrorPlaceholder());
|
||||
LyricsDataArr.Add(LyricsData.GetNotfoundPlaceholder());
|
||||
}
|
||||
}
|
||||
LoadTranslation(lyricsSearchResult);
|
||||
@@ -112,7 +112,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = line.StartMs,
|
||||
EndMs = line.EndMs,
|
||||
OriginalText = PhoneticHelper.ToPinyin(line.OriginalText),
|
||||
LyricsChars = line.LyricsChars.Select(c => new LyricsChar
|
||||
LyricsSyllables = line.LyricsSyllables.Select(c => new LyricsSyllable
|
||||
{
|
||||
StartMs = c.StartMs,
|
||||
EndMs = c.EndMs,
|
||||
@@ -133,7 +133,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = line.StartMs,
|
||||
EndMs = line.EndMs,
|
||||
OriginalText = PhoneticHelper.ToJyutping(line.OriginalText),
|
||||
LyricsChars = line.LyricsChars.Select(c => new LyricsChar
|
||||
LyricsSyllables = line.LyricsSyllables.Select(c => new LyricsSyllable
|
||||
{
|
||||
StartMs = c.StartMs,
|
||||
EndMs = c.EndMs,
|
||||
@@ -157,7 +157,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
StartMs = line.StartMs,
|
||||
EndMs = line.EndMs,
|
||||
OriginalText = PhoneticHelper.ToRomaji(line.OriginalText),
|
||||
LyricsChars = line.LyricsChars.Select(c => new LyricsChar
|
||||
LyricsSyllables = line.LyricsSyllables.Select(c => new LyricsSyllable
|
||||
{
|
||||
StartMs = c.StartMs,
|
||||
EndMs = c.EndMs,
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public partial class FluidBackgroundRenderer : IDisposable
|
||||
{
|
||||
private PixelShaderEffect? _fluidEffect;
|
||||
private float _timeAccumulator = 0f;
|
||||
private Vector3 _c1, _c2, _c3, _c4;
|
||||
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
public double Opacity { get; set; } = 1.0;
|
||||
|
||||
public bool EnableLightWave { get; set; } = false;
|
||||
|
||||
public async Task LoadResourcesAsync()
|
||||
{
|
||||
Dispose();
|
||||
|
||||
try
|
||||
{
|
||||
var uri = new Uri("ms-appx:///Assets/FluidEffect.bin");
|
||||
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri);
|
||||
|
||||
using (var stream = await file.OpenReadAsync())
|
||||
{
|
||||
var buffer = new Windows.Storage.Streams.Buffer((uint)stream.Size);
|
||||
await stream.ReadAsync(buffer, (uint)stream.Size, Windows.Storage.Streams.InputStreamOptions.None);
|
||||
byte[] bytes = buffer.ToArray();
|
||||
|
||||
_fluidEffect = new PixelShaderEffect(bytes);
|
||||
|
||||
_fluidEffect.Properties["EnableLightWave"] = EnableLightWave;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[FluidRenderer] Load Failed: {ex.Message}");
|
||||
_fluidEffect = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateColors(Color c1, Color c2, Color c3, Color c4)
|
||||
{
|
||||
_c1 = c1.ToVector3RGB();
|
||||
_c2 = c2.ToVector3RGB();
|
||||
_c3 = c3.ToVector3RGB();
|
||||
_c4 = c4.ToVector3RGB();
|
||||
}
|
||||
|
||||
public void Update(TimeSpan deltaTime)
|
||||
{
|
||||
if (_fluidEffect == null || !IsEnabled) return;
|
||||
|
||||
_timeAccumulator += (float)deltaTime.TotalSeconds;
|
||||
|
||||
_fluidEffect.Properties["iTime"] = _timeAccumulator;
|
||||
|
||||
_fluidEffect.Properties["color1"] = _c1;
|
||||
_fluidEffect.Properties["color2"] = _c2;
|
||||
_fluidEffect.Properties["color3"] = _c3;
|
||||
_fluidEffect.Properties["color4"] = _c4;
|
||||
|
||||
_fluidEffect.Properties["EnableLightWave"] = EnableLightWave;
|
||||
}
|
||||
|
||||
public void Draw(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_fluidEffect == null || !IsEnabled || Opacity <= 0) return;
|
||||
|
||||
float pixelWidth = control.ConvertDipsToPixels((float)control.Size.Width, CanvasDpiRounding.Round);
|
||||
float pixelHeight = control.ConvertDipsToPixels((float)control.Size.Height, CanvasDpiRounding.Round);
|
||||
|
||||
_fluidEffect.Properties["Width"] = pixelWidth;
|
||||
_fluidEffect.Properties["Height"] = pixelHeight;
|
||||
|
||||
if (Opacity >= 1.0)
|
||||
{
|
||||
ds.DrawImage(_fluidEffect);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var opacityEffect = new OpacityEffect
|
||||
{
|
||||
Source = _fluidEffect,
|
||||
Opacity = (float)Opacity
|
||||
})
|
||||
{
|
||||
ds.DrawImage(opacityEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_fluidEffect?.Dispose();
|
||||
_fluidEffect = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using BetterLyrics.WinUI3.Shaders;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public partial class FogRenderer : IDisposable
|
||||
{
|
||||
private PixelShaderEffect<FogEffect>? _fogEffect;
|
||||
private float _timeAccumulator = 0f;
|
||||
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
|
||||
public void LoadResources()
|
||||
{
|
||||
Dispose();
|
||||
_fogEffect = new PixelShaderEffect<FogEffect>();
|
||||
}
|
||||
|
||||
public void Update(double deltaTime)
|
||||
{
|
||||
if (_fogEffect == null || !IsEnabled) return;
|
||||
_timeAccumulator += (float)deltaTime;
|
||||
}
|
||||
|
||||
public void Draw(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_fogEffect == null || !IsEnabled) return;
|
||||
|
||||
float width = control.ConvertDipsToPixels((float)control.Size.Width, CanvasDpiRounding.Round);
|
||||
float height = control.ConvertDipsToPixels((float)control.Size.Height, CanvasDpiRounding.Round);
|
||||
|
||||
_fogEffect.ConstantBuffer = new FogEffect(
|
||||
_timeAccumulator,
|
||||
new float2(width, height)
|
||||
);
|
||||
|
||||
ds.DrawImage(_fogEffect);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_fogEffect?.Dispose();
|
||||
_fogEffect = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.Geometry;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public class LyricsRenderer
|
||||
{
|
||||
private readonly PlayingLineRenderer _playingRenderer = new();
|
||||
private readonly UnplayingLineRenderer _unplayingRenderer = new();
|
||||
|
||||
private Matrix4x4 _threeDimMatrix = Matrix4x4.Identity;
|
||||
|
||||
public void Draw(
|
||||
ICanvasAnimatedControl control,
|
||||
CanvasDrawingSession ds,
|
||||
LyricsData? lyricsData,
|
||||
int playingLineIndex,
|
||||
int mouseHoverLineIndex,
|
||||
bool isMousePressing,
|
||||
int startVisibleIndex,
|
||||
int endVisibleIndex,
|
||||
double lyricsX,
|
||||
double lyricsY,
|
||||
double lyricsWidth,
|
||||
double lyricsHeight,
|
||||
double userScrollOffset,
|
||||
double lyricsOpacity,
|
||||
double playingLineTopOffsetFactor,
|
||||
LyricsWindowStatus windowStatus,
|
||||
Color strokeColor,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
Func<int, LinePlaybackState> getPlaybackState)
|
||||
{
|
||||
using (var opacityLayer = ds.CreateLayer((float)lyricsOpacity))
|
||||
{
|
||||
if (windowStatus.LyricsEffectSettings.Is3DLyricsEnabled)
|
||||
{
|
||||
using (var layer = new CanvasCommandList(control))
|
||||
{
|
||||
using (var layerDs = layer.CreateDrawingSession())
|
||||
{
|
||||
DrawLyrics(
|
||||
control,
|
||||
layerDs,
|
||||
lyricsData,
|
||||
playingLineIndex,
|
||||
mouseHoverLineIndex,
|
||||
isMousePressing,
|
||||
startVisibleIndex,
|
||||
endVisibleIndex,
|
||||
lyricsX,
|
||||
lyricsY,
|
||||
lyricsWidth,
|
||||
lyricsHeight,
|
||||
userScrollOffset,
|
||||
playingLineTopOffsetFactor,
|
||||
windowStatus,
|
||||
strokeColor,
|
||||
bgColor,
|
||||
fgColor,
|
||||
getPlaybackState);
|
||||
}
|
||||
|
||||
ds.DrawImage(new Transform3DEffect
|
||||
{
|
||||
Source = layer,
|
||||
TransformMatrix = _threeDimMatrix
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawLyrics(
|
||||
control,
|
||||
ds,
|
||||
lyricsData,
|
||||
playingLineIndex,
|
||||
mouseHoverLineIndex,
|
||||
isMousePressing,
|
||||
startVisibleIndex,
|
||||
endVisibleIndex,
|
||||
lyricsX,
|
||||
lyricsY,
|
||||
lyricsWidth,
|
||||
lyricsHeight,
|
||||
userScrollOffset,
|
||||
playingLineTopOffsetFactor,
|
||||
windowStatus,
|
||||
strokeColor,
|
||||
bgColor,
|
||||
fgColor,
|
||||
getPlaybackState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawLyrics(
|
||||
ICanvasAnimatedControl control,
|
||||
CanvasDrawingSession ds,
|
||||
LyricsData? lyricsData,
|
||||
int playingLineIndex,
|
||||
int mouseHoverLineIndex,
|
||||
bool isMousePressing,
|
||||
int startVisibleIndex,
|
||||
int endVisibleIndex,
|
||||
double lyricsX,
|
||||
double lyricsY,
|
||||
double lyricsWidth,
|
||||
double lyricsHeight,
|
||||
double userScrollOffset,
|
||||
double playingLineTopOffsetFactor,
|
||||
LyricsWindowStatus windowStatus,
|
||||
Color strokeColor,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
Func<int, LinePlaybackState> getPlaybackState)
|
||||
{
|
||||
if (lyricsData == null) return;
|
||||
|
||||
var currentPlayingLine = lyricsData.LyricsLines.ElementAtOrDefault(playingLineIndex);
|
||||
if (currentPlayingLine == null) return;
|
||||
|
||||
var effectSettings = windowStatus.LyricsEffectSettings;
|
||||
var styleSettings = windowStatus.LyricsStyleSettings;
|
||||
|
||||
var rotationY = currentPlayingLine.OriginalPosition.WithX(effectSettings.FanLyricsAngle < 0 ? (float)lyricsWidth : 0);
|
||||
|
||||
for (int i = startVisibleIndex; i <= endVisibleIndex; i++)
|
||||
{
|
||||
var line = lyricsData.LyricsLines.ElementAtOrDefault(i);
|
||||
if (line == null) continue;
|
||||
|
||||
if (line.OriginalCanvasTextLayout == null) continue;
|
||||
if (line.OriginalCanvasTextLayout.LayoutBounds.Width <= 0) continue;
|
||||
|
||||
double yOffset = line.YOffsetTransition.Value + userScrollOffset + lyricsY + lyricsHeight * playingLineTopOffsetFactor;
|
||||
|
||||
var transform =
|
||||
Matrix3x2.CreateScale((float)line.ScaleTransition.Value, line.CenterPosition) *
|
||||
Matrix3x2.CreateRotation((float)line.AngleTransition.Value, rotationY) *
|
||||
Matrix3x2.CreateTranslation((float)lyricsX, (float)yOffset);
|
||||
|
||||
ds.Transform = transform;
|
||||
|
||||
using (var textOnlyLayer = RenderBaseTextLayer(control, line, styleSettings.LyricsFontStrokeWidth, strokeColor, line.ColorTransition.Value))
|
||||
{
|
||||
if (i == playingLineIndex)
|
||||
{
|
||||
var state = getPlaybackState(i);
|
||||
|
||||
_playingRenderer.Draw(control, ds, textOnlyLayer, line, state, bgColor, fgColor, effectSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
_unplayingRenderer.Draw(ds, textOnlyLayer, line);
|
||||
}
|
||||
|
||||
if (i == mouseHoverLineIndex)
|
||||
{
|
||||
byte opacity = isMousePressing ? (byte)32 : (byte)16;
|
||||
double scale = isMousePressing ? 1.09 : 1.10;
|
||||
ds.FillRoundedRectangle(
|
||||
new Windows.Foundation.Rect(line.TopLeftPosition.ToPoint(), line.BottomRightPosition.ToPoint()).Scale(scale),
|
||||
8, 8, Color.FromArgb(opacity, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
ds.Transform = Matrix3x2.Identity;
|
||||
}
|
||||
}
|
||||
|
||||
private CanvasCommandList RenderBaseTextLayer(
|
||||
ICanvasResourceCreator resourceCreator,
|
||||
LyricsLine line,
|
||||
double strokeWidth,
|
||||
Color strokeColor,
|
||||
Color fillColor)
|
||||
{
|
||||
var commandList = new CanvasCommandList(resourceCreator);
|
||||
using (var clds = commandList.CreateDrawingSession())
|
||||
{
|
||||
if (strokeWidth > 0)
|
||||
{
|
||||
DrawGeometrySafely(clds, line.PhoneticCanvasGeometry, line.PhoneticPosition, strokeColor, strokeWidth);
|
||||
DrawGeometrySafely(clds, line.OriginalCanvasGeometry, line.OriginalPosition, strokeColor, strokeWidth);
|
||||
DrawGeometrySafely(clds, line.TranslatedCanvasGeometry, line.TranslatedPosition, strokeColor, strokeWidth);
|
||||
}
|
||||
|
||||
DrawTextLayoutSafely(clds, line.PhoneticCanvasTextLayout, line.PhoneticPosition, fillColor);
|
||||
DrawTextLayoutSafely(clds, line.OriginalCanvasTextLayout, line.OriginalPosition, fillColor);
|
||||
DrawTextLayoutSafely(clds, line.TranslatedCanvasTextLayout, line.TranslatedPosition, fillColor);
|
||||
}
|
||||
return commandList;
|
||||
}
|
||||
|
||||
private void DrawGeometrySafely(CanvasDrawingSession ds, CanvasGeometry? geo, Vector2 pos, Color color, double width)
|
||||
{
|
||||
if (geo == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
ds.DrawGeometry(geo, pos, color, (float)width);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
private void DrawTextLayoutSafely(CanvasDrawingSession ds, CanvasTextLayout? layout, Vector2 pos, Color color)
|
||||
{
|
||||
if (layout == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
ds.DrawTextLayout(layout, pos, color);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
public void CalculateLyrics3DMatrix(LyricsEffectSettings lyricsEffect, double lyricsX, double lyricsY, double lyricsWidth, double canvasHeight)
|
||||
{
|
||||
if (!lyricsEffect.Is3DLyricsEnabled) return;
|
||||
|
||||
Vector3 center = new(
|
||||
(float)(lyricsX + lyricsWidth / 2),
|
||||
(float)(lyricsY + canvasHeight / 2),
|
||||
0);
|
||||
|
||||
float rotationX = (float)(Math.PI * lyricsEffect.Lyrics3DXAngle / 180.0);
|
||||
float rotationY = (float)(Math.PI * lyricsEffect.Lyrics3DYAngle / 180.0);
|
||||
float rotationZ = (float)(Math.PI * lyricsEffect.Lyrics3DZAngle / 180.0);
|
||||
|
||||
Matrix4x4 rotation =
|
||||
Matrix4x4.CreateRotationX(rotationX) *
|
||||
Matrix4x4.CreateRotationY(rotationY) *
|
||||
Matrix4x4.CreateRotationZ(rotationZ);
|
||||
Matrix4x4 perspective = Matrix4x4.Identity;
|
||||
perspective.M34 = 1.0f / lyricsEffect.Lyrics3DDepth;
|
||||
|
||||
// 组合变换:
|
||||
// 1. 将中心移到原点
|
||||
// 2. 旋转
|
||||
// 3. 应用透视
|
||||
// 4. 将中心移回原位
|
||||
_threeDimMatrix =
|
||||
Matrix4x4.CreateTranslation(-center) *
|
||||
rotation *
|
||||
perspective *
|
||||
Matrix4x4.CreateTranslation(center);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// 2025/6/23 by Zhe Fang
|
||||
|
||||
using BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public sealed partial class LyricsRenderer : UserControl
|
||||
{
|
||||
public LyricsRendererViewModel ViewModel { get; set; }
|
||||
|
||||
public LyricsRenderer()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = Ioc.Default.GetRequiredService<LyricsRendererViewModel>();
|
||||
}
|
||||
|
||||
private void LyricsCanvas_Draw(Microsoft.Graphics.Canvas.UI.Xaml.ICanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedDrawEventArgs args)
|
||||
{
|
||||
ViewModel.Draw(sender, args.DrawingSession);
|
||||
}
|
||||
|
||||
private void LyricsCanvas_Update(Microsoft.Graphics.Canvas.UI.Xaml.ICanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedUpdateEventArgs args)
|
||||
{
|
||||
ViewModel.Update(sender, args);
|
||||
}
|
||||
|
||||
private void LyricsCanvas_Unloaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
LyricsCanvas.RemoveFromVisualTree();
|
||||
LyricsCanvas = null;
|
||||
}
|
||||
|
||||
private void LyricsCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
|
||||
{
|
||||
ViewModel.CreateResources(sender, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Brushes;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public class PlayingLineRenderer
|
||||
{
|
||||
public void Draw(
|
||||
ICanvasAnimatedControl control,
|
||||
CanvasDrawingSession ds,
|
||||
ICanvasImage textOnlyLayer,
|
||||
LyricsLine line,
|
||||
LinePlaybackState playbackState,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
LyricsEffectSettings settings)
|
||||
{
|
||||
DrawPhonetic(ds, textOnlyLayer, line);
|
||||
DrawOriginalText(control, ds, textOnlyLayer, line, playbackState, bgColor, fgColor, settings);
|
||||
DrawTranslated(ds, textOnlyLayer, line);
|
||||
}
|
||||
|
||||
private void DrawPhonetic(CanvasDrawingSession ds, ICanvasImage source, LyricsLine line)
|
||||
{
|
||||
if (line.PhoneticCanvasTextLayout == null) return;
|
||||
|
||||
var opacity = line.PhoneticOpacityTransition.Value;
|
||||
var blur = line.BlurAmountTransition.Value;
|
||||
var bounds = line.PhoneticCanvasTextLayout.LayoutBounds;
|
||||
|
||||
var destRect = new Rect(
|
||||
bounds.X + line.PhoneticPosition.X,
|
||||
bounds.Y + line.PhoneticPosition.Y,
|
||||
bounds.Width,
|
||||
bounds.Height
|
||||
);
|
||||
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = new GaussianBlurEffect
|
||||
{
|
||||
BlurAmount = (float)blur,
|
||||
Source = new CropEffect
|
||||
{
|
||||
Source = source,
|
||||
BorderMode = EffectBorderMode.Hard,
|
||||
SourceRectangle = destRect,
|
||||
},
|
||||
BorderMode = EffectBorderMode.Soft
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawTranslated(CanvasDrawingSession ds, ICanvasImage source, LyricsLine line)
|
||||
{
|
||||
if (line.TranslatedCanvasTextLayout == null) return;
|
||||
|
||||
var opacity = line.TranslatedOpacityTransition.Value;
|
||||
var blur = line.BlurAmountTransition.Value;
|
||||
var bounds = line.TranslatedCanvasTextLayout.LayoutBounds;
|
||||
|
||||
var destRect = new Rect(
|
||||
bounds.X + line.TranslatedPosition.X,
|
||||
bounds.Y + line.TranslatedPosition.Y,
|
||||
bounds.Width,
|
||||
bounds.Height
|
||||
);
|
||||
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = new GaussianBlurEffect
|
||||
{
|
||||
BlurAmount = (float)blur,
|
||||
Source = new CropEffect
|
||||
{
|
||||
Source = source,
|
||||
BorderMode = EffectBorderMode.Hard,
|
||||
SourceRectangle = destRect,
|
||||
},
|
||||
BorderMode = EffectBorderMode.Soft
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawOriginalText(
|
||||
ICanvasResourceCreator resourceCreator,
|
||||
CanvasDrawingSession ds,
|
||||
ICanvasImage source,
|
||||
LyricsLine line,
|
||||
LinePlaybackState state,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
LyricsEffectSettings settings)
|
||||
{
|
||||
if (line.OriginalCanvasTextLayout == null) return;
|
||||
|
||||
var curCharIndex = state.SyllableStartIndex + state.SyllableLength * state.SyllableProgress;
|
||||
float fadeWidth = (1f / Math.Max(1, line.OriginalText.Length)) * 0.5f;
|
||||
|
||||
var lineRegions = line.OriginalCanvasTextLayout.GetCharacterRegions(0, line.OriginalText.Length);
|
||||
|
||||
foreach (var subLineRegion in lineRegions)
|
||||
{
|
||||
DrawSubLineRegion(resourceCreator, ds, source, line, subLineRegion, curCharIndex, fadeWidth, bgColor, fgColor, state, settings);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSubLineRegion(
|
||||
ICanvasResourceCreator resourceCreator,
|
||||
CanvasDrawingSession ds,
|
||||
ICanvasImage source,
|
||||
LyricsLine line,
|
||||
CanvasTextLayoutRegion subLineRegion,
|
||||
double curCharIndex,
|
||||
float fadeWidth,
|
||||
Color bgColor,
|
||||
Color fgColor,
|
||||
LinePlaybackState state,
|
||||
LyricsEffectSettings settings)
|
||||
{
|
||||
var blur = line.BlurAmountTransition.Value;
|
||||
var playedOpacity = line.PlayedOriginalOpacityTransition.Value;
|
||||
var unplayedOpacity = line.UnplayedOriginalOpacityTransition.Value;
|
||||
|
||||
var subLineLayoutBounds = subLineRegion.LayoutBounds;
|
||||
Rect subLineRect = new(
|
||||
subLineLayoutBounds.X + line.OriginalPosition.X,
|
||||
subLineLayoutBounds.Y + line.OriginalPosition.Y,
|
||||
subLineLayoutBounds.Width,
|
||||
subLineLayoutBounds.Height
|
||||
);
|
||||
|
||||
using (var gradientLayer = new CanvasCommandList(resourceCreator))
|
||||
{
|
||||
using (var gradientLayerDs = gradientLayer.CreateDrawingSession())
|
||||
{
|
||||
float progressInRegion = (float)((curCharIndex - subLineRegion.CharacterIndex) / subLineRegion.CharacterCount);
|
||||
progressInRegion = Math.Clamp(progressInRegion, 0, 1 + fadeWidth);
|
||||
|
||||
var stop1 = fgColor.WithAlpha((byte)(255 * playedOpacity));
|
||||
var stop2 = bgColor.WithAlpha((byte)(255 * unplayedOpacity));
|
||||
|
||||
using (var gradientBrush = new CanvasLinearGradientBrush(resourceCreator,
|
||||
[
|
||||
new CanvasGradientStop { Position = 0, Color = stop1 },
|
||||
new CanvasGradientStop { Position = progressInRegion, Color = stop1 },
|
||||
// 这里做判断是防止子行未播放时左侧出现渐变的问题
|
||||
new CanvasGradientStop { Position = progressInRegion == 0 ? 0 : (progressInRegion + fadeWidth), Color = stop2 },
|
||||
new CanvasGradientStop { Position = 1 + fadeWidth, Color = stop2 }
|
||||
]))
|
||||
{
|
||||
gradientBrush.StartPoint = new Vector2((float)subLineRect.X, (float)subLineRect.Y);
|
||||
gradientBrush.EndPoint = new Vector2((float)(subLineRect.X + subLineRect.Width), (float)subLineRect.Y);
|
||||
gradientLayerDs.FillRectangle(subLineRect, gradientBrush);
|
||||
}
|
||||
}
|
||||
|
||||
// 这里 gradientLayer 上色的时候已经限制了 Rect 区域,不用再套一个 CropEffect
|
||||
using (var textWithOpacityLayer = new AlphaMaskEffect
|
||||
{
|
||||
Source = source,
|
||||
AlphaMask = gradientLayer
|
||||
})
|
||||
{
|
||||
if (!settings.IsLyricsFloatAnimationEnabled && !settings.IsLyricsGlowEffectEnabled && !settings.IsLyricsScaleEffectEnabled)
|
||||
{
|
||||
ds.DrawImage(textWithOpacityLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
int endCharIndex = subLineRegion.CharacterIndex + subLineRegion.CharacterCount;
|
||||
for (int i = subLineRegion.CharacterIndex; i < endCharIndex; i++)
|
||||
{
|
||||
DrawSingleCharacter(ds, line, i, curCharIndex, textWithOpacityLayer, state, settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSingleCharacter(
|
||||
CanvasDrawingSession ds,
|
||||
LyricsLine line,
|
||||
int charIndex,
|
||||
double exactProgressIndex,
|
||||
ICanvasImage source,
|
||||
LinePlaybackState state,
|
||||
LyricsEffectSettings settings)
|
||||
{
|
||||
var curCharIndexInt = (int)Math.Floor(exactProgressIndex);
|
||||
if (line.OriginalCanvasTextLayout == null) return;
|
||||
|
||||
var charRegions = line.OriginalCanvasTextLayout.GetCharacterRegions(charIndex, 1);
|
||||
if (charRegions.Length == 0) return;
|
||||
var charRegion = charRegions[0];
|
||||
var charLayoutBounds = charRegion.LayoutBounds;
|
||||
|
||||
var sourceCharRect = new Rect(
|
||||
charLayoutBounds.X + line.OriginalPosition.X,
|
||||
charLayoutBounds.Y + line.OriginalPosition.Y,
|
||||
charLayoutBounds.Width,
|
||||
charLayoutBounds.Height
|
||||
);
|
||||
|
||||
double floatOffset = 0;
|
||||
double scale = 1;
|
||||
double glow = 0;
|
||||
|
||||
bool drawGlow = false;
|
||||
|
||||
if (settings.IsLyricsFloatAnimationEnabled)
|
||||
{
|
||||
double targetFloatOffset = sourceCharRect.Height * 0.1;
|
||||
// 已经浮完了的
|
||||
if (charIndex < curCharIndexInt)
|
||||
{
|
||||
floatOffset = 0;
|
||||
}
|
||||
// 正在浮的
|
||||
else if (charIndex == curCharIndexInt)
|
||||
{
|
||||
var p = exactProgressIndex - curCharIndexInt;
|
||||
floatOffset = -targetFloatOffset + p * targetFloatOffset;
|
||||
}
|
||||
// 还没浮的
|
||||
else
|
||||
{
|
||||
floatOffset = -targetFloatOffset;
|
||||
}
|
||||
// 制造句间上浮过度动画,这里用任何一个 Transition 都行,主要是获取当前行的进入视野的 Progress
|
||||
floatOffset *= line.YOffsetTransition.Progress;
|
||||
}
|
||||
|
||||
var parentSyllable = line.LyricsSyllables.FirstOrDefault(x => x.StartIndex <= charIndex && charIndex < x.StartIndex + x.Text.Length);
|
||||
|
||||
if (parentSyllable != null && parentSyllable.IsLongDuration && parentSyllable.StartIndex == state.SyllableStartIndex)
|
||||
{
|
||||
if (settings.IsLyricsScaleEffectEnabled)
|
||||
{
|
||||
scale += Math.Sin(state.SyllableProgress * Math.PI) * 0.15;
|
||||
}
|
||||
if (settings.IsLyricsGlowEffectEnabled)
|
||||
{
|
||||
glow = Math.Sin(state.SyllableProgress * Math.PI) * sourceCharRect.Height * 0.2;
|
||||
drawGlow = true;
|
||||
}
|
||||
}
|
||||
|
||||
var destCharRect = sourceCharRect.Scale(scale).AddY(-floatOffset);
|
||||
|
||||
if (drawGlow)
|
||||
{
|
||||
var sourcePlayedCharRect = new Rect(
|
||||
sourceCharRect.X,
|
||||
sourceCharRect.Y,
|
||||
sourceCharRect.Width,
|
||||
sourceCharRect.Height
|
||||
);
|
||||
|
||||
if (charIndex == curCharIndexInt)
|
||||
{
|
||||
var p = exactProgressIndex - curCharIndexInt;
|
||||
sourcePlayedCharRect.Width *= p;
|
||||
}
|
||||
else if (charIndex > curCharIndexInt)
|
||||
{
|
||||
sourcePlayedCharRect.Width = 0;
|
||||
}
|
||||
|
||||
using (var glowEffect = new GaussianBlurEffect
|
||||
{
|
||||
Source = new CropEffect
|
||||
{
|
||||
Source = source,
|
||||
SourceRectangle = sourcePlayedCharRect,
|
||||
BorderMode = EffectBorderMode.Hard
|
||||
},
|
||||
BlurAmount = (float)glow,
|
||||
BorderMode = EffectBorderMode.Soft
|
||||
})
|
||||
{
|
||||
ds.DrawImage(glowEffect, destCharRect.Extend(sourceCharRect.Height), sourceCharRect.Extend(sourceCharRect.Height));
|
||||
}
|
||||
}
|
||||
|
||||
ds.DrawImage(source, destCharRect, sourceCharRect);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public class PureColorBackgroundRenderer
|
||||
{
|
||||
public void Draw(
|
||||
CanvasDrawingSession ds,
|
||||
Rect bounds,
|
||||
Color color,
|
||||
double opacity,
|
||||
bool isEnabled)
|
||||
{
|
||||
if (!isEnabled || opacity <= 0) return;
|
||||
|
||||
ds.FillRectangle(
|
||||
bounds,
|
||||
color.WithAlpha((byte)(opacity * 255))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using BetterLyrics.WinUI3.Shaders;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using System;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public partial class SnowRenderer : IDisposable
|
||||
{
|
||||
private PixelShaderEffect<SnowEffect>? _snowEffect;
|
||||
private float _timeAccumulator = 0f;
|
||||
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
public float Amount { get; set; } = 0.5f;
|
||||
public float Speed { get; set; } = 1.0f;
|
||||
|
||||
public void LoadResources()
|
||||
{
|
||||
Dispose();
|
||||
_snowEffect = new PixelShaderEffect<SnowEffect>();
|
||||
}
|
||||
|
||||
public void Update(double deltaTime)
|
||||
{
|
||||
if (_snowEffect == null || !IsEnabled) return;
|
||||
_timeAccumulator += (float)deltaTime;
|
||||
}
|
||||
|
||||
public void Draw(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_snowEffect == null || !IsEnabled) return;
|
||||
|
||||
float width = control.ConvertDipsToPixels((float)control.Size.Width, CanvasDpiRounding.Round);
|
||||
float height = control.ConvertDipsToPixels((float)control.Size.Height, CanvasDpiRounding.Round);
|
||||
|
||||
_snowEffect.ConstantBuffer = new SnowEffect(
|
||||
_timeAccumulator,
|
||||
new float2(width, height),
|
||||
Amount, // 0.0 ~ 1.0
|
||||
Speed
|
||||
);
|
||||
|
||||
ds.DrawImage(_snowEffect);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_snowEffect?.Dispose();
|
||||
_snowEffect = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Brushes;
|
||||
using Microsoft.Graphics.Canvas.Geometry;
|
||||
using Microsoft.UI;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public partial class SpectrumRenderer : IDisposable
|
||||
{
|
||||
private CanvasGeometry? _spectrumGeometry;
|
||||
|
||||
public void Draw(
|
||||
ICanvasResourceCreator resourceCreator,
|
||||
CanvasDrawingSession ds,
|
||||
float[]? spectrumData,
|
||||
int barCount,
|
||||
bool isEnabled,
|
||||
SpectrumPlacement placement,
|
||||
SpectrumStyle style,
|
||||
double canvasWidth,
|
||||
double canvasHeight,
|
||||
Color fillColor
|
||||
)
|
||||
{
|
||||
_spectrumGeometry?.Dispose();
|
||||
_spectrumGeometry = null;
|
||||
|
||||
if (!isEnabled || spectrumData == null || spectrumData.Length == 0) return;
|
||||
|
||||
_spectrumGeometry = CreateGeometry(resourceCreator, spectrumData, barCount, placement, style, canvasWidth, canvasHeight);
|
||||
|
||||
if (_spectrumGeometry != null)
|
||||
{
|
||||
DrawGeometry(ds, _spectrumGeometry, fillColor, placement, canvasHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private CanvasGeometry? CreateGeometry(
|
||||
ICanvasResourceCreator creator,
|
||||
float[] data,
|
||||
int barCount,
|
||||
SpectrumPlacement placement,
|
||||
SpectrumStyle style,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
if (barCount < 2) return null;
|
||||
|
||||
float maxDataVal = 0;
|
||||
|
||||
int checkCount = Math.Min(barCount, data.Length);
|
||||
for (int i = 0; i < checkCount; i++)
|
||||
{
|
||||
if (data[i] > maxDataVal) maxDataVal = data[i];
|
||||
}
|
||||
|
||||
float limitY = (float)height * 0.2f; // 高度限制为总高度的 20%
|
||||
float scaleRatio = 1.0f;
|
||||
|
||||
if (maxDataVal > limitY)
|
||||
{
|
||||
scaleRatio = limitY / maxDataVal;
|
||||
}
|
||||
|
||||
using var pathBuilder = new CanvasPathBuilder(creator);
|
||||
|
||||
if (style == SpectrumStyle.Bar)
|
||||
{
|
||||
float totalStep = (float)width / barCount;
|
||||
float gap = 2.0f;
|
||||
float barWidth = totalStep - gap;
|
||||
if (barWidth < 1.0f) { barWidth = totalStep; gap = 0f; }
|
||||
|
||||
for (int i = 0; i < barCount; i++)
|
||||
{
|
||||
float rawVal = i < data.Length ? data[i] : 0;
|
||||
float barHeight = rawVal * scaleRatio;
|
||||
if (barHeight < 0.5f) continue;
|
||||
|
||||
float x = i * totalStep;
|
||||
float topY, bottomY;
|
||||
|
||||
if (placement == SpectrumPlacement.Top)
|
||||
{
|
||||
topY = 0;
|
||||
bottomY = barHeight;
|
||||
}
|
||||
else // Bottom
|
||||
{
|
||||
topY = (float)height - barHeight;
|
||||
bottomY = (float)height;
|
||||
}
|
||||
|
||||
// 绘制独立矩形
|
||||
pathBuilder.BeginFigure(new Vector2(x, topY));
|
||||
pathBuilder.AddLine(new Vector2(x + barWidth, topY));
|
||||
pathBuilder.AddLine(new Vector2(x + barWidth, bottomY));
|
||||
pathBuilder.AddLine(new Vector2(x, bottomY));
|
||||
pathBuilder.EndFigure(CanvasFigureLoop.Closed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var points = new Vector2[barCount];
|
||||
float pointSpacing = (float)width / (barCount - 1);
|
||||
|
||||
for (int i = 0; i < barCount; i++)
|
||||
{
|
||||
float rawVal = i < data.Length ? data[i] : 0;
|
||||
float y = rawVal * scaleRatio;
|
||||
|
||||
// 处理翻转
|
||||
if (placement == SpectrumPlacement.Bottom)
|
||||
{
|
||||
y = (float)height - y;
|
||||
}
|
||||
|
||||
points[i] = new Vector2(i * pointSpacing, y);
|
||||
}
|
||||
|
||||
// 绘制曲线
|
||||
pathBuilder.BeginFigure(points[0]);
|
||||
|
||||
for (int i = 0; i < barCount - 1; i++)
|
||||
{
|
||||
Vector2 p0 = points[Math.Max(i - 1, 0)];
|
||||
Vector2 p1 = points[i];
|
||||
Vector2 p2 = points[i + 1];
|
||||
Vector2 p3 = points[Math.Min(i + 2, barCount - 1)];
|
||||
|
||||
Vector2 cp1 = p1 + (p2 - p0) / 6.0f;
|
||||
Vector2 cp2 = p2 - (p3 - p1) / 6.0f;
|
||||
|
||||
pathBuilder.AddCubicBezier(cp1, cp2, p2);
|
||||
}
|
||||
|
||||
// 封口
|
||||
if (placement == SpectrumPlacement.Top)
|
||||
{
|
||||
pathBuilder.AddLine(new Vector2(points[barCount - 1].X, 0));
|
||||
pathBuilder.AddLine(new Vector2(points[0].X, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
pathBuilder.AddLine(new Vector2(points[barCount - 1].X, (float)height));
|
||||
pathBuilder.AddLine(new Vector2(points[0].X, (float)height));
|
||||
}
|
||||
|
||||
pathBuilder.EndFigure(CanvasFigureLoop.Closed);
|
||||
}
|
||||
|
||||
return CanvasGeometry.CreatePath(pathBuilder);
|
||||
}
|
||||
|
||||
private void DrawGeometry(
|
||||
CanvasDrawingSession ds,
|
||||
CanvasGeometry geometry,
|
||||
Color color,
|
||||
SpectrumPlacement placement,
|
||||
double height)
|
||||
{
|
||||
var stops = new CanvasGradientStop[]
|
||||
{
|
||||
new() { Position = 0.0f, Color = Colors.Transparent },
|
||||
new() { Position = 0.7f, Color = Colors.Transparent },
|
||||
new() { Position = 1.0f, Color = color }
|
||||
};
|
||||
|
||||
using var brush = new CanvasLinearGradientBrush(ds, stops);
|
||||
|
||||
if (placement == SpectrumPlacement.Top)
|
||||
{
|
||||
brush.StartPoint = new Vector2(0, (float)height);
|
||||
brush.EndPoint = new Vector2(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
brush.StartPoint = new Vector2(0, 0);
|
||||
brush.EndPoint = new Vector2(0, (float)height);
|
||||
}
|
||||
|
||||
ds.FillGeometry(geometry, brush);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_spectrumGeometry?.Dispose();
|
||||
_spectrumGeometry = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Renderer
|
||||
{
|
||||
public class UnplayingLineRenderer
|
||||
{
|
||||
public void Draw(
|
||||
CanvasDrawingSession ds,
|
||||
ICanvasImage textOnlyLayer,
|
||||
LyricsLine line)
|
||||
{
|
||||
var blurAmount = (float)line.BlurAmountTransition.Value;
|
||||
|
||||
if (line.PhoneticCanvasTextLayout != null)
|
||||
{
|
||||
var opacity = line.PhoneticOpacityTransition.Value;
|
||||
DrawPart(ds, textOnlyLayer,
|
||||
line.PhoneticCanvasTextLayout,
|
||||
line.PhoneticPosition,
|
||||
blurAmount,
|
||||
(float)opacity);
|
||||
}
|
||||
|
||||
if (line.OriginalCanvasTextLayout != null)
|
||||
{
|
||||
double opacity;
|
||||
if (line.PlayedOriginalOpacityTransition.StartValue > line.UnplayedOriginalOpacityTransition.StartValue)
|
||||
{
|
||||
opacity = line.PlayedOriginalOpacityTransition.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
opacity = line.UnplayedOriginalOpacityTransition.Value;
|
||||
}
|
||||
DrawPart(ds, textOnlyLayer,
|
||||
line.OriginalCanvasTextLayout,
|
||||
line.OriginalPosition,
|
||||
blurAmount,
|
||||
(float)opacity);
|
||||
}
|
||||
|
||||
if (line.TranslatedCanvasTextLayout != null)
|
||||
{
|
||||
var opacity = line.TranslatedOpacityTransition.Value;
|
||||
DrawPart(ds, textOnlyLayer,
|
||||
line.TranslatedCanvasTextLayout,
|
||||
line.TranslatedPosition,
|
||||
blurAmount,
|
||||
(float)opacity);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPart(
|
||||
CanvasDrawingSession ds,
|
||||
ICanvasImage source,
|
||||
CanvasTextLayout layout,
|
||||
Vector2 position,
|
||||
float blur,
|
||||
float opacity)
|
||||
{
|
||||
if (opacity <= 0) return;
|
||||
|
||||
var bounds = layout.LayoutBounds;
|
||||
var destRect = new Rect(
|
||||
bounds.X + position.X,
|
||||
bounds.Y + position.Y,
|
||||
bounds.Width,
|
||||
bounds.Height
|
||||
);
|
||||
|
||||
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = new GaussianBlurEffect
|
||||
{
|
||||
BlurAmount = blur,
|
||||
Source = new CropEffect
|
||||
{
|
||||
Source = source,
|
||||
SourceRectangle = destRect,
|
||||
BorderMode = EffectBorderMode.Hard,
|
||||
},
|
||||
BorderMode = EffectBorderMode.Soft
|
||||
},
|
||||
Opacity = opacity
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,21 +45,21 @@ namespace BetterLyrics.WinUI3.Services.LiveStatesService
|
||||
|
||||
LiveStates.LyricsWindowStatus.UpdateMonitorBounds();
|
||||
|
||||
WindowHook.SetIsWorkArea<LyricsWindow>(LiveStates.LyricsWindowStatus.IsWorkArea);
|
||||
WindowHook.SetIsWorkArea<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsWorkArea);
|
||||
if (LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
WindowHook.UpdateWorkArea<LyricsWindow>();
|
||||
WindowHook.UpdateWorkArea<NowPlayingWindow>();
|
||||
}
|
||||
await Task.Delay(300);
|
||||
|
||||
WindowHook.SetIsShowInSwitchers<LyricsWindow>(LiveStates.LyricsWindowStatus.IsShownInSwitchers);
|
||||
WindowHook.SetIsAlwaysOnTop<LyricsWindow>(LiveStates.LyricsWindowStatus.IsAlwaysOnTop);
|
||||
WindowHook.SetIsShowInSwitchers<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsShownInSwitchers);
|
||||
WindowHook.SetIsAlwaysOnTop<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsAlwaysOnTop);
|
||||
|
||||
WindowHook.SetIsClickThrough<LyricsWindow>(LiveStates.LyricsWindowStatus.IsClickThrough);
|
||||
WindowHook.SetIsBorderless<LyricsWindow>(LiveStates.LyricsWindowStatus.IsBorderless);
|
||||
WindowHook.SetIsClickThrough<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsClickThrough);
|
||||
WindowHook.SetIsBorderless<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsBorderless);
|
||||
|
||||
WindowHook.SetLyricsWindowVisibilityByPlayingStatus(_dispatcherQueue);
|
||||
WindowHook.SetTitleBarArea<LyricsWindow>(LiveStates.LyricsWindowStatus.TitleBarArea);
|
||||
WindowHook.SetTitleBarArea<NowPlayingWindow>(LiveStates.LyricsWindowStatus.TitleBarArea);
|
||||
|
||||
// 下述代码可以删除,但是为了避免给用户造成操作上的疑虑,暂时保留
|
||||
if (LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
@@ -67,7 +67,7 @@ namespace BetterLyrics.WinUI3.Services.LiveStatesService
|
||||
LiveStates.LyricsWindowStatus.WindowBounds = LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea();
|
||||
}
|
||||
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.WindowBounds);
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.WindowBounds);
|
||||
LiveStates.LyricsWindowStatus.WindowX = LiveStates.LyricsWindowStatus.WindowBounds.X;
|
||||
LiveStates.LyricsWindowStatus.WindowY = LiveStates.LyricsWindowStatus.WindowBounds.Y;
|
||||
LiveStates.LyricsWindowStatus.WindowWidth = LiveStates.LyricsWindowStatus.WindowBounds.Width;
|
||||
@@ -84,11 +84,11 @@ namespace BetterLyrics.WinUI3.Services.LiveStatesService
|
||||
{
|
||||
case nameof(LyricsWindowStatus.IsWorkArea):
|
||||
LiveStates.IsLyricsWindowStatusRefreshing = true;
|
||||
WindowHook.SetIsWorkArea<LyricsWindow>(LiveStates.LyricsWindowStatus.IsWorkArea);
|
||||
WindowHook.SetIsWorkArea<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsWorkArea);
|
||||
LiveStates.IsLyricsWindowStatusRefreshing = false;
|
||||
if (LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
}
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.DockHeight):
|
||||
@@ -98,37 +98,37 @@ namespace BetterLyrics.WinUI3.Services.LiveStatesService
|
||||
if (LiveStates.LyricsWindowStatus.IsWorkArea)
|
||||
{
|
||||
LiveStates.IsLyricsWindowStatusRefreshing = true;
|
||||
WindowHook.UpdateWorkArea<LyricsWindow>();
|
||||
WindowHook.UpdateWorkArea<NowPlayingWindow>();
|
||||
LiveStates.IsLyricsWindowStatusRefreshing = false;
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.GetWindowBoundsWhenWorkArea());
|
||||
}
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.IsShownInSwitchers):
|
||||
WindowHook.SetIsShowInSwitchers<LyricsWindow>(LiveStates.LyricsWindowStatus.IsShownInSwitchers);
|
||||
WindowHook.SetIsShowInSwitchers<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsShownInSwitchers);
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.IsAlwaysOnTop):
|
||||
WindowHook.SetIsAlwaysOnTop<LyricsWindow>(LiveStates.LyricsWindowStatus.IsAlwaysOnTop);
|
||||
WindowHook.SetIsAlwaysOnTop<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsAlwaysOnTop);
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.IsClickThrough):
|
||||
WindowHook.SetIsClickThrough<LyricsWindow>(LiveStates.LyricsWindowStatus.IsClickThrough);
|
||||
WindowHook.SetIsClickThrough<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsClickThrough);
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.IsBorderless):
|
||||
WindowHook.SetIsBorderless<LyricsWindow>(LiveStates.LyricsWindowStatus.IsBorderless);
|
||||
WindowHook.SetIsBorderless<NowPlayingWindow>(LiveStates.LyricsWindowStatus.IsBorderless);
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.WindowX):
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithX(LiveStates.LyricsWindowStatus.WindowX));
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithX(LiveStates.LyricsWindowStatus.WindowX));
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.WindowY):
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithY(LiveStates.LyricsWindowStatus.WindowY));
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithY(LiveStates.LyricsWindowStatus.WindowY));
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.WindowWidth):
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithWidth(LiveStates.LyricsWindowStatus.WindowWidth));
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithWidth(LiveStates.LyricsWindowStatus.WindowWidth));
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.WindowHeight):
|
||||
WindowHook.MoveAndResize<LyricsWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithHeight(LiveStates.LyricsWindowStatus.WindowHeight));
|
||||
WindowHook.MoveAndResize<NowPlayingWindow>(LiveStates.LyricsWindowStatus.WindowBounds.WithHeight(LiveStates.LyricsWindowStatus.WindowHeight));
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.TitleBarArea):
|
||||
WindowHook.SetTitleBarArea<LyricsWindow>(LiveStates.LyricsWindowStatus.TitleBarArea);
|
||||
WindowHook.SetTitleBarArea<NowPlayingWindow>(LiveStates.LyricsWindowStatus.TitleBarArea);
|
||||
break;
|
||||
case nameof(LyricsWindowStatus.AutoShowOrHideWindow):
|
||||
WindowHook.SetLyricsWindowVisibilityByPlayingStatus(_dispatcherQueue);
|
||||
|
||||
@@ -562,7 +562,11 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
|
||||
ISearchResult? result;
|
||||
if (searcher == Searchers.Netease && songInfo.SongId != null)
|
||||
{
|
||||
result = new NeteaseSearchResult(songInfo.Title, songInfo.Artists, songInfo.Album, songInfo.Artists, (int)songInfo.DurationMs, songInfo.SongId);
|
||||
result = new NeteaseSearchResult("", [], "", [], 0, songInfo.SongId);
|
||||
}
|
||||
else if (searcher == Searchers.QQMusic && songInfo.SongId != null)
|
||||
{
|
||||
result = new QQMusicSearchResult("", [], "", [], 0, songInfo.SongId, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -592,7 +596,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
|
||||
|
||||
lyricsSearchResult.Raw = response?.Lrc?.Lyric;
|
||||
lyricsSearchResult.Translation = response?.Tlyric?.Lyric;
|
||||
lyricsSearchResult.Transliteration = response?.Romalrc.Lyric;
|
||||
lyricsSearchResult.Transliteration = response?.Romalrc?.Lyric;
|
||||
lyricsSearchResult.Reference = $"https://music.163.com/song?id={neteaseResult.Id}";
|
||||
}
|
||||
else if (result is KugouSearchResult kugouResult)
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Events;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
{
|
||||
@@ -21,6 +19,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
Task PreviousAsync();
|
||||
Task NextAsync();
|
||||
Task ChangePosition(double seconds);
|
||||
Task ChangeLyricsLine(int index);
|
||||
|
||||
void UpdateLyrics();
|
||||
void UpdateTranslations();
|
||||
@@ -34,9 +33,8 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
TimeSpan CurrentPosition { get; }
|
||||
LyricsData? CurrentLyricsData { get; }
|
||||
|
||||
SoftwareBitmap? SoftwareBitmap { get; }
|
||||
List<Color> LightAccentColors { get; }
|
||||
List<Color> DarkAccentColors { get; }
|
||||
BitmapImage? AlbumArtBitmapImage { get; }
|
||||
AlbumArtThemeColors AlbumArtThemeColors { get; }
|
||||
|
||||
TranslationSearchProvider? TranslationSearchProvider { get; }
|
||||
LyricsSearchResult? CurrentLyricsSearchResult { get; }
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -17,9 +22,12 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
{
|
||||
private readonly LatestOnlyTaskRunner _albumArtRefreshRunner = new();
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial SoftwareBitmap? SoftwareBitmap { get; set; }
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial List<Color> LightAccentColors { get; set; } = Enumerable.Repeat(Colors.Black, 4).ToList();
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial List<Color> DarkAccentColors { get; set; } = Enumerable.Repeat(Colors.Black, 4).ToList();
|
||||
private Color _envColor = Colors.Transparent;
|
||||
private List<Color> _lightAccentColors = Enumerable.Repeat(Colors.Black, 4).ToList();
|
||||
private List<Color> _darkAccentColors = Enumerable.Repeat(Colors.Black, 4).ToList();
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial BitmapImage? AlbumArtBitmapImage { get; set; }
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial AlbumArtThemeColors AlbumArtThemeColors { get; set; } = new();
|
||||
|
||||
private void UpdateAlbumArt()
|
||||
{
|
||||
@@ -54,19 +62,143 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
decoder = await ImageHelper.MakeSquareWithThemeColor(buffer, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PaletteGeneratorType);
|
||||
if (token.IsCancellationRequested) return;
|
||||
|
||||
var albumArtSwBitmap = await decoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Rgba8, BitmapAlphaMode.Premultiplied);
|
||||
if (token.IsCancellationRequested) return;
|
||||
|
||||
albumArtSwBitmap.DpiX = 96;
|
||||
albumArtSwBitmap.DpiY = 96;
|
||||
|
||||
var lightPalette = await ImageHelper.GetAccentColorsAsync(decoder, 4, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PaletteGeneratorType, false);
|
||||
var darkPalette = await ImageHelper.GetAccentColorsAsync(decoder, 4, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PaletteGeneratorType, true);
|
||||
if (token.IsCancellationRequested) return;
|
||||
|
||||
SoftwareBitmap = albumArtSwBitmap;
|
||||
LightAccentColors = lightPalette.Palette.Select(Helper.ColorHelper.FromVector3).ToList();
|
||||
DarkAccentColors = darkPalette.Palette.Select(Helper.ColorHelper.FromVector3).ToList();
|
||||
var bitmapImage = new BitmapImage();
|
||||
await bitmapImage.SetSourceAsync(ImageHelper.ToIRandomAccessStream(buffer));
|
||||
if (token.IsCancellationRequested) return;
|
||||
|
||||
_lightAccentColors = lightPalette.Palette.Select(Helper.ColorHelper.FromVector3).ToList();
|
||||
_darkAccentColors = darkPalette.Palette.Select(Helper.ColorHelper.FromVector3).ToList();
|
||||
|
||||
UpdateAlbumArtThemeColors();
|
||||
|
||||
AlbumArtBitmapImage = bitmapImage;
|
||||
}
|
||||
|
||||
private void UpdateAlbumArtThemeColors()
|
||||
{
|
||||
var status = _liveStatesService.LiveStates.LyricsWindowStatus;
|
||||
var result = new AlbumArtThemeColors();
|
||||
result.EnvColor = _envColor;
|
||||
|
||||
ElementTheme themeTypeSent;
|
||||
if (status.IsAdaptToEnvironment)
|
||||
{
|
||||
themeTypeSent = Helper.ColorHelper.GetElementThemeFromBackgroundColor(result.EnvColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
themeTypeSent = status.LyricsBackgroundSettings.LyricsBackgroundTheme;
|
||||
}
|
||||
|
||||
bool isLight = themeTypeSent switch
|
||||
{
|
||||
ElementTheme.Default => Application.Current.RequestedTheme == ApplicationTheme.Light,
|
||||
ElementTheme.Light => true,
|
||||
ElementTheme.Dark => false,
|
||||
_ => false
|
||||
};
|
||||
|
||||
Color adaptiveGrayedFontColor;
|
||||
Color grayedEnvironmentalColor;
|
||||
Color? adaptiveColoredFontColor;
|
||||
|
||||
Color darkColor = Colors.Black;
|
||||
Color lightColor = Colors.White;
|
||||
|
||||
if (isLight)
|
||||
{
|
||||
adaptiveGrayedFontColor = darkColor;
|
||||
// brightness = 0.7f;
|
||||
grayedEnvironmentalColor = lightColor;
|
||||
|
||||
result.AccentColor1 = _lightAccentColors.ElementAtOrDefault(0);
|
||||
result.AccentColor2 = _lightAccentColors.ElementAtOrDefault(1);
|
||||
result.AccentColor3 = _lightAccentColors.ElementAtOrDefault(2);
|
||||
result.AccentColor4 = _lightAccentColors.ElementAtOrDefault(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
adaptiveGrayedFontColor = lightColor;
|
||||
// brightness = 0.3f;
|
||||
grayedEnvironmentalColor = darkColor;
|
||||
|
||||
result.AccentColor1 = _darkAccentColors.ElementAtOrDefault(0);
|
||||
result.AccentColor2 = _darkAccentColors.ElementAtOrDefault(1);
|
||||
result.AccentColor3 = _darkAccentColors.ElementAtOrDefault(2);
|
||||
result.AccentColor4 = _darkAccentColors.ElementAtOrDefault(3);
|
||||
}
|
||||
|
||||
if (status.IsAdaptToEnvironment)
|
||||
{
|
||||
adaptiveColoredFontColor = Helper.ColorHelper.GetForegroundColor(result.EnvColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isLight)
|
||||
adaptiveColoredFontColor = _darkAccentColors.ElementAtOrDefault(0);
|
||||
else
|
||||
adaptiveColoredFontColor = _lightAccentColors.ElementAtOrDefault(0);
|
||||
}
|
||||
|
||||
result.ThemeType = themeTypeSent;
|
||||
|
||||
// 背景字色
|
||||
switch (status.LyricsStyleSettings.LyricsBgFontColorType)
|
||||
{
|
||||
case LyricsFontColorType.AdaptiveGrayed:
|
||||
result.BgFontColor = adaptiveGrayedFontColor;
|
||||
break;
|
||||
case LyricsFontColorType.AdaptiveColored:
|
||||
result.BgFontColor = adaptiveColoredFontColor ?? adaptiveGrayedFontColor;
|
||||
break;
|
||||
case LyricsFontColorType.Custom:
|
||||
result.BgFontColor = status.LyricsStyleSettings.LyricsCustomBgFontColor;
|
||||
break;
|
||||
default:
|
||||
result.BgFontColor = adaptiveGrayedFontColor;
|
||||
break;
|
||||
}
|
||||
|
||||
// 前景字色
|
||||
switch (status.LyricsStyleSettings.LyricsFgFontColorType)
|
||||
{
|
||||
case LyricsFontColorType.AdaptiveGrayed:
|
||||
result.FgFontColor = adaptiveGrayedFontColor;
|
||||
break;
|
||||
case LyricsFontColorType.AdaptiveColored:
|
||||
result.FgFontColor = adaptiveColoredFontColor ?? adaptiveGrayedFontColor;
|
||||
break;
|
||||
case LyricsFontColorType.Custom:
|
||||
result.FgFontColor = status.LyricsStyleSettings.LyricsCustomFgFontColor;
|
||||
break;
|
||||
default:
|
||||
result.FgFontColor = adaptiveGrayedFontColor;
|
||||
break;
|
||||
}
|
||||
|
||||
// 描边颜色
|
||||
switch (status.LyricsStyleSettings.LyricsStrokeFontColorType)
|
||||
{
|
||||
case LyricsFontColorType.AdaptiveGrayed:
|
||||
result.StrokeFontColor = grayedEnvironmentalColor.WithBrightness(0.7);
|
||||
break;
|
||||
case LyricsFontColorType.AdaptiveColored:
|
||||
result.StrokeFontColor = result.EnvColor.WithBrightness(0.7);
|
||||
break;
|
||||
case LyricsFontColorType.Custom:
|
||||
result.StrokeFontColor = status.LyricsStyleSettings.LyricsCustomStrokeFontColor;
|
||||
break;
|
||||
default:
|
||||
result.StrokeFontColor = Colors.Transparent;
|
||||
break;
|
||||
}
|
||||
|
||||
AlbumArtThemeColors = result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ using BetterLyrics.WinUI3.Parsers.LyricsParser;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Lyricify.Lyrics.Helpers.General;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -25,7 +24,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
private int _langIndex = 0;
|
||||
private List<LyricsData> _lyricsDataArr = [];
|
||||
|
||||
public LyricsData? CurrentLyricsData => _lyricsDataArr.ElementAtOrDefault(_langIndex);
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsData? CurrentLyricsData { get; private set; }
|
||||
|
||||
public event EventHandler<LyricsChangedEventArgs>? LyricsChanged;
|
||||
|
||||
@@ -35,15 +34,17 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
[ObservableProperty] public partial bool IsTranslating { get; set; } = false;
|
||||
|
||||
private void SetCurrentLyricsData()
|
||||
{
|
||||
CurrentLyricsData = _lyricsDataArr.ElementAtOrDefault(_langIndex);
|
||||
}
|
||||
|
||||
private async Task RefreshTranslationAsync(CancellationToken token)
|
||||
{
|
||||
TranslationSearchProvider = null;
|
||||
_lyricsDataArr.ElementAtOrDefault(0)?.ClearTranslatedText();
|
||||
|
||||
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
|
||||
{
|
||||
LyricsChanged?.Invoke(this, new LyricsChangedEventArgs(CurrentLyricsData));
|
||||
});
|
||||
App.Current.Resources.DispatcherQueue.TryEnqueue(SetCurrentLyricsData);
|
||||
|
||||
IsTranslating = true;
|
||||
|
||||
@@ -53,10 +54,8 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
IsTranslating = false;
|
||||
|
||||
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
|
||||
{
|
||||
LyricsChanged?.Invoke(this, new LyricsChangedEventArgs(CurrentLyricsData));
|
||||
});
|
||||
App.Current.Resources.DispatcherQueue.TryEnqueue(SetCurrentLyricsData);
|
||||
|
||||
}
|
||||
|
||||
private async Task SetTranslatedTextAsync(CancellationToken token)
|
||||
@@ -86,7 +85,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
{
|
||||
_logger.LogInformation("Found translated text in lyrics data at index {FoundIndex}", found);
|
||||
|
||||
_lyricsDataArr.FirstOrDefault()?.SetTranslatedText(_lyricsDataArr[found], _liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsTranslationSeparator, 50);
|
||||
_lyricsDataArr.FirstOrDefault()?.SetTranslatedText(_lyricsDataArr[found], 50);
|
||||
TranslationSearchProvider = CurrentLyricsSearchResult?.Provider.ToTranslationSearchProvider();
|
||||
}
|
||||
else if (_settingsService.AppSettings.TranslationSettings.IsLibreTranslateEnabled)
|
||||
@@ -99,7 +98,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
if (token.IsCancellationRequested) return;
|
||||
if (translated == string.Empty) return;
|
||||
|
||||
_lyricsDataArr.FirstOrDefault()?.SetTranslation(translated, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsTranslationSeparator);
|
||||
_lyricsDataArr.FirstOrDefault()?.SetTranslation(translated);
|
||||
|
||||
TranslationSearchProvider = Enums.TranslationSearchProvider.LibreTranslate;
|
||||
}
|
||||
@@ -141,7 +140,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
if (found >= 0)
|
||||
{
|
||||
_logger.LogInformation("Found phonetic text in lyrics data at index {FoundIndex}", found);
|
||||
_lyricsDataArr.FirstOrDefault()?.SetPhoneticText(_lyricsDataArr[found], _liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsTranslationSeparator, 50);
|
||||
_lyricsDataArr.FirstOrDefault()?.SetPhoneticText(_lyricsDataArr[found], 50);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,10 +152,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
CurrentLyricsSearchResult = null;
|
||||
_lyricsDataArr = [LyricsData.GetLoadingPlaceholder()];
|
||||
|
||||
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
|
||||
{
|
||||
LyricsChanged?.Invoke(this, new LyricsChangedEventArgs(CurrentLyricsData));
|
||||
});
|
||||
App.Current.Resources.DispatcherQueue.TryEnqueue(SetCurrentLyricsData);
|
||||
|
||||
if (CurrentSongInfo != null)
|
||||
{
|
||||
@@ -179,10 +175,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
// Show original first while loading phonetic and translated
|
||||
ApplyChinesePreference();
|
||||
|
||||
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
|
||||
{
|
||||
LyricsChanged?.Invoke(this, new LyricsChangedEventArgs(CurrentLyricsData));
|
||||
});
|
||||
App.Current.Resources.DispatcherQueue.TryEnqueue(SetCurrentLyricsData);
|
||||
|
||||
UpdateTranslations();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ using BetterLyrics.WinUI3.Services.DiscordService;
|
||||
using BetterLyrics.WinUI3.Services.LibWatcherService;
|
||||
using BetterLyrics.WinUI3.Services.LiveStatesService;
|
||||
using BetterLyrics.WinUI3.Services.LyricsSearchService;
|
||||
using BetterLyrics.WinUI3.Services.ResourceService;
|
||||
using BetterLyrics.WinUI3.Services.SettingsService;
|
||||
using BetterLyrics.WinUI3.Services.TranslateService;
|
||||
using BetterLyrics.WinUI3.ViewModels;
|
||||
@@ -26,6 +25,7 @@ using CommunityToolkit.WinUI;
|
||||
using EvtSource;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -36,6 +36,7 @@ using System.Threading.Tasks;
|
||||
using Vanara.Windows.Shell;
|
||||
using Windows.Media.Control;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI;
|
||||
using WindowsMediaController;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
@@ -46,7 +47,10 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
IRecipient<PropertyChangedMessage<LyricsWindowStatus>>,
|
||||
IRecipient<PropertyChangedMessage<PaletteGeneratorType>>,
|
||||
IRecipient<PropertyChangedMessage<ChineseRomanization>>,
|
||||
IRecipient<PropertyChangedMessage<List<string>>>
|
||||
IRecipient<PropertyChangedMessage<List<string>>>,
|
||||
IRecipient<PropertyChangedMessage<Color>>,
|
||||
IRecipient<PropertyChangedMessage<ElementTheme>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsFontColorType>>
|
||||
{
|
||||
private EventSourceReader? _sse = null;
|
||||
private readonly MediaManager _mediaManager = new();
|
||||
@@ -59,7 +63,6 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
private readonly ILibWatcherService _libWatcherService;
|
||||
private readonly ILiveStatesService _liveStatesService;
|
||||
private readonly IDiscordService _discordService;
|
||||
private readonly IResourceService _resourceService;
|
||||
private readonly ILogger<MediaSessionsService> _logger;
|
||||
|
||||
private double _lxMusicPositionSeconds = 0;
|
||||
@@ -81,7 +84,6 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
ILiveStatesService liveStatesService,
|
||||
IDiscordService discordService,
|
||||
ITranslateService libreTranslateService,
|
||||
IResourceService resourceService,
|
||||
ILogger<MediaSessionsService> logger)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
@@ -91,7 +93,6 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
_translateService = libreTranslateService;
|
||||
_liveStatesService = liveStatesService;
|
||||
_discordService = discordService;
|
||||
_resourceService = resourceService;
|
||||
_logger = logger;
|
||||
|
||||
_onMediaPropsChangedTimer = _dispatcherQueue.CreateTimer();
|
||||
@@ -129,7 +130,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
private void UpdatePlayOrPauseSongShortcut()
|
||||
{
|
||||
GlobalHotKeyHook.UpdateHotKey<LyricsWindow>(ShortcutID.PlayOrPauseSong, _settingsService.AppSettings.GeneralSettings.PlayOrPauseShortcut, (() =>
|
||||
GlobalHotKeyHook.UpdateHotKey<NowPlayingWindow>(ShortcutID.PlayOrPauseSong, _settingsService.AppSettings.GeneralSettings.PlayOrPauseShortcut, (() =>
|
||||
{
|
||||
if (CurrentIsPlaying)
|
||||
{
|
||||
@@ -144,7 +145,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
private void UpdatePreviousSongShortcut()
|
||||
{
|
||||
GlobalHotKeyHook.UpdateHotKey<LyricsWindow>(ShortcutID.PreviousSong, _settingsService.AppSettings.GeneralSettings.PreviousSongShortcut, () =>
|
||||
GlobalHotKeyHook.UpdateHotKey<NowPlayingWindow>(ShortcutID.PreviousSong, _settingsService.AppSettings.GeneralSettings.PreviousSongShortcut, () =>
|
||||
{
|
||||
_ = PreviousAsync();
|
||||
});
|
||||
@@ -152,7 +153,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
private void UpdateNextSongShortcut()
|
||||
{
|
||||
GlobalHotKeyHook.UpdateHotKey<LyricsWindow>(ShortcutID.NextSong, _settingsService.AppSettings.GeneralSettings.NextSongShortcut, () =>
|
||||
GlobalHotKeyHook.UpdateHotKey<NowPlayingWindow>(ShortcutID.NextSong, _settingsService.AppSettings.GeneralSettings.NextSongShortcut, () =>
|
||||
{
|
||||
_ = NextAsync();
|
||||
});
|
||||
@@ -338,6 +339,12 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
.FirstOrDefault(x => x.StartsWith(ExtendedGenreFiled.NetEaseCloudMusicTrackID))?
|
||||
.Replace(ExtendedGenreFiled.NetEaseCloudMusicTrackID, "");
|
||||
}
|
||||
else if (sessionId == PlayerID.QQMusic)
|
||||
{
|
||||
songId = mediaProperties?.Genres
|
||||
.FirstOrDefault(x => x.StartsWith(ExtendedGenreFiled.QQMusicTrackID))?
|
||||
.Replace(ExtendedGenreFiled.QQMusicTrackID, "");
|
||||
}
|
||||
|
||||
var linkedFileName = mediaProperties?.Genres
|
||||
.FirstOrDefault(x => x.StartsWith(ExtendedGenreFiled.FileName))?
|
||||
@@ -584,7 +591,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
if (picUrl != null)
|
||||
{
|
||||
_logger.LogInformation("LX Music Album Art URL: {url}", picUrl);
|
||||
_lxMusicAlbumArtBytes = await ImageHelper.GetImageBytesFromUrlAsync(picUrl);
|
||||
_lxMusicAlbumArtBytes = await ImageHelper.GetImageByteArrayFromUrlAsync(picUrl);
|
||||
if (_lxMusicAlbumArtBytes != null)
|
||||
{
|
||||
_SMTCAlbumArtBuffer = _lxMusicAlbumArtBytes.AsBuffer();
|
||||
@@ -646,9 +653,17 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ChangeLyricsLine(int index)
|
||||
{
|
||||
if (CurrentLyricsData?.LyricsLines?.ElementAtOrDefault(index)?.StartMs is int startMs)
|
||||
{
|
||||
await ChangePosition(startMs / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnCurrentIsPlayingChanged(bool value)
|
||||
{
|
||||
if (WindowHook.GetWindowHandle<LyricsWindow>() is IntPtr hwnd)
|
||||
if (WindowHook.GetWindowHandle<NowPlayingWindow>() is IntPtr hwnd)
|
||||
{
|
||||
TaskbarList.SetProgressState(hwnd, value ? TaskbarButtonProgressState.Normal : TaskbarButtonProgressState.Paused);
|
||||
}
|
||||
@@ -656,7 +671,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
partial void OnCurrentPositionChanged(TimeSpan value)
|
||||
{
|
||||
if (WindowHook.GetWindowHandle<LyricsWindow>() is IntPtr hwnd)
|
||||
if (WindowHook.GetWindowHandle<NowPlayingWindow>() is IntPtr hwnd)
|
||||
{
|
||||
TaskbarList.SetProgressValue(hwnd, (ulong)value.TotalSeconds, (ulong)(CurrentSongInfo?.Duration ?? value.TotalSeconds));
|
||||
}
|
||||
@@ -717,14 +732,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
|
||||
public void Receive(PropertyChangedMessage<string> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsTranslationSeparator))
|
||||
{
|
||||
UpdateTranslations();
|
||||
}
|
||||
}
|
||||
else if (message.Sender is TranslationSettings)
|
||||
if (message.Sender is TranslationSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(TranslationSettings.SelectedTargetLanguageCode))
|
||||
{
|
||||
@@ -741,6 +749,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
{
|
||||
if (message.PropertyName == nameof(LiveStates.LyricsWindowStatus))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
UpdateTranslations();
|
||||
}
|
||||
}
|
||||
@@ -767,5 +776,62 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<Color> message)
|
||||
{
|
||||
if (message.Sender is NowPlayingWindowViewModel)
|
||||
{
|
||||
if (message.PropertyName == nameof(NowPlayingWindowViewModel.BackdropAccentColor))
|
||||
{
|
||||
_envColor = message.NewValue;
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomBgFontColor))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomFgFontColor))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomStrokeFontColor))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<ElementTheme> message)
|
||||
{
|
||||
if (message.Sender is LyricsBackgroundSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsBackgroundSettings.LyricsBackgroundTheme))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsFontColorType> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsBgFontColorType))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFgFontColorType))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsStrokeFontColorType))
|
||||
{
|
||||
UpdateAlbumArtThemeColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>Picture-in-picture mode</value>
|
||||
</data>
|
||||
<data name="AppSettingsControlGeneral.Text" xml:space="preserve">
|
||||
<value>General</value>
|
||||
<value>Window</value>
|
||||
</data>
|
||||
<data name="ArtistsSplitHint.Text" xml:space="preserve">
|
||||
<value>When typing multiple artists, please separate them with one of the following delimiters (do not mix them)</value>
|
||||
@@ -166,7 +166,7 @@
|
||||
<value>Export successful</value>
|
||||
</data>
|
||||
<data name="FailToStartLXMusicServer" xml:space="preserve">
|
||||
<value>Unable to connect to LX Music server, please go to Settings - Advanced options to check if the link is entered correctly</value>
|
||||
<value>Unable to connect to LX Music Server, please go to Settings - Playback Source - LX Music - LX Music Server to check if the link is entered correctly</value>
|
||||
</data>
|
||||
<data name="FullscreenMode" xml:space="preserve">
|
||||
<value>Fullscreen mode</value>
|
||||
@@ -384,10 +384,6 @@
|
||||
<data name="MainPageSplitView.Content" xml:space="preserve">
|
||||
<value>Split view</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Subtitle" xml:space="preserve">
|
||||
<value>Click on the top-left button to enable immersive mode.
|
||||
If you encounter any problems, please go to the Settings page, About tab, and view the FAQ or contact the author for feedback</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
|
||||
<value>Welcome to BetterLyrics</value>
|
||||
</data>
|
||||
@@ -566,7 +562,7 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<value>Acrylic Thin</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
|
||||
<value>At the same time, set the pure color layer opacity and the album art layer opacity in the lyrics background to 0 to get the correct effect</value>
|
||||
<value>Turning this on will override the theme settings in the lyric background settings</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
|
||||
<value>Adapt to environmental color</value>
|
||||
@@ -586,6 +582,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
|
||||
<value>Album art</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
|
||||
<value>Album image height</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
|
||||
<value>Album art layer</value>
|
||||
</data>
|
||||
@@ -595,6 +594,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
|
||||
<value>Album art size</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
|
||||
<value>Album art area effect</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
|
||||
<value>Album art source</value>
|
||||
</data>
|
||||
@@ -607,6 +609,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
|
||||
<value>Album art area style</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlignment.Header" xml:space="preserve">
|
||||
<value>Alignment</value>
|
||||
</data>
|
||||
<data name="SettingsPageAmllTtmlDbBaseUrl.Header" xml:space="preserve">
|
||||
<value>Base URL</value>
|
||||
</data>
|
||||
@@ -655,21 +660,27 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
|
||||
<value>Lyrics background</value>
|
||||
</data>
|
||||
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
|
||||
<value>Blur amount</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderless.Header" xml:space="preserve">
|
||||
<value>Borderless window</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
|
||||
<value>Borderless lyrics window shortcut</value>
|
||||
</data>
|
||||
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
|
||||
<value>Bottom gap height factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Description" xml:space="preserve">
|
||||
<value>Including log files, network lyrics cache</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Header" xml:space="preserve">
|
||||
<value>Cache</value>
|
||||
</data>
|
||||
<data name="SettingsPageCenter.Content" xml:space="preserve">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="SettingsPageCheckShortcut.Content" xml:space="preserve">
|
||||
<value>Check shortcut</value>
|
||||
</data>
|
||||
<data name="SettingsPageChinese.Header" xml:space="preserve">
|
||||
<value>Chinese pronunciation</value>
|
||||
</data>
|
||||
@@ -682,6 +693,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageCJK.Header" xml:space="preserve">
|
||||
<value>CJK Unified Ideograph</value>
|
||||
</data>
|
||||
<data name="SettingsPageClear.Content" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name="SettingsPageClearCache.Content" xml:space="preserve">
|
||||
<value>Clear cache files</value>
|
||||
</data>
|
||||
@@ -691,6 +705,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
|
||||
<value>Click-through shortcut keys</value>
|
||||
</data>
|
||||
<data name="SettingsPageCollapseDropdown.Content" xml:space="preserve">
|
||||
<value>Collapse dropdown</value>
|
||||
</data>
|
||||
<data name="SettingsPageCompactTitleBar.Content" xml:space="preserve">
|
||||
<value>Compact</value>
|
||||
</data>
|
||||
@@ -706,6 +723,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
|
||||
<value>Create from templates</value>
|
||||
</data>
|
||||
<data name="SettingsPageCrossfade.Content" xml:space="preserve">
|
||||
<value>Crossfade</value>
|
||||
</data>
|
||||
<data name="SettingsPageCurrentLyricsWindowStatus.Text" xml:space="preserve">
|
||||
<value>Current lyrics window status</value>
|
||||
</data>
|
||||
@@ -859,6 +879,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
|
||||
<value>Fullscreen mode</value>
|
||||
</data>
|
||||
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
|
||||
<value>General layout factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageHeight.Header" xml:space="preserve">
|
||||
<value>Height</value>
|
||||
</data>
|
||||
@@ -871,6 +894,12 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
|
||||
<value>Hold here and drag to sort</value>
|
||||
</data>
|
||||
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>Horizontal layout factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
|
||||
<value>Album art toggle animation</value>
|
||||
</data>
|
||||
<data name="SettingsPageImport.Content" xml:space="preserve">
|
||||
<value>Import</value>
|
||||
</data>
|
||||
@@ -925,6 +954,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageLastFMUsername.Header" xml:space="preserve">
|
||||
<value>Username</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayout.Text" xml:space="preserve">
|
||||
<value>Layout</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayoutOrientation.Header" xml:space="preserve">
|
||||
<value>Layout orientation</value>
|
||||
</data>
|
||||
@@ -934,6 +966,12 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageLayoutOrientationVertical.Content" xml:space="preserve">
|
||||
<value>Vertical</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeft.Content" xml:space="preserve">
|
||||
<value>Left</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
|
||||
<value>Left gap area width factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
|
||||
<value>Server address</value>
|
||||
</data>
|
||||
@@ -962,28 +1000,25 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<value>Lyrics background</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
|
||||
<value>Non-current playback area</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
|
||||
<value>Font opacity (Non-current playback area)</value>
|
||||
<value>Not the current play line</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
|
||||
<value>Black</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmount.Header" xml:space="preserve">
|
||||
<value>Blur amount</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
|
||||
<value>Enable blur for non-current rows</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmountSideEffect.Text" xml:space="preserve">
|
||||
<value>Adjusting this value will also increase the background blur intensity of the album image.</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurHighGPUUsage.Text" xml:space="preserve">
|
||||
<value>Significantly higher GPU usage when blur is enabled (> 0)</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
|
||||
<value>Blur Effect</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBold.Content" xml:space="preserve">
|
||||
<value>Bold</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsCenter.Content" xml:space="preserve">
|
||||
<value>Center</value>
|
||||
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
|
||||
<value>Current line position</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
|
||||
<value>Lyrics area width factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
|
||||
<value>Lyrics effect</value>
|
||||
@@ -998,7 +1033,7 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<value>Extra Light</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
|
||||
<value>Current playback area</value>
|
||||
<value>Current Play Row</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
|
||||
<value>Adaptive to lyrics background (Colored)</value>
|
||||
@@ -1033,6 +1068,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
|
||||
<value>Font weight</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Description" xml:space="preserve">
|
||||
<value>Enable glow effect for syllables with long duration</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
|
||||
<value>Glow effect</value>
|
||||
</data>
|
||||
@@ -1063,17 +1101,14 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageLyricsNormal.Content" xml:space="preserve">
|
||||
<value>Normal</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentChar.Content" xml:space="preserve">
|
||||
<value>Current char</value>
|
||||
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
|
||||
<value>Lyrics area height factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentLine.Content" xml:space="preserve">
|
||||
<value>Current line</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
|
||||
<value>Enable scaling for syllables with long duration</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeLineStartToCurrentChar.Content" xml:space="preserve">
|
||||
<value>Current line start to current char</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRight.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Header" xml:space="preserve">
|
||||
<value>Scale effect</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsSearchBestMatch.Content" xml:space="preserve">
|
||||
<value>Best match</value>
|
||||
@@ -1156,6 +1191,12 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
|
||||
<value>Mica Alt</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
|
||||
<value>Middle area gap width factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
|
||||
<value>Middle gap area height factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
|
||||
<value>Play test music</value>
|
||||
</data>
|
||||
@@ -1261,6 +1302,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageReference.Header" xml:space="preserve">
|
||||
<value>Reference link</value>
|
||||
</data>
|
||||
<data name="SettingsPageRefreshDropdown.Content" xml:space="preserve">
|
||||
<value>Refresh dropdown</value>
|
||||
</data>
|
||||
<data name="SettingsPageRemoveInfo.Message" xml:space="preserve">
|
||||
<value>Original files and folders in this path will not be deleted when removing it from this app</value>
|
||||
</data>
|
||||
@@ -1273,6 +1317,12 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageRestart.Content" xml:space="preserve">
|
||||
<value>Restart app to apply change</value>
|
||||
</data>
|
||||
<data name="SettingsPageRight.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
|
||||
<value>Right gap area width factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageRomaji.Header" xml:space="preserve">
|
||||
<value>Japanese annotation</value>
|
||||
</data>
|
||||
@@ -1342,9 +1392,15 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageShowInSwitchers.Header" xml:space="preserve">
|
||||
<value>Show in system environment</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowLayoutDragger.Header" xml:space="preserve">
|
||||
<value>Show layout splitter</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowTitle.Header" xml:space="preserve">
|
||||
<value>Show title</value>
|
||||
</data>
|
||||
<data name="SettingsPageSlide.Content" xml:space="preserve">
|
||||
<value>Slide</value>
|
||||
</data>
|
||||
<data name="SettingsPageSliderPrefix.Text" xml:space="preserve">
|
||||
<value>Current value: </value>
|
||||
</data>
|
||||
@@ -1354,18 +1410,6 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageSongInfo.Text" xml:space="preserve">
|
||||
<value>Song info</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoAlignment.Header" xml:space="preserve">
|
||||
<value>Alignment</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoCenter.Content" xml:space="preserve">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoLeft.Content" xml:space="preserve">
|
||||
<value>Left</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoRight.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongStatus.Header" xml:space="preserve">
|
||||
<value>Current song</value>
|
||||
</data>
|
||||
@@ -1378,12 +1422,21 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageSpectrumLayerPlacement.Header" xml:space="preserve">
|
||||
<value>Spectrum placement</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
|
||||
<value>Spectrum style</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementTop.Content" xml:space="preserve">
|
||||
<value>Top</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleBar.Content" xml:space="preserve">
|
||||
<value>Bar</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleCurve.Content" xml:space="preserve">
|
||||
<value>Curve</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpeed.Header" xml:space="preserve">
|
||||
<value>Motion rate</value>
|
||||
</data>
|
||||
@@ -1426,6 +1479,15 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
|
||||
<value>Switch in and cut out shortcut keys</value>
|
||||
</data>
|
||||
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
|
||||
<value>Top gap area height factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
|
||||
<value>Track summary area width factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
|
||||
<value>Track summary area height factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
|
||||
<value>Translated text</value>
|
||||
</data>
|
||||
@@ -1444,6 +1506,9 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
|
||||
<data name="SettingsPageVersion.Text" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>Vertical layout factor</value>
|
||||
</data>
|
||||
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
|
||||
<value>Latin alphabet</value>
|
||||
</data>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>ピクチャーインピクチャーモード</value>
|
||||
</data>
|
||||
<data name="AppSettingsControlGeneral.Text" xml:space="preserve">
|
||||
<value>一般的な</value>
|
||||
<value>ウィンドウ</value>
|
||||
</data>
|
||||
<data name="ArtistsSplitHint.Text" xml:space="preserve">
|
||||
<value>複数のアーティストを入力する場合は、次の区切り記号のいずれかで区切ってください(混在しないでください)</value>
|
||||
@@ -166,7 +166,7 @@
|
||||
<value>エクスポートが成功しました</value>
|
||||
</data>
|
||||
<data name="FailToStartLXMusicServer" xml:space="preserve">
|
||||
<value>LX Music Serverに接続できない場合は、設定に移動してください。リンクが正しく入力されているかどうかを確認するための高度なオプションに移動してください</value>
|
||||
<value>LXミュージックサーバーに接続できません。[設定] - [再生ソース] - [LXミュージック] - [LXミュージックサーバー]に移動して、リンクが正しく入力されているかどうかを確認してください。</value>
|
||||
</data>
|
||||
<data name="FullscreenMode" xml:space="preserve">
|
||||
<value>フルスクリーンモード</value>
|
||||
@@ -384,10 +384,6 @@
|
||||
<data name="MainPageSplitView.Content" xml:space="preserve">
|
||||
<value>分割ビュー</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Subtitle" xml:space="preserve">
|
||||
<value>左上ボタンをクリックして、没入型モードを有効にします。
|
||||
問題が発生した場合は、[設定]ページ、[タブについて]にアクセスして、FAQを表示するか、フィードバックについて著者に連絡してください</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
|
||||
<value>BetterLyrics へようこそ</value>
|
||||
</data>
|
||||
@@ -566,7 +562,7 @@
|
||||
<value>アクリル薄い</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
|
||||
<value>同時に、歌詞の背景のピュアカラーレイヤーの不透明度とアルバムアートレイヤーの不透明度を0に設定して、正しい効果を得ます</value>
|
||||
<value>これをオンにすると、歌詞の背景設定のテーマ設定が上書きされます</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
|
||||
<value>環境の色に適応しましょう</value>
|
||||
@@ -586,6 +582,9 @@
|
||||
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
|
||||
<value>アルバムアート</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
|
||||
<value>アルバム画像の高さ</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
|
||||
<value>アルバムアートレイヤー</value>
|
||||
</data>
|
||||
@@ -595,6 +594,9 @@
|
||||
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
|
||||
<value>アルバムアートサイズ</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
|
||||
<value>アルバムリージョンアニメーション</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
|
||||
<value>アルバムアートソース</value>
|
||||
</data>
|
||||
@@ -607,6 +609,9 @@
|
||||
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
|
||||
<value>アルバムエリアスタイル</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlignment.Header" xml:space="preserve">
|
||||
<value>アライメント</value>
|
||||
</data>
|
||||
<data name="SettingsPageAmllTtmlDbBaseUrl.Header" xml:space="preserve">
|
||||
<value>ベースURL</value>
|
||||
</data>
|
||||
@@ -655,21 +660,27 @@
|
||||
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
|
||||
<value>歌詞の背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
|
||||
<value>ぼやけの量</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderless.Header" xml:space="preserve">
|
||||
<value>ボーダーレスウィンドウ</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
|
||||
<value>ボーダーレス歌詞ウィンドウショートカット</value>
|
||||
</data>
|
||||
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
|
||||
<value>ボトムギャップハイトファクター</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Description" xml:space="preserve">
|
||||
<value>ログファイル、ネットワーク歌詞キャッシュを含む</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Header" xml:space="preserve">
|
||||
<value>キャッシュ</value>
|
||||
</data>
|
||||
<data name="SettingsPageCenter.Content" xml:space="preserve">
|
||||
<value>中心</value>
|
||||
</data>
|
||||
<data name="SettingsPageCheckShortcut.Content" xml:space="preserve">
|
||||
<value>ショートカットをチェック!</value>
|
||||
</data>
|
||||
<data name="SettingsPageChinese.Header" xml:space="preserve">
|
||||
<value>中国の発音</value>
|
||||
</data>
|
||||
@@ -682,6 +693,9 @@
|
||||
<data name="SettingsPageCJK.Header" xml:space="preserve">
|
||||
<value>CJK統一漢字</value>
|
||||
</data>
|
||||
<data name="SettingsPageClear.Content" xml:space="preserve">
|
||||
<value>消去</value>
|
||||
</data>
|
||||
<data name="SettingsPageClearCache.Content" xml:space="preserve">
|
||||
<value>キャッシュファイルをクリア</value>
|
||||
</data>
|
||||
@@ -691,6 +705,9 @@
|
||||
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
|
||||
<value>クリックスルーショートカットキー</value>
|
||||
</data>
|
||||
<data name="SettingsPageCollapseDropdown.Content" xml:space="preserve">
|
||||
<value>ドロップダウンを折りたたみます</value>
|
||||
</data>
|
||||
<data name="SettingsPageCompactTitleBar.Content" xml:space="preserve">
|
||||
<value>コンパクト</value>
|
||||
</data>
|
||||
@@ -706,6 +723,9 @@
|
||||
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
|
||||
<value>テンプレートから作成</value>
|
||||
</data>
|
||||
<data name="SettingsPageCrossfade.Content" xml:space="preserve">
|
||||
<value>クロスフェード</value>
|
||||
</data>
|
||||
<data name="SettingsPageCurrentLyricsWindowStatus.Text" xml:space="preserve">
|
||||
<value>現在の歌詞ウィンドウステータス</value>
|
||||
</data>
|
||||
@@ -859,6 +879,9 @@
|
||||
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
|
||||
<value>フルスクリーンモード</value>
|
||||
</data>
|
||||
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
|
||||
<value>一般的なレイアウトファクター</value>
|
||||
</data>
|
||||
<data name="SettingsPageHeight.Header" xml:space="preserve">
|
||||
<value>高さ</value>
|
||||
</data>
|
||||
@@ -871,6 +894,12 @@
|
||||
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
|
||||
<value>ここを長押ししてドラッグして並べ替えましょう</value>
|
||||
</data>
|
||||
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>水平レイアウト係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
|
||||
<value>アルバムダイアグラムアニメーションの切り替え</value>
|
||||
</data>
|
||||
<data name="SettingsPageImport.Content" xml:space="preserve">
|
||||
<value>インポート</value>
|
||||
</data>
|
||||
@@ -925,6 +954,9 @@
|
||||
<data name="SettingsPageLastFMUsername.Header" xml:space="preserve">
|
||||
<value>ユーザー名</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayout.Text" xml:space="preserve">
|
||||
<value>レイアウト</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayoutOrientation.Header" xml:space="preserve">
|
||||
<value>レイアウトの向き</value>
|
||||
</data>
|
||||
@@ -934,6 +966,12 @@
|
||||
<data name="SettingsPageLayoutOrientationVertical.Content" xml:space="preserve">
|
||||
<value>垂直方向</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeft.Content" xml:space="preserve">
|
||||
<value>左</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
|
||||
<value>左ギャップエリア幅係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
|
||||
<value>サーバーアドレス</value>
|
||||
</data>
|
||||
@@ -962,28 +1000,25 @@
|
||||
<value>歌詞の背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
|
||||
<value>非電流再生エリア</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
|
||||
<value>フォントの不透明度(非電流再生エリア)</value>
|
||||
<value>現在のプレイラインではありません</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
|
||||
<value>黒</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmount.Header" xml:space="preserve">
|
||||
<value>ぼやけの量</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
|
||||
<value>現在ではない行のぼかしを有効にします</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmountSideEffect.Text" xml:space="preserve">
|
||||
<value>この値を調整すると、アルバム画像のバックグラウンドブラー強度も増加します。</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurHighGPUUsage.Text" xml:space="preserve">
|
||||
<value>ぼかしが有効になっている場合のGPU使用量が大幅に高くなります(> 0)</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
|
||||
<value>ぼかし効果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBold.Content" xml:space="preserve">
|
||||
<value>大胆な</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsCenter.Content" xml:space="preserve">
|
||||
<value>中心</value>
|
||||
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
|
||||
<value>現在の行の位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
|
||||
<value>歌詞エリア幅係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
|
||||
<value>歌詞効果</value>
|
||||
@@ -998,7 +1033,7 @@
|
||||
<value>余分な光</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
|
||||
<value>現在の再生エリア</value>
|
||||
<value>現在のプレイ行</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
|
||||
<value>歌詞の背景に適応する(色付き)</value>
|
||||
@@ -1033,6 +1068,9 @@
|
||||
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
|
||||
<value>フォント重量</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Description" xml:space="preserve">
|
||||
<value>長時間の音節にグロウ効果を有効にします</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
|
||||
<value>グロー効果</value>
|
||||
</data>
|
||||
@@ -1063,17 +1101,14 @@
|
||||
<data name="SettingsPageLyricsNormal.Content" xml:space="preserve">
|
||||
<value>普通</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentChar.Content" xml:space="preserve">
|
||||
<value>現在の文字</value>
|
||||
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
|
||||
<value>歌詞エリアの高さ係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentLine.Content" xml:space="preserve">
|
||||
<value>現在の行</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
|
||||
<value>長時間の音節のスケーリングを有効にします</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeLineStartToCurrentChar.Content" xml:space="preserve">
|
||||
<value>現在のラインが現在の文字から始まります</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRight.Content" xml:space="preserve">
|
||||
<value>右</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Header" xml:space="preserve">
|
||||
<value>スケール効果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsSearchBestMatch.Content" xml:space="preserve">
|
||||
<value>ベストマッチ</value>
|
||||
@@ -1156,6 +1191,12 @@
|
||||
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
|
||||
<value>マイカル</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
|
||||
<value>ミドルエリアギャップ幅係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
|
||||
<value>ミドルギャップエリアハイトファクター</value>
|
||||
</data>
|
||||
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
|
||||
<value>テスト音楽を再生します</value>
|
||||
</data>
|
||||
@@ -1261,6 +1302,9 @@
|
||||
<data name="SettingsPageReference.Header" xml:space="preserve">
|
||||
<value>参照リンク</value>
|
||||
</data>
|
||||
<data name="SettingsPageRefreshDropdown.Content" xml:space="preserve">
|
||||
<value>ドロップダウンを更新してください</value>
|
||||
</data>
|
||||
<data name="SettingsPageRemoveInfo.Message" xml:space="preserve">
|
||||
<value>このパスの元のファイルとフォルダーは、このアプリから削除するときに削除されません</value>
|
||||
</data>
|
||||
@@ -1273,6 +1317,12 @@
|
||||
<data name="SettingsPageRestart.Content" xml:space="preserve">
|
||||
<value>変更を適用するためのアプリを再起動します</value>
|
||||
</data>
|
||||
<data name="SettingsPageRight.Content" xml:space="preserve">
|
||||
<value>右</value>
|
||||
</data>
|
||||
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
|
||||
<value>右ギャップエリア幅係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageRomaji.Header" xml:space="preserve">
|
||||
<value>日本の注釈</value>
|
||||
</data>
|
||||
@@ -1342,9 +1392,15 @@
|
||||
<data name="SettingsPageShowInSwitchers.Header" xml:space="preserve">
|
||||
<value>システム環境に表示します</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowLayoutDragger.Header" xml:space="preserve">
|
||||
<value>レイアウトスプリッターを表示</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowTitle.Header" xml:space="preserve">
|
||||
<value>タイトルを表示</value>
|
||||
</data>
|
||||
<data name="SettingsPageSlide.Content" xml:space="preserve">
|
||||
<value>スライド</value>
|
||||
</data>
|
||||
<data name="SettingsPageSliderPrefix.Text" xml:space="preserve">
|
||||
<value>現在の値: </value>
|
||||
</data>
|
||||
@@ -1354,18 +1410,6 @@
|
||||
<data name="SettingsPageSongInfo.Text" xml:space="preserve">
|
||||
<value>曲情報</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoAlignment.Header" xml:space="preserve">
|
||||
<value>アライメント</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoCenter.Content" xml:space="preserve">
|
||||
<value>中心</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoLeft.Content" xml:space="preserve">
|
||||
<value>左</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoRight.Content" xml:space="preserve">
|
||||
<value>右</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongStatus.Header" xml:space="preserve">
|
||||
<value>現在の曲です</value>
|
||||
</data>
|
||||
@@ -1378,12 +1422,21 @@
|
||||
<data name="SettingsPageSpectrumLayerPlacement.Header" xml:space="preserve">
|
||||
<value>スペクトルの位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
|
||||
<value>スペクトラムスタイル</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
|
||||
<value>底</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementTop.Content" xml:space="preserve">
|
||||
<value>トップ</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleBar.Content" xml:space="preserve">
|
||||
<value>コラム</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleCurve.Content" xml:space="preserve">
|
||||
<value>曲線</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpeed.Header" xml:space="preserve">
|
||||
<value>モーション</value>
|
||||
</data>
|
||||
@@ -1426,6 +1479,15 @@
|
||||
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
|
||||
<value>ショートカットキーを切り込んで切り取ります</value>
|
||||
</data>
|
||||
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
|
||||
<value>トップギャップエリアの高さ係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
|
||||
<value>トラックサマリーエリア幅係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
|
||||
<value>トラックサマリーエリアの高さ係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
|
||||
<value>译文</value>
|
||||
</data>
|
||||
@@ -1444,6 +1506,9 @@
|
||||
<data name="SettingsPageVersion.Text" xml:space="preserve">
|
||||
<value>バージョン</value>
|
||||
</data>
|
||||
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>垂直レイアウト係数</value>
|
||||
</data>
|
||||
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
|
||||
<value>英字</value>
|
||||
</data>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>사진 인당 모드</value>
|
||||
</data>
|
||||
<data name="AppSettingsControlGeneral.Text" xml:space="preserve">
|
||||
<value>일반적인</value>
|
||||
<value>윈도우</value>
|
||||
</data>
|
||||
<data name="ArtistsSplitHint.Text" xml:space="preserve">
|
||||
<value>여러 아티스트를 입력할 때 다음 구분 기호 중 하나로 구분하십시오 (혼합하지 마십시오)</value>
|
||||
@@ -166,7 +166,7 @@
|
||||
<value>수출 성공</value>
|
||||
</data>
|
||||
<data name="FailToStartLXMusicServer" xml:space="preserve">
|
||||
<value>LX Music Server에 연결할 수 없습니다. 설정으로 이동하십시오 - 고급 옵션이 링크가 올바르게 입력되었는지 확인하십시오.</value>
|
||||
<value>LX Music Server에 연결할 수 없습니다. 설정 - 재생 소스 - LX Music - LX Music Server로 이동하여 링크가 올바르게 입력되었는지 확인하십시오</value>
|
||||
</data>
|
||||
<data name="FullscreenMode" xml:space="preserve">
|
||||
<value>전체화면 모드</value>
|
||||
@@ -384,10 +384,6 @@
|
||||
<data name="MainPageSplitView.Content" xml:space="preserve">
|
||||
<value>분할보기</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Subtitle" xml:space="preserve">
|
||||
<value>몰입 형 모드를 활성화하려면 왼쪽 상단 버튼을 클릭하십시오.
|
||||
문제가 발생하면 설정 페이지, 탭 정보로 이동하여 FAQ를보고 저자에게 연락하여 피드백을 받으십시오.</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
|
||||
<value>Betterlyrics에 오신 것을 환영합니다</value>
|
||||
</data>
|
||||
@@ -566,7 +562,7 @@
|
||||
<value>아크릴 얇은</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
|
||||
<value>동시에 가사 배경의 순수 컬러 레이어 불투명도와 앨범 아트 레이어 불투명도를 0으로 설정하면 정확한 효과를 얻을 수 있습니다</value>
|
||||
<value>이 기능을 켜면 가사 배경 설정의 테마 설정이 재정의됩니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
|
||||
<value>환경 색상에 적응하세요</value>
|
||||
@@ -586,6 +582,9 @@
|
||||
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
|
||||
<value>앨범 아트</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
|
||||
<value>앨범 이미지 높이</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
|
||||
<value>앨범 아트 레이어</value>
|
||||
</data>
|
||||
@@ -595,6 +594,9 @@
|
||||
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
|
||||
<value>앨범 아트 크기</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
|
||||
<value>앨범 지역 애니메이션</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
|
||||
<value>앨범 아트 소스</value>
|
||||
</data>
|
||||
@@ -607,6 +609,9 @@
|
||||
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
|
||||
<value>앨범 영역 스타일</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlignment.Header" xml:space="preserve">
|
||||
<value>조정</value>
|
||||
</data>
|
||||
<data name="SettingsPageAmllTtmlDbBaseUrl.Header" xml:space="preserve">
|
||||
<value>기본 URL</value>
|
||||
</data>
|
||||
@@ -655,21 +660,27 @@
|
||||
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
|
||||
<value>가사 배경</value>
|
||||
</data>
|
||||
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
|
||||
<value>흐림 금액</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderless.Header" xml:space="preserve">
|
||||
<value>창문</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
|
||||
<value>테두리 없는 가사 창 단축키</value>
|
||||
</data>
|
||||
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
|
||||
<value>하단 간격 높이 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Description" xml:space="preserve">
|
||||
<value>로그 파일, 네트워크 가사 캐시 포함</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Header" xml:space="preserve">
|
||||
<value>은닉처</value>
|
||||
</data>
|
||||
<data name="SettingsPageCenter.Content" xml:space="preserve">
|
||||
<value>센터</value>
|
||||
</data>
|
||||
<data name="SettingsPageCheckShortcut.Content" xml:space="preserve">
|
||||
<value>단축키를 확인하세요!</value>
|
||||
</data>
|
||||
<data name="SettingsPageChinese.Header" xml:space="preserve">
|
||||
<value>화음</value>
|
||||
</data>
|
||||
@@ -682,6 +693,9 @@
|
||||
<data name="SettingsPageCJK.Header" xml:space="preserve">
|
||||
<value>한중일 통합 이데오그래프</value>
|
||||
</data>
|
||||
<data name="SettingsPageClear.Content" xml:space="preserve">
|
||||
<value>지우기</value>
|
||||
</data>
|
||||
<data name="SettingsPageClearCache.Content" xml:space="preserve">
|
||||
<value>캐시 파일을 지웁니다</value>
|
||||
</data>
|
||||
@@ -691,6 +705,9 @@
|
||||
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
|
||||
<value>바로 가기 키를 클릭하세요</value>
|
||||
</data>
|
||||
<data name="SettingsPageCollapseDropdown.Content" xml:space="preserve">
|
||||
<value>드롭다운 접기</value>
|
||||
</data>
|
||||
<data name="SettingsPageCompactTitleBar.Content" xml:space="preserve">
|
||||
<value>콤팩트</value>
|
||||
</data>
|
||||
@@ -706,6 +723,9 @@
|
||||
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
|
||||
<value>템플릿에서 만들기</value>
|
||||
</data>
|
||||
<data name="SettingsPageCrossfade.Content" xml:space="preserve">
|
||||
<value>크로스 페이드</value>
|
||||
</data>
|
||||
<data name="SettingsPageCurrentLyricsWindowStatus.Text" xml:space="preserve">
|
||||
<value>현재 가사 창 상태</value>
|
||||
</data>
|
||||
@@ -859,6 +879,9 @@
|
||||
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
|
||||
<value>전체화면 모드</value>
|
||||
</data>
|
||||
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
|
||||
<value>일반 레이아웃 요소</value>
|
||||
</data>
|
||||
<data name="SettingsPageHeight.Header" xml:space="preserve">
|
||||
<value>신장</value>
|
||||
</data>
|
||||
@@ -871,6 +894,12 @@
|
||||
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
|
||||
<value>여기를 누른 상태에서 드래그하여 정렬하세요</value>
|
||||
</data>
|
||||
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>수평 레이아웃 요소</value>
|
||||
</data>
|
||||
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
|
||||
<value>앨범 다이어그램 토글 애니메이션</value>
|
||||
</data>
|
||||
<data name="SettingsPageImport.Content" xml:space="preserve">
|
||||
<value>가져오기</value>
|
||||
</data>
|
||||
@@ -925,6 +954,9 @@
|
||||
<data name="SettingsPageLastFMUsername.Header" xml:space="preserve">
|
||||
<value>사용자 이름</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayout.Text" xml:space="preserve">
|
||||
<value>레이아웃</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayoutOrientation.Header" xml:space="preserve">
|
||||
<value>레이아웃 방향</value>
|
||||
</data>
|
||||
@@ -934,6 +966,12 @@
|
||||
<data name="SettingsPageLayoutOrientationVertical.Content" xml:space="preserve">
|
||||
<value>세로</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeft.Content" xml:space="preserve">
|
||||
<value>왼쪽</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
|
||||
<value>왼쪽 갭 영역 너비 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
|
||||
<value>서버 주소</value>
|
||||
</data>
|
||||
@@ -962,28 +1000,25 @@
|
||||
<value>가사 배경</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
|
||||
<value>비 전류 재생 영역</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
|
||||
<value>글꼴 불투명 (비 전류 재생 영역)</value>
|
||||
<value>현재 플레이 라인이 아닙니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
|
||||
<value>검은색</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmount.Header" xml:space="preserve">
|
||||
<value>흐림 금액</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
|
||||
<value>현재 행이 아닌 행에 블러 활성화</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmountSideEffect.Text" xml:space="preserve">
|
||||
<value>이 값을 조정하면 앨범 이미지의 배경 흐림 강도가 증가합니다.</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurHighGPUUsage.Text" xml:space="preserve">
|
||||
<value>Blur가 활성화 될 때 상당히 높은 GPU 사용량 (> 0)</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
|
||||
<value>흐림 효과</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBold.Content" xml:space="preserve">
|
||||
<value>용감한</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsCenter.Content" xml:space="preserve">
|
||||
<value>센터</value>
|
||||
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
|
||||
<value>현재 행 위치</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
|
||||
<value>가사 영역 너비 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
|
||||
<value>가사 효과</value>
|
||||
@@ -998,7 +1033,7 @@
|
||||
<value>여분의 빛</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
|
||||
<value>현재 재생 영역</value>
|
||||
<value>현재 플레이 행</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
|
||||
<value>가사 배경 (색상)에 적응</value>
|
||||
@@ -1033,6 +1068,9 @@
|
||||
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
|
||||
<value>글꼴 무게</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Description" xml:space="preserve">
|
||||
<value>지속 시간이 긴 음절에 대해 발광 효과를 활성화합니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
|
||||
<value>글로우 효과</value>
|
||||
</data>
|
||||
@@ -1063,17 +1101,14 @@
|
||||
<data name="SettingsPageLyricsNormal.Content" xml:space="preserve">
|
||||
<value>정상</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentChar.Content" xml:space="preserve">
|
||||
<value>현재 숯</value>
|
||||
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
|
||||
<value>가사 영역 높이 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentLine.Content" xml:space="preserve">
|
||||
<value>현재 라인</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
|
||||
<value>장시간 음절 배율을 조정할 수 있습니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeLineStartToCurrentChar.Content" xml:space="preserve">
|
||||
<value>현재 라인은 현재 숯으로 시작합니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRight.Content" xml:space="preserve">
|
||||
<value>오른쪽</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Header" xml:space="preserve">
|
||||
<value>스케일 효과</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsSearchBestMatch.Content" xml:space="preserve">
|
||||
<value>최상의 검색 결과</value>
|
||||
@@ -1156,6 +1191,12 @@
|
||||
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
|
||||
<value>운모 대체</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
|
||||
<value>중간 영역 갭 폭 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
|
||||
<value>중간 간격 영역 높이 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
|
||||
<value>테스트 음악을 재생하십시오</value>
|
||||
</data>
|
||||
@@ -1261,6 +1302,9 @@
|
||||
<data name="SettingsPageReference.Header" xml:space="preserve">
|
||||
<value>참고문헌</value>
|
||||
</data>
|
||||
<data name="SettingsPageRefreshDropdown.Content" xml:space="preserve">
|
||||
<value>새로 고침 드롭다운</value>
|
||||
</data>
|
||||
<data name="SettingsPageRemoveInfo.Message" xml:space="preserve">
|
||||
<value>이 경로의 원본 파일과 폴더는이 앱에서 제거 할 때 삭제되지 않습니다.</value>
|
||||
</data>
|
||||
@@ -1273,6 +1317,12 @@
|
||||
<data name="SettingsPageRestart.Content" xml:space="preserve">
|
||||
<value>변경 사항을 적용하려면 앱을 다시 시작하십시오</value>
|
||||
</data>
|
||||
<data name="SettingsPageRight.Content" xml:space="preserve">
|
||||
<value>오른쪽</value>
|
||||
</data>
|
||||
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
|
||||
<value>오른쪽 간격 영역 너비 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageRomaji.Header" xml:space="preserve">
|
||||
<value>일본 주석</value>
|
||||
</data>
|
||||
@@ -1342,9 +1392,15 @@
|
||||
<data name="SettingsPageShowInSwitchers.Header" xml:space="preserve">
|
||||
<value>시스템 환경에서 보여주세요</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowLayoutDragger.Header" xml:space="preserve">
|
||||
<value>레이아웃 스플리터 표시</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowTitle.Header" xml:space="preserve">
|
||||
<value>제목 표시</value>
|
||||
</data>
|
||||
<data name="SettingsPageSlide.Content" xml:space="preserve">
|
||||
<value>살짝 밀기</value>
|
||||
</data>
|
||||
<data name="SettingsPageSliderPrefix.Text" xml:space="preserve">
|
||||
<value>현재 가치 : </value>
|
||||
</data>
|
||||
@@ -1354,18 +1410,6 @@
|
||||
<data name="SettingsPageSongInfo.Text" xml:space="preserve">
|
||||
<value>노래 정보</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoAlignment.Header" xml:space="preserve">
|
||||
<value>조정</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoCenter.Content" xml:space="preserve">
|
||||
<value>센터</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoLeft.Content" xml:space="preserve">
|
||||
<value>왼쪽</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoRight.Content" xml:space="preserve">
|
||||
<value>오른쪽</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongStatus.Header" xml:space="preserve">
|
||||
<value>현재 노래</value>
|
||||
</data>
|
||||
@@ -1378,12 +1422,21 @@
|
||||
<data name="SettingsPageSpectrumLayerPlacement.Header" xml:space="preserve">
|
||||
<value>스펙트럼 위치</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
|
||||
<value>스펙트럼 스타일</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
|
||||
<value>맨 아래</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementTop.Content" xml:space="preserve">
|
||||
<value>맨 위</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleBar.Content" xml:space="preserve">
|
||||
<value>기둥</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleCurve.Content" xml:space="preserve">
|
||||
<value>곡선</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpeed.Header" xml:space="preserve">
|
||||
<value>모션</value>
|
||||
</data>
|
||||
@@ -1426,6 +1479,15 @@
|
||||
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
|
||||
<value>바로 가기 키를 자르고 잘라냅니다</value>
|
||||
</data>
|
||||
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
|
||||
<value>상단 간격 영역 높이 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
|
||||
<value>트랙 요약 영역 너비 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
|
||||
<value>트랙 요약 영역 높이 계수</value>
|
||||
</data>
|
||||
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
|
||||
<value>번역</value>
|
||||
</data>
|
||||
@@ -1444,6 +1506,9 @@
|
||||
<data name="SettingsPageVersion.Text" xml:space="preserve">
|
||||
<value>버전</value>
|
||||
</data>
|
||||
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>수직 레이아웃 요소</value>
|
||||
</data>
|
||||
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
|
||||
<value>라틴 알파벳</value>
|
||||
</data>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>画中画模式</value>
|
||||
</data>
|
||||
<data name="AppSettingsControlGeneral.Text" xml:space="preserve">
|
||||
<value>通用</value>
|
||||
<value>窗口</value>
|
||||
</data>
|
||||
<data name="ArtistsSplitHint.Text" xml:space="preserve">
|
||||
<value>键入多位艺术家时请以下述一种分隔符分隔(不要混用)</value>
|
||||
@@ -166,7 +166,7 @@
|
||||
<value>导出成功</value>
|
||||
</data>
|
||||
<data name="FailToStartLXMusicServer" xml:space="preserve">
|
||||
<value>无法连接到 LX 音乐服务器,请转到设置 - 高级选项以检查是否正确输入链接</value>
|
||||
<value>无法连接到 LX 音乐服务器,请转到设置 - 播放源 - LX Music - LX 音乐服务器以检查是否正确输入链接</value>
|
||||
</data>
|
||||
<data name="FullscreenMode" xml:space="preserve">
|
||||
<value>全屏模式</value>
|
||||
@@ -384,10 +384,6 @@
|
||||
<data name="MainPageSplitView.Content" xml:space="preserve">
|
||||
<value>分屏视图</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Subtitle" xml:space="preserve">
|
||||
<value>单击左上按钮以启用沉浸式模式。
|
||||
如果遇到任何问题,请转到“设置”页面,关于标签,查看常见问题解答或联系作者以获取反馈</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
|
||||
<value>欢迎使用 BetterLyrics</value>
|
||||
</data>
|
||||
@@ -566,7 +562,7 @@
|
||||
<value>亚克力(薄层)</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
|
||||
<value>同时,将歌词背景中的纯色图层不透明度和专辑美术图层不透明度设置为 0 ,以获得正确的效果</value>
|
||||
<value>开启该项将覆盖歌词背景设置中的主题设置</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
|
||||
<value>适应环境色彩</value>
|
||||
@@ -586,6 +582,9 @@
|
||||
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
|
||||
<value>专辑</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
|
||||
<value>专辑图片高度</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
|
||||
<value>专辑艺术图层</value>
|
||||
</data>
|
||||
@@ -595,6 +594,9 @@
|
||||
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
|
||||
<value>专辑封面尺寸</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
|
||||
<value>专辑区域动效</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
|
||||
<value>专辑封面源</value>
|
||||
</data>
|
||||
@@ -607,6 +609,9 @@
|
||||
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
|
||||
<value>专辑区域样式</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlignment.Header" xml:space="preserve">
|
||||
<value>对齐方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageAmllTtmlDbBaseUrl.Header" xml:space="preserve">
|
||||
<value>基本 URL</value>
|
||||
</data>
|
||||
@@ -655,21 +660,27 @@
|
||||
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
|
||||
<value>歌词背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
|
||||
<value>模糊度</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderless.Header" xml:space="preserve">
|
||||
<value>无边框窗口</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
|
||||
<value>无边框歌词窗口快捷方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
|
||||
<value>底部间隙高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Description" xml:space="preserve">
|
||||
<value>包括日志文件,网络歌词缓存</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Header" xml:space="preserve">
|
||||
<value>缓存</value>
|
||||
</data>
|
||||
<data name="SettingsPageCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
</data>
|
||||
<data name="SettingsPageCheckShortcut.Content" xml:space="preserve">
|
||||
<value>检查快捷方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageChinese.Header" xml:space="preserve">
|
||||
<value>中文注音</value>
|
||||
</data>
|
||||
@@ -682,6 +693,9 @@
|
||||
<data name="SettingsPageCJK.Header" xml:space="preserve">
|
||||
<value>中日韩统一表意文字</value>
|
||||
</data>
|
||||
<data name="SettingsPageClear.Content" xml:space="preserve">
|
||||
<value>清除</value>
|
||||
</data>
|
||||
<data name="SettingsPageClearCache.Content" xml:space="preserve">
|
||||
<value>清除缓存文件</value>
|
||||
</data>
|
||||
@@ -691,6 +705,9 @@
|
||||
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
|
||||
<value>点击穿透快捷键</value>
|
||||
</data>
|
||||
<data name="SettingsPageCollapseDropdown.Content" xml:space="preserve">
|
||||
<value>折叠下拉列表</value>
|
||||
</data>
|
||||
<data name="SettingsPageCompactTitleBar.Content" xml:space="preserve">
|
||||
<value>紧凑</value>
|
||||
</data>
|
||||
@@ -706,6 +723,9 @@
|
||||
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
|
||||
<value>从模板创建</value>
|
||||
</data>
|
||||
<data name="SettingsPageCrossfade.Content" xml:space="preserve">
|
||||
<value>交叉淡入淡出</value>
|
||||
</data>
|
||||
<data name="SettingsPageCurrentLyricsWindowStatus.Text" xml:space="preserve">
|
||||
<value>当前歌词窗口状态</value>
|
||||
</data>
|
||||
@@ -859,6 +879,9 @@
|
||||
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
|
||||
<value>全屏模式</value>
|
||||
</data>
|
||||
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
|
||||
<value>一般布局系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageHeight.Header" xml:space="preserve">
|
||||
<value>高度</value>
|
||||
</data>
|
||||
@@ -871,6 +894,12 @@
|
||||
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
|
||||
<value>按住此处并拖动以排序</value>
|
||||
</data>
|
||||
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>水平布局系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
|
||||
<value>专辑图切换动画</value>
|
||||
</data>
|
||||
<data name="SettingsPageImport.Content" xml:space="preserve">
|
||||
<value>导入</value>
|
||||
</data>
|
||||
@@ -925,6 +954,9 @@
|
||||
<data name="SettingsPageLastFMUsername.Header" xml:space="preserve">
|
||||
<value>用户名</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayout.Text" xml:space="preserve">
|
||||
<value>布局</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayoutOrientation.Header" xml:space="preserve">
|
||||
<value>布局方向</value>
|
||||
</data>
|
||||
@@ -934,6 +966,12 @@
|
||||
<data name="SettingsPageLayoutOrientationVertical.Content" xml:space="preserve">
|
||||
<value>垂直</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeft.Content" xml:space="preserve">
|
||||
<value>靠左</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
|
||||
<value>左间隙区域宽度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
|
||||
<value>服务器地址</value>
|
||||
</data>
|
||||
@@ -962,28 +1000,25 @@
|
||||
<value>歌词背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
|
||||
<value>非当前播放区域</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
|
||||
<value>字体不透明度(非当前播放区域)</value>
|
||||
<value>非当前播放行</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
|
||||
<value>黑体</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmount.Header" xml:space="preserve">
|
||||
<value>模糊度</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
|
||||
<value>为非当前行启用模糊效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmountSideEffect.Text" xml:space="preserve">
|
||||
<value>调整该数值将同步提高专辑图片背景模糊强度</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurHighGPUUsage.Text" xml:space="preserve">
|
||||
<value>启用模糊(> 0)时将显著提升 GPU 占用率</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
|
||||
<value>模糊效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBold.Content" xml:space="preserve">
|
||||
<value>粗体</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
|
||||
<value>当前行位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
|
||||
<value>歌词区域宽度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
|
||||
<value>歌词动效</value>
|
||||
@@ -998,7 +1033,7 @@
|
||||
<value>超细</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
|
||||
<value>当前播放区域</value>
|
||||
<value>当前播放行</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
|
||||
<value>适应歌词背景(彩色)</value>
|
||||
@@ -1033,6 +1068,9 @@
|
||||
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
|
||||
<value>字体粗细</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Description" xml:space="preserve">
|
||||
<value>为持续时间较长的音节启用发光效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
|
||||
<value>辉光效果</value>
|
||||
</data>
|
||||
@@ -1063,17 +1101,14 @@
|
||||
<data name="SettingsPageLyricsNormal.Content" xml:space="preserve">
|
||||
<value>常规</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentChar.Content" xml:space="preserve">
|
||||
<value>当前字符</value>
|
||||
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
|
||||
<value>歌词区域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentLine.Content" xml:space="preserve">
|
||||
<value>当前行</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
|
||||
<value>为持续时间较长的音节启用缩放</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeLineStartToCurrentChar.Content" xml:space="preserve">
|
||||
<value>当前歌词开始到当前字符</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Header" xml:space="preserve">
|
||||
<value>缩放效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsSearchBestMatch.Content" xml:space="preserve">
|
||||
<value>最佳匹配</value>
|
||||
@@ -1156,6 +1191,12 @@
|
||||
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
|
||||
<value>云母(替代样式)</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
|
||||
<value>中间区域间隙宽度系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
|
||||
<value>中间间隙区域高度系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
|
||||
<value>播放测试音乐</value>
|
||||
</data>
|
||||
@@ -1261,6 +1302,9 @@
|
||||
<data name="SettingsPageReference.Header" xml:space="preserve">
|
||||
<value>参考链接</value>
|
||||
</data>
|
||||
<data name="SettingsPageRefreshDropdown.Content" xml:space="preserve">
|
||||
<value>刷新下拉列表</value>
|
||||
</data>
|
||||
<data name="SettingsPageRemoveInfo.Message" xml:space="preserve">
|
||||
<value>路径中的原始文件和文件夹不会被删除</value>
|
||||
</data>
|
||||
@@ -1273,6 +1317,12 @@
|
||||
<data name="SettingsPageRestart.Content" xml:space="preserve">
|
||||
<value>重启应用以应用更改</value>
|
||||
</data>
|
||||
<data name="SettingsPageRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
</data>
|
||||
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
|
||||
<value>右间隙区域宽度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageRomaji.Header" xml:space="preserve">
|
||||
<value>日语注音</value>
|
||||
</data>
|
||||
@@ -1342,9 +1392,15 @@
|
||||
<data name="SettingsPageShowInSwitchers.Header" xml:space="preserve">
|
||||
<value>在系统环境中显示</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowLayoutDragger.Header" xml:space="preserve">
|
||||
<value>显示布局拆分器</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowTitle.Header" xml:space="preserve">
|
||||
<value>显示标题</value>
|
||||
</data>
|
||||
<data name="SettingsPageSlide.Content" xml:space="preserve">
|
||||
<value>滑动</value>
|
||||
</data>
|
||||
<data name="SettingsPageSliderPrefix.Text" xml:space="preserve">
|
||||
<value>当前值: </value>
|
||||
</data>
|
||||
@@ -1354,18 +1410,6 @@
|
||||
<data name="SettingsPageSongInfo.Text" xml:space="preserve">
|
||||
<value>歌曲信息</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoAlignment.Header" xml:space="preserve">
|
||||
<value>对齐方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoLeft.Content" xml:space="preserve">
|
||||
<value>靠左</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongStatus.Header" xml:space="preserve">
|
||||
<value>当前歌曲</value>
|
||||
</data>
|
||||
@@ -1378,12 +1422,21 @@
|
||||
<data name="SettingsPageSpectrumLayerPlacement.Header" xml:space="preserve">
|
||||
<value>频谱位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
|
||||
<value>频谱风格</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
|
||||
<value>底部</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementTop.Content" xml:space="preserve">
|
||||
<value>顶部</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleBar.Content" xml:space="preserve">
|
||||
<value>柱形</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleCurve.Content" xml:space="preserve">
|
||||
<value>曲线</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpeed.Header" xml:space="preserve">
|
||||
<value>运动速率</value>
|
||||
</data>
|
||||
@@ -1426,6 +1479,15 @@
|
||||
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
|
||||
<value>切入与切出快捷键</value>
|
||||
</data>
|
||||
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
|
||||
<value>顶部间隙区域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
|
||||
<value>曲目摘要区域宽度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
|
||||
<value>曲目摘要区域高度系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
|
||||
<value>译文</value>
|
||||
</data>
|
||||
@@ -1444,6 +1506,9 @@
|
||||
<data name="SettingsPageVersion.Text" xml:space="preserve">
|
||||
<value>版本号</value>
|
||||
</data>
|
||||
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>垂直布局系数</value>
|
||||
</data>
|
||||
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
|
||||
<value>拉丁字母</value>
|
||||
</data>
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>畫中畫模式</value>
|
||||
</data>
|
||||
<data name="AppSettingsControlGeneral.Text" xml:space="preserve">
|
||||
<value>一般</value>
|
||||
<value>视窗</value>
|
||||
</data>
|
||||
<data name="ArtistsSplitHint.Text" xml:space="preserve">
|
||||
<value>鍵入多位藝術家時請以下述一種分隔符號分隔(不要混用)</value>
|
||||
@@ -166,7 +166,7 @@
|
||||
<value>導出成功</value>
|
||||
</data>
|
||||
<data name="FailToStartLXMusicServer" xml:space="preserve">
|
||||
<value>無法連接到 LX 音樂服務器,請轉到設置 - 高級選項以檢查是否正確輸入鏈接</value>
|
||||
<value>無法連接到LX 音樂伺服器,請前往設定- 播放來源- LX Music - LX 音樂伺服器以檢查是否正確輸入連結</value>
|
||||
</data>
|
||||
<data name="FullscreenMode" xml:space="preserve">
|
||||
<value>全螢幕模式</value>
|
||||
@@ -384,10 +384,6 @@
|
||||
<data name="MainPageSplitView.Content" xml:space="preserve">
|
||||
<value>分割畫面視圖</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Subtitle" xml:space="preserve">
|
||||
<value>單擊左上按鈕以啟用沉浸式模式。
|
||||
如果遇到任何問題,請轉到“設置”頁面,關於標籤,查看常見問題解答或聯繫作者以獲取反饋</value>
|
||||
</data>
|
||||
<data name="MainPageWelcomeTeachingTip.Title" xml:space="preserve">
|
||||
<value>歡迎使用 BetterLyrics</value>
|
||||
</data>
|
||||
@@ -566,7 +562,7 @@
|
||||
<value>亞克力(薄層)</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Description" xml:space="preserve">
|
||||
<value>同時,將歌詞背景中的純色圖層不透明度和專輯藝術圖層不透明度設置為 0 ,以獲得正確的效果</value>
|
||||
<value>開啟該項目將覆蓋歌詞背景設定中的主題設定</value>
|
||||
</data>
|
||||
<data name="SettingsPageAdaptEnvColor.Header" xml:space="preserve">
|
||||
<value>適應環境色彩</value>
|
||||
@@ -586,6 +582,9 @@
|
||||
<data name="SettingsPageAlbumArt.Text" xml:space="preserve">
|
||||
<value>專輯</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtHeight.Header" xml:space="preserve">
|
||||
<value>專輯圖片高度</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumArtLayer.Header" xml:space="preserve">
|
||||
<value>相簿藝術圖層</value>
|
||||
</data>
|
||||
@@ -595,6 +594,9 @@
|
||||
<data name="SettingsPageAlbumArtSize.Header" xml:space="preserve">
|
||||
<value>相簿藝術尺寸</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumEffect.Text" xml:space="preserve">
|
||||
<value>專輯區域動效</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlbumLib.Content" xml:space="preserve">
|
||||
<value>專輯封面來源</value>
|
||||
</data>
|
||||
@@ -607,6 +609,9 @@
|
||||
<data name="SettingsPageAlbumStyle.Text" xml:space="preserve">
|
||||
<value>專輯區域樣式</value>
|
||||
</data>
|
||||
<data name="SettingsPageAlignment.Header" xml:space="preserve">
|
||||
<value>對齊方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageAmllTtmlDbBaseUrl.Header" xml:space="preserve">
|
||||
<value>基本網址</value>
|
||||
</data>
|
||||
@@ -655,21 +660,27 @@
|
||||
<data name="SettingsPageBackgroundOverlay.Text" xml:space="preserve">
|
||||
<value>歌詞背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageBlurAmount.Header" xml:space="preserve">
|
||||
<value>模糊度</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderless.Header" xml:space="preserve">
|
||||
<value>無邊框窗口</value>
|
||||
</data>
|
||||
<data name="SettingsPageBorderlessHotKey.Header" xml:space="preserve">
|
||||
<value>無邊框歌詞視窗捷徑</value>
|
||||
</data>
|
||||
<data name="SettingsPageBottomGapFactor.Header" xml:space="preserve">
|
||||
<value>底部間隙高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Description" xml:space="preserve">
|
||||
<value>包括日誌文件,網絡歌詞緩存</value>
|
||||
</data>
|
||||
<data name="SettingsPageCache.Header" xml:space="preserve">
|
||||
<value>快取</value>
|
||||
</data>
|
||||
<data name="SettingsPageCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
</data>
|
||||
<data name="SettingsPageCheckShortcut.Content" xml:space="preserve">
|
||||
<value>檢查捷徑</value>
|
||||
</data>
|
||||
<data name="SettingsPageChinese.Header" xml:space="preserve">
|
||||
<value>中文注音</value>
|
||||
</data>
|
||||
@@ -682,6 +693,9 @@
|
||||
<data name="SettingsPageCJK.Header" xml:space="preserve">
|
||||
<value>中日韓統一表意文字</value>
|
||||
</data>
|
||||
<data name="SettingsPageClear.Content" xml:space="preserve">
|
||||
<value>清除</value>
|
||||
</data>
|
||||
<data name="SettingsPageClearCache.Content" xml:space="preserve">
|
||||
<value>清除快取檔案</value>
|
||||
</data>
|
||||
@@ -691,6 +705,9 @@
|
||||
<data name="SettingsPageClickThroughHotKey.Header" xml:space="preserve">
|
||||
<value>點選穿透快捷鍵</value>
|
||||
</data>
|
||||
<data name="SettingsPageCollapseDropdown.Content" xml:space="preserve">
|
||||
<value>收起下拉列表</value>
|
||||
</data>
|
||||
<data name="SettingsPageCompactTitleBar.Content" xml:space="preserve">
|
||||
<value>緊湊</value>
|
||||
</data>
|
||||
@@ -706,6 +723,9 @@
|
||||
<data name="SettingsPageCreateFromTemplates.Content" xml:space="preserve">
|
||||
<value>從範本建立</value>
|
||||
</data>
|
||||
<data name="SettingsPageCrossfade.Content" xml:space="preserve">
|
||||
<value>交叉淡入淡出</value>
|
||||
</data>
|
||||
<data name="SettingsPageCurrentLyricsWindowStatus.Text" xml:space="preserve">
|
||||
<value>當前歌詞窗口狀態</value>
|
||||
</data>
|
||||
@@ -859,6 +879,9 @@
|
||||
<data name="SettingsPageFullscreenMode.Text" xml:space="preserve">
|
||||
<value>全螢幕模式</value>
|
||||
</data>
|
||||
<data name="SettingsPageGeneralLayoutFactor.Text" xml:space="preserve">
|
||||
<value>一般布局系數</value>
|
||||
</data>
|
||||
<data name="SettingsPageHeight.Header" xml:space="preserve">
|
||||
<value>高度</value>
|
||||
</data>
|
||||
@@ -871,6 +894,12 @@
|
||||
<data name="SettingsPageHoldDragSort.Content" xml:space="preserve">
|
||||
<value>按住這裡並拖曳以進行排序</value>
|
||||
</data>
|
||||
<data name="SettingsPageHorizontalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>水平布局系數</value>
|
||||
</data>
|
||||
<data name="SettingsPageImageSwitchType.Header" xml:space="preserve">
|
||||
<value>專輯圖切換動畫</value>
|
||||
</data>
|
||||
<data name="SettingsPageImport.Content" xml:space="preserve">
|
||||
<value>匯入</value>
|
||||
</data>
|
||||
@@ -925,6 +954,9 @@
|
||||
<data name="SettingsPageLastFMUsername.Header" xml:space="preserve">
|
||||
<value>使用者名稱</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayout.Text" xml:space="preserve">
|
||||
<value>佈局</value>
|
||||
</data>
|
||||
<data name="SettingsPageLayoutOrientation.Header" xml:space="preserve">
|
||||
<value>版面配置方向</value>
|
||||
</data>
|
||||
@@ -934,6 +966,12 @@
|
||||
<data name="SettingsPageLayoutOrientationVertical.Content" xml:space="preserve">
|
||||
<value>縱向</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeft.Content" xml:space="preserve">
|
||||
<value>靠左</value>
|
||||
</data>
|
||||
<data name="SettingsPageLeftGapFactor.Header" xml:space="preserve">
|
||||
<value>左間隙區域寬度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLibreTranslateServer.Header" xml:space="preserve">
|
||||
<value>服務器地址</value>
|
||||
</data>
|
||||
@@ -962,28 +1000,25 @@
|
||||
<value>歌詞背景</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontColor.Header" xml:space="preserve">
|
||||
<value>非當前播放區域</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBgFontOpacity.Header" xml:space="preserve">
|
||||
<value>字體不透明度(非目前播放區域)</value>
|
||||
<value>非目前播放行</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlack.Content" xml:space="preserve">
|
||||
<value>黑體</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmount.Header" xml:space="preserve">
|
||||
<value>模糊度</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Description" xml:space="preserve">
|
||||
<value>為非目前行啟用模糊效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurAmountSideEffect.Text" xml:space="preserve">
|
||||
<value>調整此數值將同步提升專輯圖片背景模糊強度</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBlurHighGPUUsage.Text" xml:space="preserve">
|
||||
<value>啟用模糊(> 0)時將顯著提升 GPU 佔用率</value>
|
||||
<data name="SettingsPageLyricsBlurEffect.Header" xml:space="preserve">
|
||||
<value>模糊效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsBold.Content" xml:space="preserve">
|
||||
<value>粗體</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
<data name="SettingsPageLyricsCenterTopOffset.Header" xml:space="preserve">
|
||||
<value>目前行位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsColFactor.Header" xml:space="preserve">
|
||||
<value>歌詞區域寬度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsEffect.Text" xml:space="preserve">
|
||||
<value>歌詞動效</value>
|
||||
@@ -998,7 +1033,7 @@
|
||||
<value>超細</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColor.Header" xml:space="preserve">
|
||||
<value>當前播放區域</value>
|
||||
<value>目前播放行</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsFgFontColorAdaptiveColored.Content" xml:space="preserve">
|
||||
<value>適應歌詞背景(彩色)</value>
|
||||
@@ -1033,6 +1068,9 @@
|
||||
<data name="SettingsPageLyricsFontWeight.Header" xml:space="preserve">
|
||||
<value>字體粗細</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Description" xml:space="preserve">
|
||||
<value>為持續時間較長的音節啟用發光效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsGlowEffect.Header" xml:space="preserve">
|
||||
<value>輝光效果</value>
|
||||
</data>
|
||||
@@ -1063,17 +1101,14 @@
|
||||
<data name="SettingsPageLyricsNormal.Content" xml:space="preserve">
|
||||
<value>常規</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentChar.Content" xml:space="preserve">
|
||||
<value>目前字元</value>
|
||||
<data name="SettingsPageLyricsRowFactor.Header" xml:space="preserve">
|
||||
<value>歌詞區域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeCurrentLine.Content" xml:space="preserve">
|
||||
<value>目前行</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Description" xml:space="preserve">
|
||||
<value>啟用長期音節的縮放功能</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRendingScopeLineStartToCurrentChar.Content" xml:space="preserve">
|
||||
<value>當前歌詞開始到當前字符</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
<data name="SettingsPageLyricsScaleEffect.Header" xml:space="preserve">
|
||||
<value>縮放效果</value>
|
||||
</data>
|
||||
<data name="SettingsPageLyricsSearchBestMatch.Content" xml:space="preserve">
|
||||
<value>最佳匹配</value>
|
||||
@@ -1156,6 +1191,12 @@
|
||||
<data name="SettingsPageMicaAlt.Content" xml:space="preserve">
|
||||
<value>雲母(替代樣式)</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapColFactor.Header" xml:space="preserve">
|
||||
<value>中間區域間隙寬度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageMiddleGapRowFactor.Header" xml:space="preserve">
|
||||
<value>中間間隙區域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageMockMusicPlaying.Header" xml:space="preserve">
|
||||
<value>播放測試音樂</value>
|
||||
</data>
|
||||
@@ -1261,6 +1302,9 @@
|
||||
<data name="SettingsPageReference.Header" xml:space="preserve">
|
||||
<value>參考數據</value>
|
||||
</data>
|
||||
<data name="SettingsPageRefreshDropdown.Content" xml:space="preserve">
|
||||
<value>刷新下拉列表</value>
|
||||
</data>
|
||||
<data name="SettingsPageRemoveInfo.Message" xml:space="preserve">
|
||||
<value>路徑中的原始檔案和資料夾不會被刪除</value>
|
||||
</data>
|
||||
@@ -1273,6 +1317,12 @@
|
||||
<data name="SettingsPageRestart.Content" xml:space="preserve">
|
||||
<value>重啟應用程式以應用更改</value>
|
||||
</data>
|
||||
<data name="SettingsPageRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
</data>
|
||||
<data name="SettingsPageRightGapFactor.Header" xml:space="preserve">
|
||||
<value>右間隙區域寬度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageRomaji.Header" xml:space="preserve">
|
||||
<value>日語注音</value>
|
||||
</data>
|
||||
@@ -1331,7 +1381,7 @@
|
||||
<value>顯示專輯</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowArtists.Header" xml:space="preserve">
|
||||
<value>界面設計</value>
|
||||
<value>顯示藝術家</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowHideHotKey.Header" xml:space="preserve">
|
||||
<value>歌詞窗口顯示和隱藏快捷鍵</value>
|
||||
@@ -1342,9 +1392,15 @@
|
||||
<data name="SettingsPageShowInSwitchers.Header" xml:space="preserve">
|
||||
<value>在系統環境中顯示</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowLayoutDragger.Header" xml:space="preserve">
|
||||
<value>顯示佈局拆分器</value>
|
||||
</data>
|
||||
<data name="SettingsPageShowTitle.Header" xml:space="preserve">
|
||||
<value>顯示標題</value>
|
||||
</data>
|
||||
<data name="SettingsPageSlide.Content" xml:space="preserve">
|
||||
<value>滑動</value>
|
||||
</data>
|
||||
<data name="SettingsPageSliderPrefix.Text" xml:space="preserve">
|
||||
<value>目前值: </value>
|
||||
</data>
|
||||
@@ -1354,18 +1410,6 @@
|
||||
<data name="SettingsPageSongInfo.Text" xml:space="preserve">
|
||||
<value>歌曲資訊</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoAlignment.Header" xml:space="preserve">
|
||||
<value>對齊方式</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoCenter.Content" xml:space="preserve">
|
||||
<value>居中</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoLeft.Content" xml:space="preserve">
|
||||
<value>靠左</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongInfoRight.Content" xml:space="preserve">
|
||||
<value>靠右</value>
|
||||
</data>
|
||||
<data name="SettingsPageSongStatus.Header" xml:space="preserve">
|
||||
<value>當前歌曲</value>
|
||||
</data>
|
||||
@@ -1378,12 +1422,21 @@
|
||||
<data name="SettingsPageSpectrumLayerPlacement.Header" xml:space="preserve">
|
||||
<value>頻譜位置</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumLayerStyle.Header" xml:space="preserve">
|
||||
<value>頻譜風格</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementBottom.Content" xml:space="preserve">
|
||||
<value>底部</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumPlacementTop.Content" xml:space="preserve">
|
||||
<value>頂部</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleBar.Content" xml:space="preserve">
|
||||
<value>柱形</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpectrumStyleCurve.Content" xml:space="preserve">
|
||||
<value>曲線</value>
|
||||
</data>
|
||||
<data name="SettingsPageSpeed.Header" xml:space="preserve">
|
||||
<value>動作速率</value>
|
||||
</data>
|
||||
@@ -1426,6 +1479,15 @@
|
||||
<data name="SettingsPageToggleHotKey.Header" xml:space="preserve">
|
||||
<value>切入與切出快捷鍵</value>
|
||||
</data>
|
||||
<data name="SettingsPageTopGapFactor.Header" xml:space="preserve">
|
||||
<value>頂部間隙區域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryColFactor.Header" xml:space="preserve">
|
||||
<value>曲目摘要區域寬度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageTrackSummaryRowFactor.Header" xml:space="preserve">
|
||||
<value>曲目摘要區域高度因子</value>
|
||||
</data>
|
||||
<data name="SettingsPageTranslatedText.Header" xml:space="preserve">
|
||||
<value>譯文</value>
|
||||
</data>
|
||||
@@ -1444,6 +1506,9 @@
|
||||
<data name="SettingsPageVersion.Text" xml:space="preserve">
|
||||
<value>版本號</value>
|
||||
</data>
|
||||
<data name="SettingsPageVerticalLayoutFactor.Text" xml:space="preserve">
|
||||
<value>垂直布局系數</value>
|
||||
</data>
|
||||
<data name="SettingsPageWesternChar.Header" xml:space="preserve">
|
||||
<value>拉丁字母</value>
|
||||
</data>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
{
|
||||
public void CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
|
||||
{
|
||||
_logger.LogInformation("Creating resources... Reason: {Reason}", args.Reason);
|
||||
switch (args.Reason)
|
||||
{
|
||||
case Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesReason.FirstTime:
|
||||
_isDeviceChanged = true;
|
||||
break;
|
||||
case Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesReason.NewDevice:
|
||||
_isDeviceChanged = true;
|
||||
break;
|
||||
case Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesReason.DpiChanged:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,564 +0,0 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Brushes;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics.Effects;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
{
|
||||
public void Draw(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
// Blurred lyrics layer
|
||||
using var blurredLyrics = new CanvasCommandList(control);
|
||||
using (var blurredLyricsDs = blurredLyrics.CreateDrawingSession())
|
||||
{
|
||||
DrawBlurredLyrics(control, blurredLyricsDs);
|
||||
//DrawBlurredLyrics2(control, blurredLyricsDs);
|
||||
}
|
||||
|
||||
using var combined = new CanvasCommandList(control);
|
||||
using var combinedDs = combined.CreateDrawingSession();
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.IsPureColorOverlayEnabled)
|
||||
{
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.IsAdaptToEnvironment)
|
||||
{
|
||||
FillBackground(combinedDs, _immersiveBgColorTransition.Value, 0f,
|
||||
_immersiveBgOpacityTransition.Value * _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PureColorOverlayOpacity / 100f);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillBackground(combinedDs, _albumArtAccentColor1Transition.Value, 0f,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.PureColorOverlayOpacity / 100.0);
|
||||
}
|
||||
}
|
||||
DrawAlbumArtBackground(control, combinedDs);
|
||||
DrawFluidBackground(control, combinedDs);
|
||||
DrawSpectrum(control, combinedDs);
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.Is3DLyricsEnabled)
|
||||
{
|
||||
combinedDs.DrawImage(new Transform3DEffect
|
||||
{
|
||||
Source = blurredLyrics,
|
||||
TransformMatrix = _lyrics3DMatrix
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
combinedDs.DrawImage(blurredLyrics);
|
||||
}
|
||||
|
||||
ds.DrawImage(combined);
|
||||
|
||||
DrawAlbumArt(control, ds);
|
||||
DrawSongInfo(ds);
|
||||
|
||||
DrawSnowEffect(ds);
|
||||
DrawFogEffect(ds);
|
||||
//DrawRaindropEffect(ds, combined);
|
||||
|
||||
if (_isDebugOverlayEnabled)
|
||||
{
|
||||
_drawFrameCount++;
|
||||
|
||||
var currentPlayingLine = _currentLyricsData?.LyricsLines.ElementAtOrDefault(_playingLineIndex);
|
||||
|
||||
if (currentPlayingLine != null)
|
||||
{
|
||||
GetLinePlayingProgress(
|
||||
_playingLineIndex,
|
||||
out int charStartIndex,
|
||||
out int charLength,
|
||||
out double charProgress
|
||||
);
|
||||
|
||||
ds.DrawText(
|
||||
$"[DEBUG]\n" +
|
||||
$"Canvas size: {_canvasWidth}x{_canvasHeight}\n" +
|
||||
$"FPS (Draw): {_displayedDrawFrameCount}\n" +
|
||||
$"Playing line: {_playingLineIndex}\n" +
|
||||
$"Syllable start idx: {charStartIndex}\n" +
|
||||
$"Syllable len: {charLength}\n" +
|
||||
$"Syllable prog: {charProgress}\n" +
|
||||
$"Visible lines: [{_startVisibleLineIndex}, {_endVisibleLineIndex}]\n" +
|
||||
$"Total line count: {GetMaxLyricsLineIndexBoundaries().Item2 + 1}\n" +
|
||||
$"Cur time: {TotalTime + TimeSpan.FromMilliseconds(_mediaSessionsService.CurrentMediaSourceProviderInfo?.PositionOffset ?? 0)}\n" +
|
||||
$"Song duration: {TimeSpan.FromMilliseconds(_mediaSessionsService.CurrentSongInfo?.DurationMs ?? 0)}\n" +
|
||||
$"Y offset: {_canvasYScrollTransition.Value}",
|
||||
new Vector2(10, 40),
|
||||
ThemeTypeSent == Microsoft.UI.Xaml.ElementTheme.Light ? Colors.Black : Colors.White,
|
||||
_debugTextFormat
|
||||
);
|
||||
}
|
||||
|
||||
if (_drawFrameStopwatch?.Elapsed.TotalSeconds >= 1.0)
|
||||
{
|
||||
_displayedDrawFrameCount = _drawFrameCount;
|
||||
_drawFrameStopwatch?.Restart();
|
||||
_drawFrameCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawSpectrum(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_spectrumGeometry != null)
|
||||
{
|
||||
var gradientStops = new CanvasGradientStop[]
|
||||
{
|
||||
new() { Position = 0.0f, Color = Colors.Transparent },
|
||||
new() { Position = 0.7f, Color = Colors.Transparent },
|
||||
new() { Position = 1.0f, Color = _adaptiveColoredFontColor ?? _albumArtAccentColor1Transition.Value }
|
||||
};
|
||||
|
||||
using var gradientBrush = new CanvasLinearGradientBrush(ds, gradientStops);
|
||||
|
||||
switch (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.SpectrumPlacement)
|
||||
{
|
||||
case SpectrumPlacement.Top:
|
||||
gradientBrush.StartPoint = new Vector2(0, (float)_canvasHeight);
|
||||
gradientBrush.EndPoint = new Vector2(0, 0);
|
||||
break;
|
||||
case SpectrumPlacement.Bottom:
|
||||
gradientBrush.StartPoint = new Vector2(0, 0);
|
||||
gradientBrush.EndPoint = new Vector2(0, (float)_canvasHeight);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 使用渐变画刷填充
|
||||
ds.FillGeometry(_spectrumGeometry, gradientBrush);
|
||||
|
||||
// 纯色
|
||||
//ds.FillGeometry(geometry, _adaptiveColoredFontColor ?? _albumArtAccentColor1Transition.Value);
|
||||
|
||||
// 绘制轮廓线
|
||||
//var lineColor = Colors.SkyBlue;
|
||||
//float strokeWidth = 2f;
|
||||
//ds.DrawGeometry(geometry, _albumArtAccentColor4Transition.Value, strokeWidth);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFluidBackground(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_fluidEffect != null && _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.IsFluidOverlayEnabled)
|
||||
{
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = _fluidEffect,
|
||||
Opacity = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.FluidOverlayOpacity / 100f
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawBackgroundImgae(OpacityEffect effect, CanvasDrawingSession ds, CanvasBitmap canvasBitmap)
|
||||
{
|
||||
double imageWidth = (double)canvasBitmap.Size.Width;
|
||||
double imageHeight = (double)canvasBitmap.Size.Height;
|
||||
|
||||
double targetSize = Math.Sqrt(Math.Pow(_canvasWidth, 2) + Math.Pow(_canvasHeight, 2));
|
||||
double scaleFactor = targetSize / Math.Min(imageWidth, imageHeight);
|
||||
|
||||
double x = _canvasWidth / 2 - imageWidth * scaleFactor / 2;
|
||||
double y = _canvasHeight / 2 - imageHeight * scaleFactor / 2;
|
||||
|
||||
ds.DrawImage(effect, new Vector2((float)x, (float)y));
|
||||
}
|
||||
|
||||
private void DrawAlbumArtBackground(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.IsCoverOverlayEnabled)
|
||||
{
|
||||
ds.Transform = Matrix3x2.CreateRotation((float)_rotateAngle, control.Size.ToVector2() * 0.5f);
|
||||
|
||||
if (_isAlbumArtBgEffectChanged && _albumArtBgEffect != null)
|
||||
{
|
||||
ds.DrawImage(_albumArtBgEffect);
|
||||
}
|
||||
else if (!_isAlbumArtBgEffectChanged && _albumArtBgRenderTarget != null)
|
||||
{
|
||||
double targetSize = Math.Sqrt(Math.Pow(_canvasWidth, 2) + Math.Pow(_canvasHeight, 2));
|
||||
float offsetX = (float)(_canvasWidth - targetSize) / 2;
|
||||
float offsetY = (float)(_canvasHeight - targetSize) / 2;
|
||||
|
||||
ds.DrawImage(_albumArtBgRenderTarget, new Vector2(offsetX, offsetY));
|
||||
}
|
||||
|
||||
ds.Transform = Matrix3x2.Identity;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawAlbumArt(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
// 专辑图封面正在变动,需实时绘制
|
||||
if (_isAlbumArtEffectChanged && _albumArtEffect != null)
|
||||
{
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = _albumArtEffect,
|
||||
Opacity = (float)_albumArtOpacityTransition.Value
|
||||
}, new Vector2((float)_albumArtXTransition.Value, (float)_albumArtYTransition.Value));
|
||||
}
|
||||
// 专辑图封面不再变动,使用已保存的绘制
|
||||
else if (!_isAlbumArtEffectChanged && _albumArtRenderTarget != null)
|
||||
{
|
||||
// 这里给一个相反的偏移以恢复位置
|
||||
ds.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = _albumArtRenderTarget,
|
||||
Opacity = (float)_albumArtOpacityTransition.Value
|
||||
}, new Vector2((float)_albumArtXTransition.Value, (float)_albumArtYTransition.Value) -
|
||||
control.Size.ToVector2() / 2 + new Vector2((float)_albumArtSize, (float)_albumArtSize) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSongInfo(CanvasDrawingSession ds)
|
||||
{
|
||||
if (_maxSongInfoWidth <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawSingleSongInfo(ds, _lastTitleTextLayout, _lastArtistTextLayout, _lastAlbumTextLayout, 1 - _songInfoOpacityTransition.Value);
|
||||
DrawSingleSongInfo(ds, _titleTextLayout, _artistTextLayout, _albumTextLayout, _songInfoOpacityTransition.Value);
|
||||
}
|
||||
|
||||
private void DrawSingleSongInfo(CanvasDrawingSession ds, CanvasTextLayout? titleLayout, CanvasTextLayout? artistLayout, CanvasTextLayout? albumLayout, double opacity)
|
||||
{
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.ShowTitle && titleLayout != null)
|
||||
{
|
||||
double y = _titleYTransition.Value;
|
||||
|
||||
ds.DrawTextLayout(
|
||||
titleLayout,
|
||||
new Vector2((float)_titleXTransition.Value, (float)y),
|
||||
_bgFontColor.WithAlpha((byte)(_albumArtOpacityTransition.Value * 255 * opacity)));
|
||||
|
||||
y += titleLayout.LayoutBounds.Height;
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.ShowArtists && artistLayout != null)
|
||||
{
|
||||
ds.DrawTextLayout(
|
||||
artistLayout,
|
||||
new Vector2((float)_titleXTransition.Value, (float)y),
|
||||
_bgFontColor.WithAlpha((byte)(_albumArtOpacityTransition.Value * 128 * opacity)));
|
||||
|
||||
y += artistLayout.LayoutBounds.Height;
|
||||
}
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.ShowAlbum && albumLayout != null)
|
||||
{
|
||||
ds.DrawTextLayout(
|
||||
albumLayout,
|
||||
new Vector2((float)_titleXTransition.Value, (float)y),
|
||||
_bgFontColor.WithAlpha((byte)(_albumArtOpacityTransition.Value * 64 * opacity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawBlurredLyrics(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
var currentPlayingLine = _currentLyricsData?.LyricsLines.ElementAtOrDefault(_playingLineIndex);
|
||||
|
||||
if (currentPlayingLine == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = _startVisibleLineIndex; i <= _endVisibleLineIndex; i++)
|
||||
{
|
||||
var line = _currentLyricsData?.LyricsLines.ElementAtOrDefault(i);
|
||||
if (line == null) continue;
|
||||
|
||||
var textLayout = line.OriginalCanvasTextLayout;
|
||||
if (textLayout == null) continue;
|
||||
|
||||
double layoutWidth = (double)textLayout.LayoutBounds.Width;
|
||||
double layoutHeight = (double)textLayout.LayoutBounds.Height;
|
||||
|
||||
if (layoutWidth <= 0 || layoutHeight <= 0) continue;
|
||||
|
||||
double yOffset = line.YOffsetTransition.Value + _canvasHeight / 2 + _lyricsYTransition.Value;
|
||||
|
||||
//// 组合变换:缩放 -> 旋转 -> 平移
|
||||
ds.Transform =
|
||||
Matrix3x2.CreateScale((float)line.ScaleTransition.Value, line.CenterPosition) *
|
||||
Matrix3x2.CreateRotation(
|
||||
(float)line.AngleTransition.Value,
|
||||
currentPlayingLine.OriginalPosition.WithX(_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.FanLyricsAngle < 0 ? (float)_maxLyricsWidth : 0)) *
|
||||
Matrix3x2.CreateTranslation((float)_lyricsX, (float)yOffset);
|
||||
|
||||
using var combined = new CanvasCommandList(control);
|
||||
using var combinedDs = combined.CreateDrawingSession();
|
||||
|
||||
// 先铺一层带默认透明度的已经加了模糊效果的歌词作为最底层(背景歌词层次)
|
||||
using var backgroundFontEffect = CanvasHelper.CreateFontEffect(line, control, _strokeFontColor,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsFontStrokeWidth, _bgFontColor);
|
||||
|
||||
using var backgroundEffect = CanvasHelper.CreateBackgroundEffect(line, backgroundFontEffect, _lyricsOpacityTransition.Value);
|
||||
combinedDs.DrawImage(backgroundEffect);
|
||||
|
||||
if (line.HighlightOpacityTransition.Value != 0)
|
||||
{
|
||||
GetLinePlayingProgress(i, out int charStartIndex, out int charLength, out double charProgress);
|
||||
|
||||
using var charMask = CanvasHelper.CreateCharMask(control, line, charStartIndex, charLength, charProgress);
|
||||
using var lineStartToCharMask = CanvasHelper.CreateLineStartToCharMask(control, line, charStartIndex, charLength, charProgress,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.IsLyricsLineFadeEnabled);
|
||||
using var lineMask = CanvasHelper.CreateLineMask(control, line);
|
||||
|
||||
using var foregroundFontEffect = CanvasHelper.CreateFontEffect(line, control, _strokeFontColor,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsStyleSettings.LyricsFontStrokeWidth, _fgFontColor);
|
||||
|
||||
using var effectLayer = new CanvasCommandList(control);
|
||||
using var effectLayerDs = effectLayer.CreateDrawingSession();
|
||||
if (line.PhoneticText != "" && _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.PhoneticLyricsHighlightAmount != 0)
|
||||
{
|
||||
using var phoneticHighlightMask = CanvasHelper.CreatePhoneticHighlightMask(control, line);
|
||||
using var foregroundPhoneticHighlightEffect = CanvasHelper.CreateForegroundHighlightEffect(foregroundFontEffect, phoneticHighlightMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.PhoneticLyricsHighlightAmount / 100.0);
|
||||
effectLayerDs.DrawImage(foregroundPhoneticHighlightEffect);
|
||||
}
|
||||
if (line.TranslatedText != "" && _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.TranslatedLyricsHighlightAmount != 0)
|
||||
{
|
||||
using var translatedHighlightMask = CanvasHelper.CreateTranslatedHighlightMask(control, line);
|
||||
using var foregroundTranslatedHighlightEffect = CanvasHelper.CreateForegroundHighlightEffect(foregroundFontEffect, translatedHighlightMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.TranslatedLyricsHighlightAmount / 100.0);
|
||||
effectLayerDs.DrawImage(foregroundTranslatedHighlightEffect);
|
||||
}
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.IsLyricsShadowEnabled)
|
||||
{
|
||||
var shadowEffectMask = CanvasHelper.GetAlphaMask(control, charMask, lineStartToCharMask, lineMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsShadowScope);
|
||||
using var foregroundShadowEffect = CanvasHelper.CreateForegroundShadowEffect(foregroundFontEffect, shadowEffectMask,
|
||||
_albumArtAccentColor1Transition.Value, _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsShadowAmount);
|
||||
effectLayerDs.DrawImage(foregroundShadowEffect);
|
||||
}
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.IsLyricsGlowEffectEnabled)
|
||||
{
|
||||
var blurEffectMask = CanvasHelper.GetAlphaMask(control, charMask, lineStartToCharMask, lineMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsGlowEffectScope);
|
||||
using var foregroundBlurEffect = CanvasHelper.CreateForegroundBlurEffect(foregroundFontEffect, blurEffectMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsGlowEffectAmount);
|
||||
effectLayerDs.DrawImage(foregroundBlurEffect);
|
||||
}
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.OriginalLyricsHighlightAmount != 0)
|
||||
{
|
||||
var highlightEffectMask = CanvasHelper.GetAlphaMask(control, charMask, lineStartToCharMask, lineMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.OriginalLyricsHighlightScope);
|
||||
using var foregroundHighlightEffect = CanvasHelper.CreateForegroundHighlightEffect(foregroundFontEffect, highlightEffectMask,
|
||||
_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.OriginalLyricsHighlightAmount / 100.0);
|
||||
effectLayerDs.DrawImage(foregroundHighlightEffect);
|
||||
}
|
||||
|
||||
combinedDs.DrawImage(new OpacityEffect
|
||||
{
|
||||
Source = effectLayer,
|
||||
Opacity = (float)Math.Max(line.HighlightOpacityTransition.Value * _lyricsOpacityTransition.Value, 0),
|
||||
});
|
||||
|
||||
if (i == _playingLineIndex)
|
||||
{
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.IsLyricsFloatAnimationEnabled)
|
||||
{
|
||||
ds.DrawImage(new DisplacementMapEffect
|
||||
{
|
||||
Source = combined,
|
||||
Displacement = lineStartToCharMask,
|
||||
XChannelSelect = EffectChannelSelect.Red,
|
||||
YChannelSelect = EffectChannelSelect.Alpha,
|
||||
Amount = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsEffectSettings.LyricsFloatAmount,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ds.DrawImage(combined);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ds.DrawImage(combined);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ds.DrawImage(combined);
|
||||
}
|
||||
|
||||
// Reset scale
|
||||
ds.Transform = Matrix3x2.Identity;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawBlurredLyrics2(ICanvasAnimatedControl control, CanvasDrawingSession ds)
|
||||
{
|
||||
var currentPlayingLine = _currentLyricsData?.LyricsLines.ElementAtOrDefault(_playingLineIndex);
|
||||
if (currentPlayingLine == null) return;
|
||||
|
||||
var settings = _liveStatesService.LiveStates.LyricsWindowStatus;
|
||||
var effectSettings = settings.LyricsEffectSettings;
|
||||
bool isKaraokeEnabled = effectSettings.IsLyricsLineFadeEnabled;
|
||||
var styleSettings = settings.LyricsStyleSettings; // 获取样式设置(描边宽等)
|
||||
|
||||
for (int i = _startVisibleLineIndex; i <= _endVisibleLineIndex; i++)
|
||||
{
|
||||
var line = _currentLyricsData?.LyricsLines.ElementAtOrDefault(i);
|
||||
if (line == null || line.OriginalCanvasTextLayout == null) continue;
|
||||
|
||||
var textLayout = line.OriginalCanvasTextLayout;
|
||||
|
||||
// === 1. 恢复您原始的矩阵变换逻辑 ===
|
||||
// 不要减去 CenterPosition,保持和您原始代码一致
|
||||
double yOffset = line.YOffsetTransition.Value + _canvasHeight / 2 + _lyricsYTransition.Value;
|
||||
float fanAngleX = effectSettings.FanLyricsAngle < 0 ? (float)_maxLyricsWidth : 0;
|
||||
|
||||
ds.Transform =
|
||||
Matrix3x2.CreateScale((float)line.ScaleTransition.Value, line.CenterPosition)
|
||||
* Matrix3x2.CreateRotation((float)line.AngleTransition.Value,
|
||||
currentPlayingLine.OriginalPosition.WithX(fanAngleX))
|
||||
* Matrix3x2.CreateTranslation((float)_lyricsX, (float)yOffset);
|
||||
|
||||
// === 2. 坐标关键:必须使用 line.OriginalPosition ===
|
||||
// CanvasHelper 里是画在 OriginalPosition 上的,我们这里必须一致
|
||||
var drawPos = line.OriginalPosition;
|
||||
|
||||
// A. 绘制阴影 (优化:直接绘制,替代 ShadowEffect)
|
||||
if (effectSettings.IsLyricsShadowEnabled)
|
||||
{
|
||||
var shadowColor = _albumArtAccentColor1Transition.Value.WithAlpha((byte)(effectSettings.LyricsShadowAmount * 255));
|
||||
// 偏移 2px 绘制阴影
|
||||
ds.DrawTextLayout(textLayout, drawPos.X + 2f, drawPos.Y + 2f, shadowColor);
|
||||
}
|
||||
|
||||
// B. 绘制描边 (如果设置里有)
|
||||
// 对应 CanvasHelper.CreateFontEffect 里的 stroke 逻辑
|
||||
if (styleSettings.LyricsFontStrokeWidth > 0)
|
||||
{
|
||||
// 注意:DrawTextLayout 不支持直接描边,需要用 DrawGeometry
|
||||
// 如果这一步很卡,可以考虑去掉描边,或者只对当前行描边
|
||||
if (line.OriginalCanvasGeometry != null)
|
||||
{
|
||||
ds.DrawGeometry(line.OriginalCanvasGeometry, drawPos, _strokeFontColor, styleSettings.LyricsFontStrokeWidth);
|
||||
}
|
||||
}
|
||||
|
||||
// C. 绘制底层文本 (底色)
|
||||
// 对应 CanvasHelper 里的 DrawTextLayout
|
||||
var baseColor = _strokeFontColor.WithAlpha((byte)(_strokeFontColor.A * _lyricsOpacityTransition.Value));
|
||||
ds.DrawTextLayout(textLayout, drawPos, baseColor);
|
||||
|
||||
|
||||
// D. 绘制高亮/卡拉OK效果 (核心优化点)
|
||||
if (line.HighlightOpacityTransition.Value > 0)
|
||||
{
|
||||
GetLinePlayingProgress(i, out int charStartIndex, out int charLength, out double charProgress);
|
||||
|
||||
// 整行高亮或非逐字模式
|
||||
if (charStartIndex >= line.OriginalText.Length || !isKaraokeEnabled)
|
||||
{
|
||||
var hlColor = _fgFontColor.WithAlpha((byte)(_fgFontColor.A * line.HighlightOpacityTransition.Value));
|
||||
ds.DrawTextLayout(textLayout, drawPos, hlColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// === 计算裁剪区域 (照搬 CreateCharMask 的逻辑) ===
|
||||
var regions = textLayout.GetCharacterRegions(charStartIndex, 1);
|
||||
|
||||
// 默认裁剪宽度覆盖到当前字之前
|
||||
double validWidth = 0;
|
||||
if (regions.Length > 0)
|
||||
{
|
||||
var region = regions[0];
|
||||
// CanvasHelper 里的逻辑:region.LayoutBounds.X 是相对于 Layout 左上角的
|
||||
// highlightWidth = TotalWidth * Progress
|
||||
double highlightWidth = region.LayoutBounds.Width * charProgress;
|
||||
|
||||
// 当前高亮的总右边界 = 当前字左边 + 当前字播放过的宽度
|
||||
validWidth = region.LayoutBounds.X + highlightWidth;
|
||||
}
|
||||
else if (charStartIndex > 0)
|
||||
{
|
||||
// 容错:如果取不到当前字区域(例如空格),取上一个字的右边缘
|
||||
var prevRegions = textLayout.GetCharacterRegions(charStartIndex - 1, 1);
|
||||
if (prevRegions.Length > 0) validWidth = prevRegions[0].LayoutBounds.Right;
|
||||
}
|
||||
|
||||
if (validWidth > 0)
|
||||
{
|
||||
// === 创建 Layer 进行裁剪 ===
|
||||
// 裁剪矩形的 X/Y 必须加上 drawPos (OriginalPosition)
|
||||
// 因为 CreateLayer 是基于当前 Transform 的全局坐标
|
||||
var clipRect = new Rect(
|
||||
drawPos.X, // 从文字绘制起点的 X 开始
|
||||
drawPos.Y, // 从文字绘制起点的 Y 开始
|
||||
validWidth, // 宽度
|
||||
textLayout.LayoutBounds.Height // 高度
|
||||
);
|
||||
|
||||
using (ds.CreateLayer(1.0f, clipRect))
|
||||
{
|
||||
var hlColor = _fgFontColor.WithAlpha((byte)(_fgFontColor.A * line.HighlightOpacityTransition.Value));
|
||||
ds.DrawTextLayout(textLayout, drawPos, hlColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重置变换,准备画下一行
|
||||
ds.Transform = Matrix3x2.Identity;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSnowEffect(CanvasDrawingSession ds)
|
||||
{
|
||||
if (_snowEffect != null && _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.IsSnowFlakeOverlayEnabled)
|
||||
{
|
||||
ds.DrawImage(_snowEffect);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFogEffect(CanvasDrawingSession ds)
|
||||
{
|
||||
if (_fogEffect != null && _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.IsFogOverlayEnabled)
|
||||
{
|
||||
ds.DrawImage(_fogEffect);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawRaindropEffect(CanvasDrawingSession ds, IGraphicsEffectSource source)
|
||||
{
|
||||
if (_raindropEffect != null)
|
||||
{
|
||||
_raindropEffect.Sources[0] = source;
|
||||
ds.DrawImage(_raindropEffect);
|
||||
}
|
||||
}
|
||||
|
||||
private void FillBackground(CanvasDrawingSession ds, Color color, double radius, double opacity)
|
||||
{
|
||||
ds.FillRoundedRectangle(
|
||||
new Rect(0, 0, _canvasWidth, _canvasHeight),
|
||||
(float)radius,
|
||||
(float)radius,
|
||||
color.WithAlpha((byte)(opacity * 255))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,308 +0,0 @@
|
||||
using BetterLyrics.WinUI3.Extensions;
|
||||
using BetterLyrics.WinUI3.Shaders;
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
{
|
||||
private OpacityEffect? _albumArtBgEffect;
|
||||
private CanvasCommandList? _albumArtEffect;
|
||||
private PixelShaderEffect? _fluidEffect;
|
||||
private PixelShaderEffect<SnowEffect>? _snowEffect;
|
||||
private PixelShaderEffect<FogEffect>? _fogEffect;
|
||||
private PixelShaderEffect<RaindropEffect>? _raindropEffect;
|
||||
|
||||
private OpacityEffect CreateBgImageEffect(CanvasBitmap canvasBitmap, double opacity)
|
||||
{
|
||||
double imageWidth = (double)canvasBitmap.Size.Width;
|
||||
double imageHeight = (double)canvasBitmap.Size.Height;
|
||||
|
||||
double targetSize = Math.Sqrt(Math.Pow(_canvasWidth, 2) + Math.Pow(_canvasHeight, 2));
|
||||
double scaleFactor = targetSize / Math.Min(imageWidth, imageHeight);
|
||||
|
||||
// Original source: https://zhuanlan.zhihu.com/p/37178216
|
||||
double gain = _lyricsBgBrightnessTransition.Value;
|
||||
|
||||
double whiteX = 1 - 0.5f * gain;
|
||||
double whiteY = 0.5f + 0.5f * gain;
|
||||
double blackX = 0.5f - 0.5f * gain;
|
||||
double blackY = 0 + 0.5f * gain;
|
||||
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = new BrightnessEffect
|
||||
{
|
||||
Source = new ScaleEffect
|
||||
{
|
||||
Scale = new Vector2((float)scaleFactor),
|
||||
Source = canvasBitmap,
|
||||
},
|
||||
WhitePoint = new Vector2((float)whiteX, (float)whiteY),
|
||||
BlackPoint = new Vector2((float)blackX, (float)blackY),
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
};
|
||||
}
|
||||
|
||||
private OpacityEffect? CreateFgImageEffect(ICanvasAnimatedControl control, CanvasBitmap canvasBitmap, double opacity)
|
||||
{
|
||||
if (opacity == 0) return null;
|
||||
|
||||
double imageWidth = (double)canvasBitmap.Size.Width;
|
||||
double imageHeight = (double)canvasBitmap.Size.Height;
|
||||
|
||||
double scaleFactor = _albumArtSize / Math.Min(imageWidth, imageHeight);
|
||||
if (scaleFactor < 0.01f) return null;
|
||||
|
||||
double cornerRadius = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.CoverImageRadius / 100f * _albumArtSize / 2;
|
||||
|
||||
var cornerRadiusMask = new CanvasCommandList(control);
|
||||
using var cornerRadiusMaskDs = cornerRadiusMask.CreateDrawingSession();
|
||||
cornerRadiusMaskDs.FillRoundedRectangle(
|
||||
new Rect(0, 0, imageWidth * scaleFactor, imageHeight * scaleFactor),
|
||||
(float)cornerRadius, (float)cornerRadius, Colors.White
|
||||
);
|
||||
|
||||
return new OpacityEffect
|
||||
{
|
||||
Source = new AlphaMaskEffect
|
||||
{
|
||||
Source = new ScaleEffect
|
||||
{
|
||||
Scale = new Vector2((float)scaleFactor),
|
||||
Source = canvasBitmap,
|
||||
},
|
||||
AlphaMask = cornerRadiusMask,
|
||||
},
|
||||
Opacity = (float)opacity,
|
||||
};
|
||||
}
|
||||
|
||||
private void DisposeAlbumArtBgEffect()
|
||||
{
|
||||
_albumArtBgEffect?.Dispose();
|
||||
_albumArtBgEffect = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新专辑封面背景效果
|
||||
/// <para>应该在以下任意条件满足时调用此函数:</para>
|
||||
/// <para><seealso cref="_isCanvasWidthChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isCanvasHeightChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isAlbumArtBgBlurAmountChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isCoverAcrylicEffectAmountChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isAlbumArtBgOpacityChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtBgTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColor1Transition"/> 正在变化</para>
|
||||
/// 如果上述条件均不满足,需调用 <seealso cref="UpdateAlbumArtBgRenderTarget"/> 来更新渲染缓存
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
private void UpdateAlbumArtBgEffect(ICanvasAnimatedControl control)
|
||||
{
|
||||
DisposeAlbumArtBgEffect();
|
||||
|
||||
using var overlappedCovers = new CanvasCommandList(control);
|
||||
using var overlappedCoversDs = overlappedCovers.CreateDrawingSession();
|
||||
|
||||
if (_lastAlbumArtCanvasBitmap != null && !_lastAlbumArtCanvasBitmap.IsDisposed())
|
||||
{
|
||||
using var lastBgImageEffect = CreateBgImageEffect(_lastAlbumArtCanvasBitmap, 1 - _albumArtBgTransition.Value);
|
||||
DrawBackgroundImgae(lastBgImageEffect, overlappedCoversDs, _lastAlbumArtCanvasBitmap);
|
||||
}
|
||||
if (_albumArtCanvasBitmap != null && !_albumArtCanvasBitmap.IsDisposed())
|
||||
{
|
||||
using var bgImageEffect = CreateBgImageEffect(_albumArtCanvasBitmap, _albumArtBgTransition.Value);
|
||||
DrawBackgroundImgae(bgImageEffect, overlappedCoversDs, _albumArtCanvasBitmap);
|
||||
}
|
||||
|
||||
using var blurredCover = new GaussianBlurEffect
|
||||
{
|
||||
BlurAmount = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.CoverOverlayBlurAmount,
|
||||
Source = overlappedCovers,
|
||||
BorderMode = EffectBorderMode.Soft,
|
||||
Optimization = EffectOptimization.Speed,
|
||||
};
|
||||
|
||||
var combined = new CanvasCommandList(control);
|
||||
using var combinedDs = combined.CreateDrawingSession();
|
||||
|
||||
if (_liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.CoverAcrylicEffectAmount > 0 && _coverAcrylicNoiseCanvasBitmap != null)
|
||||
{
|
||||
// 应用亚克力噪点效果
|
||||
combinedDs.DrawImage(new BlendEffect
|
||||
{
|
||||
Mode = BlendEffectMode.SoftLight,
|
||||
Background = blurredCover,
|
||||
Foreground = new OpacityEffect
|
||||
{
|
||||
Source = _coverAcrylicNoiseCanvasBitmap,
|
||||
Opacity = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.CoverAcrylicEffectAmount / 100f,
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
combinedDs.DrawImage(blurredCover);
|
||||
}
|
||||
|
||||
_albumArtBgEffect = new OpacityEffect
|
||||
{
|
||||
Opacity = _liveStatesService.LiveStates.LyricsWindowStatus.LyricsBackgroundSettings.CoverOverlayOpacity / 100f,
|
||||
Source = combined,
|
||||
};
|
||||
}
|
||||
|
||||
private void DisposeAlbumArtBgRenderTarget()
|
||||
{
|
||||
_albumArtBgRenderTarget?.Dispose();
|
||||
_albumArtBgRenderTarget = null;
|
||||
}
|
||||
|
||||
private void UpdateAlbumArtBgRenderTarget(ICanvasAnimatedControl control)
|
||||
{
|
||||
DisposeAlbumArtBgRenderTarget();
|
||||
|
||||
double targetSize = Math.Sqrt(Math.Pow(_canvasWidth, 2) + Math.Pow(_canvasHeight, 2));
|
||||
|
||||
_albumArtBgRenderTarget = new CanvasRenderTarget(control, (float)targetSize, (float)targetSize);
|
||||
using var ds = _albumArtBgRenderTarget.CreateDrawingSession();
|
||||
|
||||
float offsetX = -(float)(_canvasWidth - targetSize) / 2;
|
||||
float offsetY = -(float)(_canvasHeight - targetSize) / 2;
|
||||
|
||||
ds.Clear(Colors.Transparent);
|
||||
ds.DrawImage(_albumArtBgEffect, new Vector2(offsetX, offsetY));
|
||||
}
|
||||
|
||||
private void DisposeAlbumArtEffect()
|
||||
{
|
||||
_albumArtEffect?.Dispose();
|
||||
_albumArtEffect = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新专辑封面效果
|
||||
/// <para>应该在以下任意条件满足时调用此函数:</para>
|
||||
/// <para><seealso cref="_isCanvasWidthChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isCanvasHeightChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtChanged"/> == true</para>
|
||||
/// <para><seealso cref="_isAlbumArtShadowAmountChanged"/> == true</para>
|
||||
/// <para><seealso cref="_albumArtBgTransition"/> 正在变化</para>
|
||||
/// <para><seealso cref="_albumArtAccentColor1Transition"/> 正在变化</para>
|
||||
/// 如果上述条件均不满足,需调用 <seealso cref="UpdateAlbumArtRenderTarget"/> 来更新渲染缓存
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
private void UpdateAlbumArtEffect(ICanvasAnimatedControl control)
|
||||
{
|
||||
DisposeAlbumArtEffect();
|
||||
|
||||
using var overlappedCovers = new CanvasCommandList(control);
|
||||
using var overlappedCoversDs = overlappedCovers.CreateDrawingSession();
|
||||
|
||||
if (_lastAlbumArtCanvasBitmap != null)
|
||||
{
|
||||
using var lastFgImageEffect = CreateFgImageEffect(control, _lastAlbumArtCanvasBitmap, 1 - _albumArtBgTransition.Value);
|
||||
if (lastFgImageEffect != null)
|
||||
{
|
||||
overlappedCoversDs.DrawImage(lastFgImageEffect);
|
||||
}
|
||||
}
|
||||
if (_albumArtCanvasBitmap != null)
|
||||
{
|
||||
using var fgImageEffect = CreateFgImageEffect(control, _albumArtCanvasBitmap, _albumArtBgTransition.Value);
|
||||
if (fgImageEffect != null)
|
||||
{
|
||||
overlappedCoversDs.DrawImage(fgImageEffect);
|
||||
}
|
||||
}
|
||||
|
||||
_albumArtEffect = new CanvasCommandList(control);
|
||||
using var combinedDs = _albumArtEffect.CreateDrawingSession();
|
||||
combinedDs.DrawImage(new ShadowEffect
|
||||
{
|
||||
Source = overlappedCovers,
|
||||
ShadowColor = _albumArtAccentColor1Transition.Value,
|
||||
BlurAmount = _liveStatesService.LiveStates.LyricsWindowStatus.AlbumArtLayoutSettings.CoverImageShadowAmount,
|
||||
Optimization = EffectOptimization.Speed,
|
||||
});
|
||||
combinedDs.DrawImage(overlappedCovers);
|
||||
}
|
||||
|
||||
private void DisposeAlbumArtRenderTarget()
|
||||
{
|
||||
_albumArtRenderTarget?.Dispose();
|
||||
_albumArtRenderTarget = null;
|
||||
}
|
||||
|
||||
private void UpdateAlbumArtRenderTarget(ICanvasAnimatedControl control)
|
||||
{
|
||||
DisposeAlbumArtRenderTarget();
|
||||
|
||||
_albumArtRenderTarget = new CanvasRenderTarget(control, (float)_canvasWidth, (float)_canvasHeight);
|
||||
using var ds = _albumArtRenderTarget.CreateDrawingSession();
|
||||
|
||||
ds.Clear(Colors.Transparent);
|
||||
// 给一个偏移,是为了避免绘制时从原点开始,这样会造成阴影被裁切
|
||||
ds.DrawImage(_albumArtEffect, control.Size.ToVector2() / 2 - new Vector2((float)_albumArtSize, (float)_albumArtSize) / 2);
|
||||
}
|
||||
|
||||
private void DisposeFluidEffect()
|
||||
{
|
||||
_fluidEffect?.Dispose();
|
||||
_fluidEffect = null;
|
||||
}
|
||||
|
||||
private async void RecreateFluidEffect(ICanvasAnimatedControl control)
|
||||
{
|
||||
DisposeFluidEffect();
|
||||
|
||||
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/FluidEffect.bin"));
|
||||
IBuffer buffer = await FileIO.ReadBufferAsync(file);
|
||||
var bytes = buffer.ToArray();
|
||||
_fluidEffect = new PixelShaderEffect(bytes);
|
||||
_fluidEffect.Properties["Width"] = (float)control.ConvertDipsToPixels((float)control.Size.Width, CanvasDpiRounding.Round);
|
||||
_fluidEffect.Properties["Height"] = (float)control.ConvertDipsToPixels((float)control.Size.Height, CanvasDpiRounding.Round);
|
||||
_fluidEffect.Properties["color1"] = _albumArtAccentColor1Transition.Value.ToVector3RGB();
|
||||
_fluidEffect.Properties["color2"] = _albumArtAccentColor2Transition.Value.ToVector3RGB();
|
||||
_fluidEffect.Properties["color3"] = _albumArtAccentColor3Transition.Value.ToVector3RGB();
|
||||
_fluidEffect.Properties["color4"] = _albumArtAccentColor4Transition.Value.ToVector3RGB();
|
||||
_fluidEffect.Properties["EnableLightWave"] = false;
|
||||
}
|
||||
|
||||
private void DisposeSnowEffect()
|
||||
{
|
||||
_snowEffect?.Dispose();
|
||||
_snowEffect = null;
|
||||
}
|
||||
|
||||
private void RecreateSnowEffect()
|
||||
{
|
||||
DisposeSnowEffect();
|
||||
_snowEffect = new();
|
||||
}
|
||||
|
||||
private void DisposeFogEffect()
|
||||
{
|
||||
_fogEffect?.Dispose();
|
||||
_fogEffect = null;
|
||||
}
|
||||
|
||||
private void RecreateFogEffect()
|
||||
{
|
||||
DisposeFogEffect();
|
||||
_fogEffect = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,537 +0,0 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Models.Settings;
|
||||
using BetterLyrics.WinUI3.Services.MediaSessionsService;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
: IRecipient<PropertyChangedMessage<int>>,
|
||||
IRecipient<PropertyChangedMessage<string>>,
|
||||
IRecipient<PropertyChangedMessage<double>>,
|
||||
IRecipient<PropertyChangedMessage<bool>>,
|
||||
IRecipient<PropertyChangedMessage<Color>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsDisplayType>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsLayoutOrientation>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsFontColorType>>,
|
||||
IRecipient<PropertyChangedMessage<TextAlignmentType>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsFontWeight>>,
|
||||
IRecipient<PropertyChangedMessage<LineRenderingType>>,
|
||||
IRecipient<PropertyChangedMessage<ElementTheme>>,
|
||||
IRecipient<PropertyChangedMessage<EasingType>>,
|
||||
IRecipient<PropertyChangedMessage<TimeSpan>>,
|
||||
IRecipient<PropertyChangedMessage<AlbumArtLayoutSettings>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsBackgroundSettings>>,
|
||||
IRecipient<PropertyChangedMessage<LyricsWindowStatus>>,
|
||||
IRecipient<PropertyChangedMessage<SongInfo?>>,
|
||||
IRecipient<PropertyChangedMessage<SoftwareBitmap?>>,
|
||||
IRecipient<PropertyChangedMessage<List<Color>>>
|
||||
{
|
||||
private void OnSongInfoChanged()
|
||||
{
|
||||
_lastSongTitle = _songTitle;
|
||||
_songTitle = _mediaSessionsService.CurrentSongInfo?.Title;
|
||||
_isSongTitleChanged = true;
|
||||
|
||||
_lastSongArtists = _songArtists;
|
||||
_songArtists = _mediaSessionsService.CurrentSongInfo?.DisplayArtists;
|
||||
_isSongArtistChanged = true;
|
||||
|
||||
_lastSongAlbum = _songAlbum;
|
||||
_songAlbum = _mediaSessionsService.CurrentSongInfo?.Album;
|
||||
_isSongAlbumChanged = true;
|
||||
|
||||
_songDurationMs = (int)(_mediaSessionsService.CurrentSongInfo?.DurationMs ?? TimeSpan.FromMinutes(99).TotalMilliseconds);
|
||||
|
||||
_songInfoOpacityTransition.Reset(0f);
|
||||
_songInfoOpacityTransition.StartTransition(1f);
|
||||
|
||||
TotalTime = TimeSpan.Zero;
|
||||
|
||||
// 处理 Last.fm 追踪
|
||||
_totalPlayingTime = TimeSpan.Zero;
|
||||
_isLastFMTracked = false;
|
||||
}
|
||||
|
||||
private void OnSoftwareBitmapChanged()
|
||||
{
|
||||
_lastAlbumArtCanvasBitmap?.Dispose();
|
||||
_lastAlbumArtCanvasBitmap = null;
|
||||
|
||||
_lastAlbumArtSwBitmap = _albumArtSwBitmap;
|
||||
_albumArtSwBitmap = _mediaSessionsService.SoftwareBitmap;
|
||||
|
||||
_albumArtChanged = true;
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<bool> message)
|
||||
{
|
||||
if (message.Sender is AboutControlViewModel)
|
||||
{
|
||||
if (message.PropertyName == nameof(AboutControlViewModel.IsDebugOverlayEnabled))
|
||||
{
|
||||
_isDebugOverlayEnabled = message.NewValue;
|
||||
_isDebugOverlayEnabledChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.IsLyricsGlowEffectEnabled))
|
||||
{
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.IsFanLyricsEnabled))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.IsLyricsFloatAnimationEnabled))
|
||||
{
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.Is3DLyricsEnabled))
|
||||
{
|
||||
_isLyrics3DMatrixChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.IsDynamicLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is AlbumArtLayoutSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(AlbumArtLayoutSettings.ShowTitle))
|
||||
{
|
||||
_isSongTitleVisibilityChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.ShowArtists))
|
||||
{
|
||||
_isSongArtistVisibilityChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.ShowAlbum))
|
||||
{
|
||||
_isSongAlbumVisibilityChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.AutoAlbumArtSize))
|
||||
{
|
||||
_isAlbumArtSizeChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.IsAutoSongInfoFontSize))
|
||||
{
|
||||
UpdateSongInfoFontSize();
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsBackgroundSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsBackgroundSettings.IsSpectrumOverlayEnabled))
|
||||
{
|
||||
_isSpectrumOverlayEnabledChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.IsFluidOverlayEnabled))
|
||||
{
|
||||
_isFluidOverlayEnabledChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.IsSnowFlakeOverlayEnabled))
|
||||
{
|
||||
_isSnowOverlayEnabledChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.IsFogOverlayEnabled))
|
||||
{
|
||||
_isFogOverlayEnabledChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<Color> message)
|
||||
{
|
||||
if (message.Sender is LyricsWindowViewModel)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsWindowViewModel.BackdropAccentColor))
|
||||
{
|
||||
_immersiveBgColorTransition.StartTransition(message.NewValue);
|
||||
_environmentalColor = message.NewValue;
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomBgFontColor))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomFgFontColor))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCustomStrokeFontColor))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<double> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsLineSpacingFactor))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<int> message)
|
||||
{
|
||||
if (message.Sender is AlbumArtLayoutSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(AlbumArtLayoutSettings.CoverImageRadius))
|
||||
{
|
||||
_isAlbumArtCornerRadiusChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.CoverImageShadowAmount))
|
||||
{
|
||||
_isAlbumArtShadowAmountChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.SongInfoFontSize))
|
||||
{
|
||||
UpdateSongInfoFontSize();
|
||||
}
|
||||
else if (message.PropertyName == nameof(AlbumArtLayoutSettings.AlbumArtSize))
|
||||
{
|
||||
_isAlbumArtSizeChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsBackgroundSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsBackgroundSettings.CoverOverlayOpacity))
|
||||
{
|
||||
_isAlbumArtBgOpacityChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.CoverOverlayBlurAmount))
|
||||
{
|
||||
_isAlbumArtBgBlurAmountChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.CoverAcrylicEffectAmount))
|
||||
{
|
||||
_isCoverAcrylicEffectAmountChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsBackgroundSettings.CoverOverlaySpeed))
|
||||
{
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.LyricsVerticalEdgeOpacity))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsBlurAmount))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollTopDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollBottomDuration))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollTopDelay))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollBottomDelay))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.FanLyricsAngle))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.Lyrics3DXAngle))
|
||||
{
|
||||
_isLyrics3DMatrixChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.Lyrics3DYAngle))
|
||||
{
|
||||
_isLyrics3DMatrixChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.Lyrics3DZAngle))
|
||||
{
|
||||
_isLyrics3DMatrixChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.Lyrics3DDepth))
|
||||
{
|
||||
_isLyrics3DMatrixChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.PhoneticLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.OriginalLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.TranslatedLyricsFontSize))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFontStrokeWidth))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsBgFontOpacity))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LineRenderingType> message)
|
||||
{
|
||||
if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.LyricsGlowEffectScope))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsEffectSettings.OriginalLyricsHighlightScope))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<TextAlignmentType> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsAlignmentType))
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
else if (message.Sender is AlbumArtLayoutSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(AlbumArtLayoutSettings.SongInfoAlignmentType))
|
||||
{
|
||||
_isSongInfoAlignmentTypeChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsDisplayType> message)
|
||||
{
|
||||
if (message.Sender is LyricsWindowStatus)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsWindowStatus.LyricsDisplayType))
|
||||
{
|
||||
_isDisplayTypeChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsLayoutOrientation> message)
|
||||
{
|
||||
if (message.Sender is LyricsWindowStatus)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsWindowStatus.LyricsLayoutOrientation))
|
||||
{
|
||||
_isLyricsLayoutOrientationChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsFontColorType> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsBgFontColorType))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFgFontColorType))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
else if (message.PropertyName == nameof(LyricsStyleSettings.LyricsStrokeFontColorType))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsFontWeight> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsFontWeight))
|
||||
{
|
||||
_isLyricsFontWeightChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<ElementTheme> message)
|
||||
{
|
||||
if (message.Sender is LyricsBackgroundSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsBackgroundSettings.LyricsBackgroundTheme))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<EasingType> message)
|
||||
{
|
||||
if (message.Sender is LyricsEffectSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsEffectSettings.LyricsScrollEasingType))
|
||||
{
|
||||
_canvasYScrollTransition.SetEasingType(message.NewValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<string> message)
|
||||
{
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsCJKFontFamily))
|
||||
{
|
||||
_isLyricsFontFamilyChanged = true;
|
||||
}
|
||||
}
|
||||
if (message.Sender is LyricsStyleSettings)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsStyleSettings.LyricsWesternFontFamily))
|
||||
{
|
||||
_isLyricsFontFamilyChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsWindowStatus> message)
|
||||
{
|
||||
if (message.Sender is LiveStates)
|
||||
{
|
||||
if (message.PropertyName == nameof(LiveStates.LyricsWindowStatus))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
UpdateSongInfoFontSize();
|
||||
|
||||
_isLayoutChanged = true;
|
||||
|
||||
_isLyricsWindowsStatusChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<AlbumArtLayoutSettings> message)
|
||||
{
|
||||
if (message.Sender is LyricsWindowStatus)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsWindowStatus.AlbumArtLayoutSettings))
|
||||
{
|
||||
_isAlbumArtCornerRadiusChanged = true;
|
||||
_isAlbumArtShadowAmountChanged = true;
|
||||
UpdateSongInfoFontSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<LyricsBackgroundSettings> message)
|
||||
{
|
||||
if (message.Sender is LyricsWindowStatus)
|
||||
{
|
||||
if (message.PropertyName == nameof(LyricsWindowStatus.LyricsBackgroundSettings))
|
||||
{
|
||||
_isAlbumArtBgOpacityChanged = true;
|
||||
_isAlbumArtBgBlurAmountChanged = true;
|
||||
_isCoverAcrylicEffectAmountChanged = true;
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<SongInfo?> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.CurrentSongInfo))
|
||||
{
|
||||
OnSongInfoChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<TimeSpan> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.CurrentPosition))
|
||||
{
|
||||
var diff = Math.Abs(TotalTime.TotalMilliseconds - _mediaSessionsService.CurrentPosition.TotalMilliseconds);
|
||||
var timelineSyncThreshold = _mediaSessionsService.CurrentMediaSourceProviderInfo?.TimelineSyncThreshold ?? 0;
|
||||
if (diff >= timelineSyncThreshold)
|
||||
{
|
||||
TotalTime = _mediaSessionsService.CurrentPosition;
|
||||
if (TotalTime.TotalSeconds <= 1)
|
||||
{
|
||||
_totalPlayingTime = TimeSpan.Zero;
|
||||
_isLastFMTracked = false;
|
||||
}
|
||||
}
|
||||
// 大跨度,刷新布局,避免歌词不显示
|
||||
if (diff >= timelineSyncThreshold + 5000)
|
||||
{
|
||||
_isLayoutChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<SoftwareBitmap?> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.SoftwareBitmap))
|
||||
{
|
||||
OnSoftwareBitmapChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive(PropertyChangedMessage<List<Color>> message)
|
||||
{
|
||||
if (message.Sender is IMediaSessionsService)
|
||||
{
|
||||
if (message.PropertyName == nameof(IMediaSessionsService.LightAccentColors))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
else if (message.PropertyName == nameof(IMediaSessionsService.DarkAccentColors))
|
||||
{
|
||||
UpdateColorConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using Microsoft.UI;
|
||||
using Windows.UI;
|
||||
|
||||
namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
{
|
||||
private readonly ValueTransition<double> _canvasYScrollTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _immersiveBgColorTransition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor1Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor2Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor3Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<Color> _albumArtAccentColor4Transition = new(
|
||||
initialValue: Colors.Transparent,
|
||||
durationSeconds: 0.3f,
|
||||
interpolator: (from, to, progress) => Helper.ColorHelper.GetInterpolatedColor(progress, from, to)
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _immersiveBgOpacityTransition = new(
|
||||
initialValue: 1f,
|
||||
durationSeconds: 0.3f
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _titleXTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _titleYTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _lyricsYTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _lyricsOpacityTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _albumArtBgTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 1f
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _albumArtOpacityTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 1f
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _albumArtXTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _albumArtYTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 0.3f,
|
||||
easingType: EasingType.EaseInOutQuad
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _songInfoOpacityTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 1f
|
||||
);
|
||||
|
||||
private readonly ValueTransition<double> _lyricsBgBrightnessTransition = new(
|
||||
initialValue: 0f,
|
||||
durationSeconds: 1f
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user