diff --git a/KaraokePlayer.sln b/KaraokePlayer.sln index 407daee..81750d3 100644 --- a/KaraokePlayer.sln +++ b/KaraokePlayer.sln @@ -19,7 +19,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SongCrawler", "SongCrawler\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Herse.Models", "Herse.Models\Herse.Models.csproj", "{F02EDA00-AA8F-47EF-AC7F-66DC315AA13D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BillboardPlaylistUpdater", "BillboardPlaylistUpdater\BillboardPlaylistUpdater.csproj", "{AE892DF7-C43E-422A-B82E-29B5E6E0341C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SongListUpdater", "SongListUpdater\SongListUpdater.csproj", "{AE892DF7-C43E-422A-B82E-29B5E6E0341C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingsALot", "SingsALot\SingsALot.csproj", "{40954789-DA71-4C0B-8D03-184B19248982}" EndProject diff --git a/KaraokePlayer/SongInfoForm.Designer.cs b/KaraokePlayer/SongInfoForm.Designer.cs index 27e0d42..48d041c 100644 --- a/KaraokePlayer/SongInfoForm.Designer.cs +++ b/KaraokePlayer/SongInfoForm.Designer.cs @@ -51,13 +51,12 @@ // // songTitleLabel // - this.songTitleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.songTitleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.songTitleLabel.BackColor = System.Drawing.Color.Transparent; this.songTitleLabel.Font = new System.Drawing.Font("Segoe UI", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.songTitleLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(215)))), ((int)(((byte)(0))))); - this.songTitleLabel.Location = new System.Drawing.Point(50, 450); + this.songTitleLabel.Location = new System.Drawing.Point(50, 530); this.songTitleLabel.Name = "songTitleLabel"; this.songTitleLabel.Size = new System.Drawing.Size(1100, 200); this.songTitleLabel.TabIndex = 3; @@ -67,13 +66,12 @@ // // artistLabel // - this.artistLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.artistLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.artistLabel.BackColor = System.Drawing.Color.Transparent; this.artistLabel.Font = new System.Drawing.Font("Segoe UI", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.artistLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200))))); - this.artistLabel.Location = new System.Drawing.Point(50, 350); + this.artistLabel.Location = new System.Drawing.Point(50, 420); this.artistLabel.Name = "artistLabel"; this.artistLabel.Size = new System.Drawing.Size(1100, 80); this.artistLabel.TabIndex = 2; @@ -83,13 +81,12 @@ // // singerLabel // - this.singerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.singerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.singerLabel.BackColor = System.Drawing.Color.Transparent; this.singerLabel.Font = new System.Drawing.Font("Segoe UI", 42F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.singerLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - this.singerLabel.Location = new System.Drawing.Point(50, 200); + this.singerLabel.Location = new System.Drawing.Point(50, 270); this.singerLabel.Name = "singerLabel"; this.singerLabel.Size = new System.Drawing.Size(1100, 120); this.singerLabel.TabIndex = 1; @@ -99,13 +96,12 @@ // // upNextLabel // - this.upNextLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.upNextLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.upNextLabel.BackColor = System.Drawing.Color.Transparent; this.upNextLabel.Font = new System.Drawing.Font("Segoe UI", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.upNextLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.upNextLabel.Location = new System.Drawing.Point(50, 100); + this.upNextLabel.Location = new System.Drawing.Point(50, 170); this.upNextLabel.Name = "upNextLabel"; this.upNextLabel.Size = new System.Drawing.Size(1100, 60); this.upNextLabel.TabIndex = 0; diff --git a/KaraokePlayer/SongInfoForm.cs b/KaraokePlayer/SongInfoForm.cs index 2de3298..10c91d0 100644 --- a/KaraokePlayer/SongInfoForm.cs +++ b/KaraokePlayer/SongInfoForm.cs @@ -1,147 +1,85 @@ using Herse.Models; using KaraokePlayer.Classes; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Drawing; -using System.Drawing.Drawing2D; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace KaraokePlayer { public partial class SongInfoForm : Form { - private Timer fadeTimer; - private Timer pulseTimer; - private int fadeAlpha = 0; - private bool isFadingIn = true; - private int pulseAlpha = 255; - private bool pulseDirection = false; - public SongInfoForm() { InitializeComponent(); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.WindowState = FormWindowState.Normal; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.WindowState = FormWindowState.Maximized; this.ShowInTaskbar = false; this.TopMost = true; - // Enable double buffering to prevent flickering - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); - - // Add paint event for gradient background - mainPanel.Paint += MainPanel_Paint; - - // Setup fade timer - fadeTimer = new Timer(); - fadeTimer.Interval = 20; - fadeTimer.Tick += FadeTimer_Tick; - - // Setup pulse timer for "UP NEXT" label - pulseTimer = new Timer(); - pulseTimer.Interval = 50; - pulseTimer.Tick += PulseTimer_Tick; - - // Start fade in effect - StartFadeIn(); + // Calculate dynamic positioning after form is loaded + this.Load += SongInfoForm_Load; } - private void StartFadeIn() + private void SongInfoForm_Load(object sender, EventArgs e) { - fadeAlpha = 0; - isFadingIn = true; - fadeTimer.Start(); - pulseTimer.Start(); + CalculateDynamicPositions(); } - private void PulseTimer_Tick(object sender, EventArgs e) + private void CalculateDynamicPositions() { - if (pulseDirection) + // Get the actual screen dimensions + int screenHeight = this.ClientSize.Height; + int screenWidth = this.ClientSize.Width; + + // Calculate font scaling factor based on screen size + // Base scaling on the smaller dimension to ensure everything fits + float baseScale = Math.Min(screenHeight / 800f, screenWidth / 1200f); + float fontScale = Math.Max(0.8f, Math.Min(2.0f, baseScale)); // Limit scale between 0.8x and 2.0x + + // Calculate spacing between labels (increases with font size) + int labelSpacing = (int)(30 * fontScale); + + // Update font sizes + upNextLabel.Font = new Font("Segoe UI", 24 * fontScale, FontStyle.Regular); + singerLabel.Font = new Font("Segoe UI", 42 * fontScale, FontStyle.Bold); + artistLabel.Font = new Font("Segoe UI", 36 * fontScale, FontStyle.Regular); + songTitleLabel.Font = new Font("Segoe UI", 48 * fontScale, FontStyle.Bold); + + // Calculate proper label heights using font metrics + using (Graphics g = this.CreateGraphics()) { - pulseAlpha += 5; - if (pulseAlpha >= 255) - { - pulseAlpha = 255; - pulseDirection = false; - } - } - else - { - pulseAlpha -= 5; - if (pulseAlpha <= 150) - { - pulseAlpha = 150; - pulseDirection = true; - } + // Get font metrics for each label + SizeF upNextSize = g.MeasureString(upNextLabel.Text, upNextLabel.Font); + SizeF singerSize = g.MeasureString(singerLabel.Text, singerLabel.Font); + SizeF artistSize = g.MeasureString(artistLabel.Text, artistLabel.Font); + SizeF songTitleSize = g.MeasureString(songTitleLabel.Text, songTitleLabel.Font); + + // Add extra padding for descenders (about 20% of font size) + int descenderPadding = (int)(fontScale * 8); + int totalLabelHeight = (int)(upNextSize.Height + descenderPadding) + + (int)(singerSize.Height + descenderPadding) + + (int)(artistSize.Height + descenderPadding) + + (int)(songTitleSize.Height + descenderPadding); + totalLabelHeight += (labelSpacing * 3); // Add spacing between labels + + // Calculate available space and top padding + int availableSpace = screenHeight - totalLabelHeight; + int topPadding = availableSpace / 2; + + // Resize labels to fit the actual text height plus descender padding + upNextLabel.Size = new Size(upNextLabel.Width, (int)upNextSize.Height + descenderPadding); + singerLabel.Size = new Size(singerLabel.Width, (int)singerSize.Height + descenderPadding); + artistLabel.Size = new Size(artistLabel.Width, (int)artistSize.Height + descenderPadding); + songTitleLabel.Size = new Size(songTitleLabel.Width, (int)songTitleSize.Height + descenderPadding); + + // Position labels dynamically with spacing + upNextLabel.Location = new Point(upNextLabel.Location.X, topPadding); + singerLabel.Location = new Point(singerLabel.Location.X, topPadding + upNextLabel.Height + labelSpacing); + artistLabel.Location = new Point(artistLabel.Location.X, topPadding + upNextLabel.Height + labelSpacing + singerLabel.Height + labelSpacing); + songTitleLabel.Location = new Point(songTitleLabel.Location.X, topPadding + upNextLabel.Height + labelSpacing + singerLabel.Height + labelSpacing + artistLabel.Height + labelSpacing); } - upNextLabel.ForeColor = System.Drawing.Color.FromArgb(pulseAlpha, 255, 128, 0); - } - private void FadeTimer_Tick(object sender, EventArgs e) - { - if (isFadingIn) - { - fadeAlpha += 10; - if (fadeAlpha >= 255) - { - fadeAlpha = 255; - fadeTimer.Stop(); - } - } - else - { - fadeAlpha -= 10; - if (fadeAlpha <= 0) - { - fadeAlpha = 0; - fadeTimer.Stop(); - this.Hide(); - } - } - - // Update opacity - this.Opacity = fadeAlpha / 255.0; - mainPanel.Invalidate(); - } - - private void MainPanel_Paint(object sender, PaintEventArgs e) - { - e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; - e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; - - // Create gradient background - using (LinearGradientBrush brush = new LinearGradientBrush( - mainPanel.ClientRectangle, - System.Drawing.Color.FromArgb(30, 30, 50), - System.Drawing.Color.FromArgb(20, 20, 30), - LinearGradientMode.Vertical)) - { - e.Graphics.FillRectangle(brush, mainPanel.ClientRectangle); - } - - // Add subtle radial gradient overlay for depth - using (GraphicsPath path = new GraphicsPath()) - { - path.AddEllipse(-300, -300, mainPanel.Width + 600, mainPanel.Height + 600); - using (PathGradientBrush pgb = new PathGradientBrush(path)) - { - pgb.CenterColor = System.Drawing.Color.FromArgb(40, 40, 80); - pgb.SurroundColors = new System.Drawing.Color[] { System.Drawing.Color.FromArgb(0, 0, 0) }; - e.Graphics.FillPath(pgb, path); - } - } - - // Add subtle border glow - using (Pen glowPen = new Pen(System.Drawing.Color.FromArgb(50, 100, 200), 2)) - { - glowPen.LineJoin = LineJoin.Round; - e.Graphics.DrawRectangle(glowPen, 2, 2, mainPanel.Width - 4, mainPanel.Height - 4); - } } public void Update(QueueItem queueItem) @@ -157,17 +95,8 @@ namespace KaraokePlayer songTitleLabel.Text = queueItem.Song.Title; } - // Force a repaint to update the gradient - mainPanel.Invalidate(); - } - - protected override void OnFormClosing(FormClosingEventArgs e) - { - fadeTimer?.Stop(); - fadeTimer?.Dispose(); - pulseTimer?.Stop(); - pulseTimer?.Dispose(); - base.OnFormClosing(e); + // Recalculate positioning after text changes to ensure proper sizing + CalculateDynamicPositions(); } } } diff --git a/SingsALot/MainWindow.xaml b/SingsALot/MainWindow.xaml index 23a0d43..8b3671a 100644 --- a/SingsALot/MainWindow.xaml +++ b/SingsALot/MainWindow.xaml @@ -9,7 +9,7 @@