v1.2: Font size menu (10 to 18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
weishaupt
2026-10-10 03:51:09 -04:00
co-authored by Claude Opus 5.5
parent 89586bd706
commit 8c09e56982
3 changed files with 34 additions and 4 deletions
+32 -3
View File
@@ -21,7 +21,7 @@ namespace QuickClaude
readonly TextBlock status = new TextBlock();
readonly TextBlock grip = new TextBlock();
WF.NotifyIcon tray;
WF.ToolStripMenuItem fontMenu, topItem, blackItem, whiteItem, lookItem, editItem, autoItem, folderItem;
WF.ToolStripMenuItem fontMenu, sizeMenu, topItem, blackItem, whiteItem, lookItem, editItem, autoItem, folderItem;
bool lastWasTool;
bool quitting;
@@ -30,14 +30,17 @@ namespace QuickClaude
// The current font (picked from the tray's Font menu). Still called Mono since
// ConfirmWindow and DarkMenu read it when they open.
internal static FontFamily Mono = new FontFamily("Consolas, Courier New");
// Matches wIRC at its smallest font slider setting (10sp = 10 WPF units)
internal const double TextSize = 10;
// Picked from the tray's Font size menu, 10 to 18 (same units as wIRC's font size
// slider: 10sp = 10 WPF units). ConfirmWindow and DarkMenu read it when they open.
internal const double MinTextSize = 10, MaxTextSize = 18;
internal static double TextSize = 10;
const double ResizeEdge = 6;
public MainWindow()
{
settings = Settings.Load();
Mono = Fonts.Find(settings.Font).Family;
TextSize = Math.Clamp(Math.Round(settings.FontSize), MinTextSize, MaxTextSize);
Title = "QuickClaude";
WindowStyle = WindowStyle.None;
@@ -147,6 +150,24 @@ namespace QuickClaude
((Grid)Content).ContextMenu = DarkMenu.Make(null, NewConversation);
}
void SetFontSize(double size)
{
size = Math.Clamp(size, MinTextSize, MaxTextSize);
settings.FontSize = size;
settings.Save();
TextSize = size;
FontSize = size;
transcript.FontSize = size;
input.FontSize = size;
status.FontSize = size;
grip.FontSize = size;
BuildContextMenus();
transcript.ScrollToEnd();
if (sizeMenu != null)
foreach (WF.ToolStripMenuItem item in sizeMenu.DropDownItems)
item.Checked = item.Text == size.ToString();
}
void SetFont(string name)
{
var choice = Fonts.Find(name);
@@ -388,6 +409,14 @@ namespace QuickClaude
}
menu.Items.Add(fontMenu);
sizeMenu = new WF.ToolStripMenuItem("Font size");
for (int px = (int)MinTextSize; px <= (int)MaxTextSize; px++)
{
double sz = px;
sizeMenu.DropDownItems.Add(new WF.ToolStripMenuItem(px.ToString(), null, (s, e) => SetFontSize(sz)) { Checked = sz == TextSize });
}
menu.Items.Add(sizeMenu);
topItem = new WF.ToolStripMenuItem("Always on top", null, (s, e) =>
{
settings.Topmost = !settings.Topmost; Topmost = settings.Topmost; topItem.Checked = settings.Topmost; settings.Save();