Linux: Added DroidSansMono font + changed default size

This commit is contained in:
Souryo 2016-12-18 12:43:20 -05:00
parent b2b00edf3d
commit 760011b66d
13 changed files with 47 additions and 13 deletions

View file

@ -55,6 +55,18 @@ namespace Mesen.GUI.Config
}
}
public static string FontFolder
{
get
{
string fontPath = Environment.GetFolderPath(Environment.SpecialFolder.Fonts, Environment.SpecialFolderOption.Create);
if(!Directory.Exists(fontPath)) {
Directory.CreateDirectory(fontPath);
}
return fontPath;
}
}
public static string MovieFolder
{
get

View file

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using Mesen.GUI.Debugger;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Config
{
@ -30,7 +31,7 @@ namespace Mesen.GUI.Config
{
public ByteCodePosition ByteCodePosition = ByteCodePosition.Hidden;
public PrgAddressPosition PrgAddressPosition = PrgAddressPosition.Hidden;
public float FontSize = 13;
public float FontSize = BaseControl.DefaultFontSize;
}
public class DebugWorkspace
@ -117,7 +118,7 @@ namespace Mesen.GUI.Config
public bool RamAutoRefresh = true;
public int RamColumnCount = 2;
public float RamFontSize = 13;
public float RamFontSize = BaseControl.DefaultFontSize;
public int WindowWidth = -1;
public int WindowHeight = -1;

View file

@ -6,12 +6,14 @@ namespace Mesen.GUI.Controls
{
public class BaseControl : UserControl
{
public static float DefaultFontSize = Program.IsMono ? 10 : 12;
public static string MonospaceFontFamily
{
get
{
if(Program.IsMono) {
return "Ubuntu Mono";
return "DroidSansMono";
} else {
return "Consolas";
}

View file

@ -52,7 +52,6 @@
//
this.ctrlDataViewer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ctrlDataViewer.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDataViewer.FontSize = 13F;
this.ctrlDataViewer.Location = new System.Drawing.Point(3, 3);
this.ctrlDataViewer.Name = "ctrlDataViewer";
this.ctrlDataViewer.ShowContentNotes = false;

View file

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger.Controls
{
@ -19,6 +20,7 @@ namespace Mesen.GUI.Debugger.Controls
{
InitializeComponent();
this.ctrlDataViewer.MarginWidth = 3;
this.ctrlDataViewer.FontSize = BaseControl.DefaultFontSize;
}
protected override ctrlScrollableTextbox ScrollableTextbox

View file

@ -162,7 +162,6 @@
this.ctrlScrollableTextbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tableLayoutPanel1.SetColumnSpan(this.ctrlScrollableTextbox, 2);
this.ctrlScrollableTextbox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlScrollableTextbox.FontSize = 13F;
this.ctrlScrollableTextbox.Location = new System.Drawing.Point(3, 35);
this.ctrlScrollableTextbox.Name = "ctrlScrollableTextbox";
this.ctrlScrollableTextbox.ShowContentNotes = false;

View file

@ -20,6 +20,8 @@ namespace Mesen.GUI.Debugger.Controls
public ctrlMemoryAccessCounters()
{
InitializeComponent();
this.ctrlScrollableTextbox.FontSize = BaseControl.DefaultFontSize;
bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
if(!designMode) {

View file

@ -220,7 +220,7 @@ namespace Mesen.GUI.Debugger
return true;
case Keys.Control | Keys.D0:
this.FontSize = 13;
this.FontSize = BaseControl.DefaultFontSize;
return true;
}

View file

@ -12,6 +12,7 @@ using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Debugger.Controls;
using Mesen.GUI.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
@ -507,7 +508,7 @@ namespace Mesen.GUI.Debugger
private void mnuResetFontSize_Click(object sender, EventArgs e)
{
_lastCodeWindow.FontSize = 13;
_lastCodeWindow.FontSize = BaseControl.DefaultFontSize;
}
private void mnuClose_Click(object sender, EventArgs e)

View file

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
@ -107,7 +108,7 @@ namespace Mesen.GUI.Debugger
private void mnuResetFontSize_Click(object sender, EventArgs e)
{
this.ctrlHexViewer.FontSize = 13;
this.ctrlHexViewer.FontSize = BaseControl.DefaultFontSize;
this.UpdateConfig();
}

Binary file not shown.

View file

@ -73,7 +73,9 @@ namespace Mesen.GUI
Directory.SetCurrentDirectory(ConfigManager.HomeFolder);
try {
ResourceHelper.LoadResources(ConfigManager.Config.PreferenceInfo.DisplayLanguage);
ResourceManager.ExtractResources();
if(!ResourceManager.ExtractResources()) {
return;
}
} catch(FileNotFoundException) {
string message = "The Microsoft .NET Framework 4.5 could not be found. Please download and install the latest version of the .NET Framework from Microsoft's website and try again.";
switch(ResourceHelper.GetCurrentLanguage()) {

View file

@ -74,7 +74,7 @@ namespace Mesen.GUI
} catch { }
}
public static void ExtractResources()
public static bool ExtractResources()
{
CleanupOldFiles();
@ -91,16 +91,29 @@ namespace Mesen.GUI
string outputFilename = Path.Combine(baseFolder, entry.Name.Replace(suffix, ""));
ExtractFile(entry, outputFilename);
} else if(entry.Name == "MesenUpdater.exe" || entry.Name == "MesenDB.txt") {
string outputFilename = Path.Combine(ConfigManager.HomeFolder, entry.Name.Replace(suffix, ""));
string outputFilename = Path.Combine(ConfigManager.HomeFolder, entry.Name);
ExtractFile(entry, outputFilename);
} else if(entry.Name.StartsWith("Google.Apis") || entry.Name == "BouncyCastle.Crypto.dll" || entry.Name == "Zlib.Portable.dll" || entry.Name == "Newtonsoft.Json.dll") {
string outputFilename = Path.Combine(ConfigManager.HomeFolder, "GoogleDrive", entry.Name.Replace(suffix, ""));
string outputFilename = Path.Combine(ConfigManager.HomeFolder, "GoogleDrive", entry.Name);
ExtractFile(entry, outputFilename);
} else if(entry.Name == "Font.24.spritefont" || entry.Name == "Font.64.spritefont" || entry.Name == "LICENSE.txt") {
string outputFilename = Path.Combine(ConfigManager.HomeFolder, "Resources", entry.Name.Replace(suffix, ""));
string outputFilename = Path.Combine(ConfigManager.HomeFolder, "Resources", entry.Name);
ExtractFile(entry, outputFilename);
} else if(entry.Name == "DroidSansMono.ttf") {
if(Program.IsMono) {
string outputFilename = Path.Combine(ConfigManager.FontFolder, entry.Name);
bool needRestart = !File.Exists(outputFilename);
ExtractFile(entry, outputFilename);
if(needRestart) {
//If font is newly installed, restart Mesen (otherwise debugger will not be able to use the font and display incorrectly)
System.Diagnostics.Process.Start("mono", "\"" + Assembly.GetEntryAssembly().Location + "\" /delayrestart");
return false;
}
}
}
}
return true;
}
}
}