-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AlexanderDotH
committed
May 7, 2023
1 parent
1c65be4
commit c9ea05e
Showing
13 changed files
with
204 additions
and
15 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
OpenLyricsClient/Backend/Events/EventArgs/LyricsPercentageUpdatedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using OpenLyricsClient.Shared.Structure.Lyrics; | ||
|
||
namespace OpenLyricsClient.Backend.Events.EventArgs; | ||
|
||
public class LyricsPercentageUpdatedEventArgs | ||
{ | ||
private LyricPart _lyricPart; | ||
private double _percentage; | ||
|
||
public LyricsPercentageUpdatedEventArgs(LyricPart lyricPart, double percentage) | ||
{ | ||
this._lyricPart = lyricPart; | ||
this._percentage = percentage; | ||
} | ||
|
||
public LyricPart LyricPart | ||
{ | ||
get => _lyricPart; | ||
set => _lyricPart = value; | ||
} | ||
|
||
public double Percentage | ||
{ | ||
get => this._percentage; | ||
set => this._percentage = value; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
OpenLyricsClient/Backend/Events/EventHandler/LyricsPercentageUpdatedEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System; | ||
using OpenLyricsClient.Backend.Events.EventArgs; | ||
|
||
namespace OpenLyricsClient.Backend.Events.EventHandler; | ||
|
||
public delegate void LyricsPercentageUpdatedEventHandler(Object sender, LyricsPercentageUpdatedEventArgs args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
OpenLyricsClient/Frontend/Models/Custom/Tile/Overlays/TextOverlayViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
using Avalonia; | ||
using Avalonia.Layout; | ||
using Avalonia.Media; | ||
using OpenLyricsClient.Backend; | ||
using OpenLyricsClient.Backend.Events.EventArgs; | ||
using OpenLyricsClient.Backend.Settings.Sections.Lyrics; | ||
|
||
namespace OpenLyricsClient.Frontend.Models.Custom.Tile.Overlays; | ||
|
||
public class TextOverlayViewModel : INotifyPropertyChanged | ||
{ | ||
public event PropertyChangedEventHandler? PropertyChanged; | ||
|
||
public TextOverlayViewModel() | ||
{ | ||
Core.INSTANCE.SettingsHandler.SettingsChanged += SettingsHandlerOnSettingsChanged; | ||
} | ||
|
||
private void SettingsHandlerOnSettingsChanged(object sender, SettingsChangedEventArgs settingschangedeventargs) | ||
{ | ||
OnPropertyChanged("LyricsSize"); | ||
OnPropertyChanged("LyricsWeight"); | ||
OnPropertyChanged("LyricsAlignment"); | ||
OnPropertyChanged("LyricsMargin"); | ||
} | ||
|
||
public double LyricsSize | ||
{ | ||
get => Core.INSTANCE.SettingsHandler.Settings<LyricsSection>().GetValue<double>("Lyrics Size"); | ||
} | ||
|
||
public FontWeight LyricsWeight | ||
{ | ||
get => Core.INSTANCE.SettingsHandler.Settings<LyricsSection>().GetValue<FontWeight>("Lyrics Weight"); | ||
} | ||
|
||
public HorizontalAlignment LyricsAlignment | ||
{ | ||
get => Core.INSTANCE.SettingsHandler.Settings<LyricsSection>().GetValue<HorizontalAlignment>("Lyrics Alignment"); | ||
} | ||
|
||
public Thickness LyricsMargin | ||
{ | ||
get => Core.INSTANCE.SettingsHandler.Settings<LyricsSection>().GetValue<Thickness>("Lyrics Margin"); | ||
} | ||
|
||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null) | ||
{ | ||
if (EqualityComparer<T>.Default.Equals(field, value)) return false; | ||
field = value; | ||
OnPropertyChanged(propertyName); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
public enum EnumAnimationStyle | ||
{ | ||
LINEAR, CIRCULAREASEOUT, SIGMOID | ||
CIRCULAREASEOUT, SIGMOID | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="OpenLyricsClient.Frontend.View.Custom.Tile.LyricsTile"> | ||
<Decorator Name="PART_Decorator"/> | ||
</UserControl> |
35 changes: 35 additions & 0 deletions
35
OpenLyricsClient/Frontend/View/Custom/Tile/LyricsTile.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
using OpenLyricsClient.Backend; | ||
using OpenLyricsClient.Backend.Events.EventArgs; | ||
using OpenLyricsClient.Shared.Structure.Lyrics; | ||
|
||
namespace OpenLyricsClient.Frontend.View.Custom.Tile; | ||
|
||
public partial class LyricsTile : UserControl | ||
{ | ||
private LyricPart _lyricPart; | ||
private Decorator _decorator; | ||
|
||
public LyricsTile() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
|
||
this._decorator = this.Get<Decorator>(nameof(PART_Decorator)); | ||
|
||
Core.INSTANCE.LyricHandler.LyricsPercentageUpdated += LyricHandlerOnLyricsPercentageUpdated; | ||
} | ||
|
||
private void LyricHandlerOnLyricsPercentageUpdated(object sender, LyricsPercentageUpdatedEventArgs args) | ||
{ | ||
|
||
} | ||
|
||
public LyricPart Lyric | ||
{ | ||
get => this._lyricPart; | ||
set => this._lyricPart = value; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
OpenLyricsClient/Frontend/View/Custom/Tile/Overlays/TextOverlay.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="OpenLyricsClient.Frontend.View.Custom.Tile.Overlays.TextOverlay"> | ||
|
||
|
||
|
||
Welcome to Avalonia! | ||
</UserControl> |
18 changes: 18 additions & 0 deletions
18
OpenLyricsClient/Frontend/View/Custom/Tile/Overlays/TextOverlay.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace OpenLyricsClient.Frontend.View.Custom.Tile.Overlays; | ||
|
||
public partial class TextOverlay : UserControl | ||
{ | ||
public TextOverlay() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
} |