Resizable text in log box, news box, changelog box

This commit is contained in:
n00mkrad
2025-12-20 22:00:39 +01:00
parent 2f0ec88e9b
commit 9da3eaf07a
5 changed files with 142 additions and 22 deletions

View File

@@ -530,6 +530,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MiscUtils\FormatUtils.cs" />
<Compile Include="Ui\ControlExtensions.cs" />
<Compile Include="Ui\ControlTextResizer.cs" />
<Compile Include="Ui\DebugFormHelper.cs" />
<Compile Include="Ui\GetWebInfo.cs" />
<Compile Include="Ui\InterpolationProgress.cs" />

View File

@@ -360,7 +360,7 @@
this.label23.Location = new System.Drawing.Point(8, 130);
this.label23.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(105, 15);
this.label23.Size = new System.Drawing.Size(104, 15);
this.label23.TabIndex = 26;
this.label23.Text = "Fix Scene Changes";
//
@@ -393,7 +393,7 @@
this.label16.Location = new System.Drawing.Point(10, 10);
this.label16.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(61, 15);
this.label16.Size = new System.Drawing.Size(62, 15);
this.label16.TabIndex = 2;
this.label16.Text = "Trim Input";
//
@@ -413,6 +413,7 @@
this.runBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.runBtn.Enabled = false;
this.runBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.runBtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.runBtn.ForeColor = System.Drawing.Color.White;
this.runBtn.Location = new System.Drawing.Point(12, 418);
this.runBtn.Name = "runBtn";
@@ -803,9 +804,9 @@
this.welcomeLabel2.Location = new System.Drawing.Point(142, 3);
this.welcomeLabel2.Margin = new System.Windows.Forms.Padding(3, 0, 3, 10);
this.welcomeLabel2.Name = "welcomeLabel2";
this.welcomeLabel2.Size = new System.Drawing.Size(478, 40);
this.welcomeLabel2.Size = new System.Drawing.Size(268, 40);
this.welcomeLabel2.TabIndex = 5;
this.welcomeLabel2.Text = "Click The Interpolation Tab To Begin.";
this.welcomeLabel2.Text = "Click Here To Begin.";
this.welcomeLabel2.Click += new System.EventHandler(this.welcomeLabel2_Click);
//
// panel8
@@ -814,10 +815,10 @@
this.panel8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.panel8.Controls.Add(this.patronsLabel);
this.panel8.Controls.Add(this.label21);
this.panel8.Location = new System.Drawing.Point(593, 57);
this.panel8.Location = new System.Drawing.Point(593, 9);
this.panel8.Margin = new System.Windows.Forms.Padding(5);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(300, 193);
this.panel8.Size = new System.Drawing.Size(300, 241);
this.panel8.TabIndex = 4;
//
// patronsLabel
@@ -1259,7 +1260,7 @@
this.label24.Location = new System.Drawing.Point(6, 160);
this.label24.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(165, 15);
this.label24.Size = new System.Drawing.Size(164, 15);
this.label24.TabIndex = 87;
this.label24.Text = "Maximum Output Frame Rate";
//
@@ -1448,7 +1449,7 @@
this.label34.Location = new System.Drawing.Point(407, 42);
this.label34.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label34.Name = "label34";
this.label34.Size = new System.Drawing.Size(308, 15);
this.label34.Size = new System.Drawing.Size(307, 15);
this.label34.TabIndex = 69;
this.label34.Text = "Maximum Height. Video will be downscaled if it\'s bigger.";
//
@@ -1480,7 +1481,7 @@
this.label18.Location = new System.Drawing.Point(8, 40);
this.label18.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(196, 15);
this.label18.Size = new System.Drawing.Size(195, 15);
this.label18.TabIndex = 66;
this.label18.Text = "Maximum Video Input Size (Height)";
//

View File

@@ -36,6 +36,7 @@ namespace Flowframes.Forms.Main
public bool ShowModelDownloader = false;
private Enums.VfrMode prevVfrMode = (Enums.VfrMode)(-1);
private ControlTextResizer _ctrlTextResizer;
protected override CreateParams CreateParams
{
@@ -59,7 +60,12 @@ namespace Flowframes.Forms.Main
{
ShowInTaskbar = false;
Opacity = 0;
return;
}
_ctrlTextResizer = new ControlTextResizer();
var resizableTextCtrls = new List<Control>() { logBox, newsLabel, patronsLabel };
_ctrlTextResizer.Register(resizableTextCtrls);
}
private void Form1_Load(object sender, EventArgs e)

View File

