Add a font picker, fixes #952

This commit is contained in:
adelikat 2019-11-24 14:58:58 -06:00
parent 8bbc2c75d0
commit 883fea9ec6
2 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,4 @@
using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk
namespace BizHawk.Client.EmuHawk
{ {
partial class TAStudio partial class TAStudio
{ {
@ -193,6 +191,7 @@ namespace BizHawk.Client.EmuHawk
this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox(); this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox();
this.BranchesMarkersSplit = new System.Windows.Forms.SplitContainer(); this.BranchesMarkersSplit = new System.Windows.Forms.SplitContainer();
this.MainVertialSplit = new System.Windows.Forms.SplitContainer(); this.MainVertialSplit = new System.Windows.Forms.SplitContainer();
this.SetFontMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TASMenu.SuspendLayout(); this.TASMenu.SuspendLayout();
this.TasStatusStrip.SuspendLayout(); this.TasStatusStrip.SuspendLayout();
this.RightClickMenu.SuspendLayout(); this.RightClickMenu.SuspendLayout();
@ -648,7 +647,8 @@ namespace BizHawk.Client.EmuHawk
this.toolStripSeparator14, this.toolStripSeparator14,
this.AutopauseAtEndOfMovieMenuItem, this.AutopauseAtEndOfMovieMenuItem,
this.sepToolStripMenuItem, this.sepToolStripMenuItem,
this.autoHoldFireToolStripMenuItem}); this.autoHoldFireToolStripMenuItem,
this.SetFontMenuItem});
this.ConfigSubMenu.Name = "ConfigSubMenu"; this.ConfigSubMenu.Name = "ConfigSubMenu";
this.ConfigSubMenu.Size = new System.Drawing.Size(50, 20); this.ConfigSubMenu.Size = new System.Drawing.Size(50, 20);
this.ConfigSubMenu.Text = "&Config"; this.ConfigSubMenu.Text = "&Config";
@ -1592,6 +1592,13 @@ namespace BizHawk.Client.EmuHawk
this.MainVertialSplit.TabIndex = 10; this.MainVertialSplit.TabIndex = 10;
this.MainVertialSplit.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.MainVerticalSplit_SplitterMoved); this.MainVertialSplit.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.MainVerticalSplit_SplitterMoved);
// //
// SetFontMenuItem
//
this.SetFontMenuItem.Name = "SetFontMenuItem";
this.SetFontMenuItem.Size = new System.Drawing.Size(264, 22);
this.SetFontMenuItem.Text = "Set Font";
this.SetFontMenuItem.Click += new System.EventHandler(this.SetFontMenuItem_Click);
//
// TAStudio // TAStudio
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -1794,5 +1801,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem AutoRestoreOnMouseUpOnlyMenuItem; private System.Windows.Forms.ToolStripMenuItem AutoRestoreOnMouseUpOnlyMenuItem;
private System.Windows.Forms.ToolStripMenuItem SingleClickFloatEditMenuItem; private System.Windows.Forms.ToolStripMenuItem SingleClickFloatEditMenuItem;
private System.Windows.Forms.ToolStripMenuItem LoadBranchOnDoubleclickMenuItem; private System.Windows.Forms.ToolStripMenuItem LoadBranchOnDoubleclickMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetFontMenuItem;
} }
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -52,6 +53,9 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist] [ConfigPersist]
public TAStudioSettings Settings { get; set; } public TAStudioSettings Settings { get; set; }
[ConfigPersist]
public Font TasViewFont { get; set; } = new Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
public class TAStudioSettings public class TAStudioSettings
{ {
public TAStudioSettings() public TAStudioSettings()
@ -304,6 +308,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
TasView.Font = TasViewFont;
RefreshDialog(); RefreshDialog();
_initialized = true; _initialized = true;
} }
@ -1175,5 +1180,20 @@ namespace BizHawk.Client.EmuHawk
{ {
GenericDragEnter(sender, e); GenericDragEnter(sender, e);
} }
private void SetFontMenuItem_Click(object sender, EventArgs e)
{
using var fontDialog = new FontDialog
{
ShowColor = false,
Font = TasView.Font
};
var result = fontDialog.ShowDialog();
if (result != DialogResult.Cancel)
{
TasView.Font = TasViewFont = fontDialog.Font;
TasView.Refresh();
}
}
} }
} }