layout improvements

This commit is contained in:
Royce551 2021-09-25 22:25:22 -05:00
parent 0ec8a33a49
commit 1fa71829fd
3 changed files with 37 additions and 8 deletions

View file

@ -54,11 +54,11 @@ namespace FRESHMusicPlayer.Controls.Lyrics
}
}
public void HandleLyrics()
public bool HandleLyrics()
{
LyricsBox.Text = LyricsBoxMinus2.Text = LyricsBoxMinus1.Text = LyricsBoxPlus1.Text = LyricsBoxPlus2.Text = string.Empty;
var track = new Track(window.Player.FilePath);
if (track is null) return;
if (track is null) return false;
// LRC file present
if (File.Exists(Path.Combine(Path.GetDirectoryName(window.Player.FilePath), Path.GetFileNameWithoutExtension(window.Player.FilePath) + ".lrc")))
{
@ -67,6 +67,7 @@ namespace FRESHMusicPlayer.Controls.Lyrics
ScrollViewer.SetVerticalScrollBarVisibility(LyricsScrollViewer, ScrollBarVisibility.Hidden);
LyricsBoxMinus2.Visibility = LyricsBoxMinus1.Visibility = LyricsBoxPlus1.Visibility = LyricsBoxPlus2.Visibility = Visibility.Visible;
LyricsBox.FontWeight = FontWeights.Bold;
return true;
}
else if (!string.IsNullOrWhiteSpace(track.Lyrics.UnsynchronizedLyrics)) // Embedded untimed lyrics
{
@ -75,6 +76,7 @@ namespace FRESHMusicPlayer.Controls.Lyrics
ScrollViewer.SetVerticalScrollBarVisibility(LyricsScrollViewer, ScrollBarVisibility.Auto);
LyricsBoxMinus2.Visibility = LyricsBoxMinus1.Visibility = LyricsBoxPlus1.Visibility = LyricsBoxPlus2.Visibility = Visibility.Collapsed;
LyricsBox.FontWeight = FontWeights.Regular;
return true;
}
else // No lyrics
{
@ -83,6 +85,7 @@ namespace FRESHMusicPlayer.Controls.Lyrics
ScrollViewer.SetVerticalScrollBarVisibility(LyricsScrollViewer, ScrollBarVisibility.Hidden);
LyricsBoxMinus2.Visibility = LyricsBoxMinus1.Visibility = LyricsBoxPlus1.Visibility = LyricsBoxPlus2.Visibility = Visibility.Collapsed;
LyricsBox.FontWeight = FontWeights.Regular;
return false;
}
}

View file

@ -21,11 +21,22 @@
</DockPanel>
<Rectangle x:Name="TopBarOverlay" Panel.ZIndex="3" Opacity="0.55" Grid.Row="0" Fill="{StaticResource BackgroundColor}"/>
<Viewbox Stretch="Uniform" Panel.ZIndex="2" Grid.Row="1" Margin="25">
<DockPanel LastChildFill="False" Width="700" Height="350">
<Image Source="https://royce551.github.io/assets/images/fmp/fullfmplogo.png" DockPanel.Dock="Top" HorizontalAlignment="Left" Width="100" RenderOptions.BitmapScalingMode="HighQuality" Margin="10,0,0,0"/>
<Viewbox Stretch="Uniform" Panel.ZIndex="2" Grid.Row="1" Margin="25,-5,25,25">
<Grid Width="700" Height="350">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Source="https://royce551.github.io/assets/images/fmp/fullfmplogo.png" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Width="100" RenderOptions.BitmapScalingMode="HighQuality" Margin="10,0,0,0"/>
<Grid DockPanel.Dock="Bottom">
<ContentControl x:Name="InfoThing" Grid.Row="0" Grid.Column="1" Height="200" Width="300" HorizontalAlignment="Right"/>
<Grid Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="CoverArtArea" Width="5"/>
<ColumnDefinition Width="1*"/>
@ -39,7 +50,7 @@
<TextBlock x:Name="ArtistLabel" HorizontalAlignment="Stretch" Margin="5,119,10,0" TextWrapping="NoWrap" Text="{x:Static resx:Resources.MAINWINDOW_NOTHINGPLAYING}" VerticalAlignment="Top" Grid.Column="1" Height="20" Foreground="{StaticResource SecondaryTextColor}" TextTrimming="CharacterEllipsis"/>
</Grid>
</DockPanel>
</Grid>
</Viewbox>
<Image x:Name="BackgroundCoverArtBox" HorizontalAlignment="Stretch" Grid.RowSpan="3" Grid.ColumnSpan="3" Grid.Row="0" VerticalAlignment="Stretch" RenderOptions.BitmapScalingMode="LowQuality" Panel.ZIndex="0" Stretch="UniformToFill" Margin="0" >

View file

@ -13,6 +13,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FRESHMusicPlayer.Controls.Lyrics;
using FRESHMusicPlayer.Controls;
using WinForms = System.Windows.Forms;
namespace FRESHMusicPlayer.Pages
@ -78,6 +80,19 @@ namespace FRESHMusicPlayer.Pages
CoverArtBox.Source = BackgroundCoverArtBox.Source = BitmapFrame.Create(new MemoryStream(CurrentTrack.CoverArt), BitmapCreateOptions.None, BitmapCacheOption.None);
SetCoverArtVisibility(true);
}
var lyrics = new FRESHMusicPlayer.Controls.Lyrics.Lyrics();
lyrics.Initialize(window);
if (lyrics.HandleLyrics())
{
InfoThing.Content = lyrics;
}
else
{
var trackInfo = new TrackInfo();
trackInfo.Update(CurrentTrack);
InfoThing.Content = trackInfo;
}
}
public void SetCoverArtVisibility(bool mode)
@ -142,7 +157,7 @@ namespace FRESHMusicPlayer.Pages
controlDismissTimer.Stop();
window.HideControlsBox();
Mouse.OverrideCursor = Cursors.None;
TopBar.Visibility = TopBarOverlay.Visibility = Visibility.Collapsed;
TopBar.Visibility = TopBarOverlay.Visibility = Visibility.Hidden;
}
private void BackButton_Click(object sender, RoutedEventArgs e)