@@ -144,19 +144,19 @@ Based on:
<data name="discordBtn.ButtonImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAh
NQAAITUBTKZc8wAAAsdJREFUWEftlztoFFEUhtcoiCBaqGCRNIJGxQdYqYgBNY1ERBF3Ky3cDS4oRCxE
Ky0iQSRoERQLKx/4QBEfaCWKDyw0hWLj+wGiYNxdfCvod5azcOfMnWR2yWw1P3ywc85/zr2zzJ17J5Mq
VaoElCuUp+UKlQ5o1VCk8MyBJdRM1lAyYpBZsANuwCf4B2c1XVWuONSSLQ6N0cuq8Ayq9z1chDyMeGOx
RbMVcA2+gwzk8hNOwhW4D4/gIdwFmcx5sDXCFzgF83WYxkSDeeCb2GjxCqbocPWL4qtOs6Q4rMPVJwrX
mkZJ8QsW6rDxlC1UWih64DRJmjM6dDxR0GUaJM1viL9gMF92ipvFIR1+eGGcCUmu3CjexnqZY+wxhc2k
S6cRLUzXTZFFdoTtsAr2wVfw+YSPsBNWwh6QF7TPV2NAp+EXhqkgTX3FggwQeCVwvc7Ju3yDxWqriutO
+KN5H4PZQmms2sPCsNQUWLx3SPyW8QknNB0QcdkWrbdGGdrU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xl6a09VoGaBKrkeGNtiTMZQJ11AlY3
k3d1LKiloJ44nlTh6BUOtsEbJshDx2O1y/ZVIeevylN4oe21PFXjzd9R/jHDBkp7bV8V+jkBD6S6bV8V
QvdOIFWYCOvD7Iy+SarRy2Tn2e7ci0XbVwWwPDxZp345waDboFaBmgxqJaiDybfI6+Q9+5oozNQXoG4k
D70E1FRQnaAeOXWDFM4B7Z2lIbavPvz9TNQ1p0iqNVl/eUTYAZKTUFBLeNisR7udOqlOhyUo9hcC1Irk
V4iLPbCDFwEsjwf1IaoTDqnnQc233qoBNQ/UIVBPw3pm7xcF1DpQj8NaB2qGvf/foKM8zF6rFnSUhtpr
DRo0aNAgnz96J9xPpXlFDAAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="menuStripQueue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Flowframes.Ui
{
internal class ControlTextResizer
{
// Dictionary to store the initial font size for every tracked Control
private readonly Dictionary<Control, float> _initialFontSizes = new Dictionary<Control, float>();
/// <summary>
/// Registers a list of Control objects to enable mouse wheel resizing and middle-click reset.
/// </summary>
/// <param name="controls">List of Controls to enhance.</param>
public void Register(IEnumerable<Control> controls)
{
if (controls == null) return;
foreach (var ctrl in controls)
{
// Avoid registering the same Control twice
if (_initialFontSizes.ContainsKey(ctrl)) continue;
// 1. Store the initial size so we can reset to it later
_initialFontSizes[ctrl] = ctrl.Font.Size;
// 2. Subscribe to the necessary events
ctrl.MouseWheel += Ctrl_MouseWheel;
ctrl.MouseDown += Ctrl_MouseDown;
}
}
/// <summary>
/// Handles the MouseWheel event to increase or decrease font size.
/// Note: In WinForms, the control usually needs focus to receive MouseWheel events.
/// </summary>
private void Ctrl_MouseWheel(object sender, MouseEventArgs e)
{
// Only resize if Ctrl is held down
if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
return;
if (sender is Control ctrl)
{
float currentSize = ctrl.Font.Size;
float newSize = currentSize;
if (e.Delta > 0)
{
newSize *= 1.1f; // Increase size
}
else if (e.Delta < 0)
{
newSize *= 0.9f; // Decrease size
}
// Retrieve initial size to calculate bounds
if (_initialFontSizes.TryGetValue(ctrl, out float initialSize))
{
float minSize = initialSize * 0.75f;
float maxSize = initialSize * 2.0f;
// Clamp the new size
if (newSize < minSize) newSize = minSize;
if (newSize > maxSize) newSize = maxSize;
}
else
{
// Fallback if initial size isn't found (shouldn't happen if registered correctly)
if (newSize < 1.0f) newSize = 1.0f;
}
// Only apply if the size actually changed
if (Math.Abs(newSize - currentSize) > 0.01f)
{
ctrl.Font = new Font(ctrl.Font.FontFamily, newSize, ctrl.Font.Style, ctrl.Font.Unit);
}
}
}
/// <summary>
/// Handles the MouseDown event to check for Middle Mouse Button clicks.
/// </summary>
private void Ctrl_MouseDown(object sender, MouseEventArgs e)
{
// Check if the Middle button (scroll wheel click) was pressed
if (e.Button == MouseButtons.Middle && sender is Control ctrl)
{
// Retrieve the initial size if we have it stored
if (_initialFontSizes.TryGetValue(ctrl, out float initialSize))
{
ctrl.Font = new Font(ctrl.Font.FontFamily, initialSize, ctrl.Font.Style, ctrl.Font.Unit);
}
}
}
/// <summary>
/// Optional: Call this to clean up events if you are disposing controls dynamically.
/// </summary>
public void Unregister(Control ctrl)
{
if (_initialFontSizes.ContainsKey(ctrl))
{
ctrl.MouseWheel -= Ctrl_MouseWheel;
ctrl.MouseDown -= Ctrl_MouseDown;
_initialFontSizes.Remove(ctrl);
}
}
}
}