Lua Writer - save font and font size to config (todo: font style), hook up exit button
This commit is contained in:
parent
4d910ce93c
commit
bbbc51ecf8
|
@ -550,13 +550,15 @@ namespace BizHawk.MultiClient
|
||||||
public int GifAnimatorSpeed;
|
public int GifAnimatorSpeed;
|
||||||
public bool GifAnimatorReversable;
|
public bool GifAnimatorReversable;
|
||||||
|
|
||||||
//LuaWriter Settings
|
//LuaWriter Settings
|
||||||
public int LuaDefaultTextColor = -16777216;
|
public int LuaDefaultTextColor = -16777216;
|
||||||
public int LuaKeyWordColor = -16776961;
|
public int LuaKeyWordColor = -16776961;
|
||||||
public int LuaCommentColor = -16744448;
|
public int LuaCommentColor = -16744448;
|
||||||
public int LuaStringColor = -8355712;
|
public int LuaStringColor = -8355712;
|
||||||
public int LuaSymbolColor = -16777216;
|
public int LuaSymbolColor = -16777216;
|
||||||
public int LuaLibraryColor = -6427649;
|
public int LuaLibraryColor = -6427649;
|
||||||
|
public float LuaWriterFontSize = 11;
|
||||||
|
public string LuaWriterFont = "Courier New";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SMSControllerTemplate
|
public class SMSControllerTemplate
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||||
this.exitToolStripMenuItem.Text = "E&xit";
|
this.exitToolStripMenuItem.Text = "E&xit";
|
||||||
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// configToolStripMenuItem
|
// configToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,14 +15,16 @@ namespace BizHawk.MultiClient
|
||||||
public partial class LuaWriter : Form
|
public partial class LuaWriter : Form
|
||||||
{
|
{
|
||||||
//TODO:
|
//TODO:
|
||||||
|
//ability to save new script (currently causes an exception)
|
||||||
|
//New scripts should be added to lua console automatically
|
||||||
//make functions is string part of string or comment since the actual way of validating it isn't correct
|
//make functions is string part of string or comment since the actual way of validating it isn't correct
|
||||||
|
//Save fontstyle to config
|
||||||
//Line numbers
|
//Line numbers
|
||||||
//Option to toggle line numbers
|
//Option to toggle line numbers
|
||||||
//Go to line number Ctrl+G
|
//Go to line number Ctrl+G
|
||||||
//Auto-complete drop down on functions in libraries
|
//Auto-complete drop down on functions in libraries
|
||||||
//intellisense on library functions
|
//intellisense on library functions
|
||||||
//Option to turn off basic lua script
|
//Option to turn off basic lua script
|
||||||
//Load/Save font
|
|
||||||
//Tool strip
|
//Tool strip
|
||||||
//function toolstrip button (inserts a function end block and puts cursor on blank line between them
|
//function toolstrip button (inserts a function end block and puts cursor on blank line between them
|
||||||
//when pressing enter on function blah, it should put the end afterwards
|
//when pressing enter on function blah, it should put the end afterwards
|
||||||
|
@ -39,7 +41,6 @@ namespace BizHawk.MultiClient
|
||||||
char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' };
|
char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' };
|
||||||
public Regex libraryWords;
|
public Regex libraryWords;
|
||||||
public Regex LuaLibraryWords = new Regex("coroutine|package|debug|file|io|math|os|package|string|table");
|
public Regex LuaLibraryWords = new Regex("coroutine|package|debug|file|io|math|os|package|string|table");
|
||||||
Font LuaTextFont = new Font("Courier New", 8);
|
|
||||||
|
|
||||||
public LuaWriter()
|
public LuaWriter()
|
||||||
{
|
{
|
||||||
|
@ -291,10 +292,16 @@ namespace BizHawk.MultiClient
|
||||||
libraryWords = new Regex(list.ToString());
|
libraryWords = new Regex(list.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadFont()
|
||||||
|
{
|
||||||
|
LuaText.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
|
||||||
|
}
|
||||||
|
|
||||||
private void LuaWriter_Load(object sender, EventArgs e)
|
private void LuaWriter_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//LuaTextFont;
|
//LuaTextFont;
|
||||||
LuaText.SelectionTabs = new int[] { 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 480, 500, 520, 540, 560, 580, 600 }; //adelikat: What a goofy way to have to do this
|
LuaText.SelectionTabs = new int[] { 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 480, 500, 520, 540, 560, 580, 600 }; //adelikat: What a goofy way to have to do this
|
||||||
|
LoadFont();
|
||||||
GenerateLibraryRegex();
|
GenerateLibraryRegex();
|
||||||
if (!String.IsNullOrWhiteSpace(CurrentFile))
|
if (!String.IsNullOrWhiteSpace(CurrentFile))
|
||||||
{
|
{
|
||||||
|
@ -466,8 +473,10 @@ namespace BizHawk.MultiClient
|
||||||
DialogResult result = f.ShowDialog();
|
DialogResult result = f.ShowDialog();
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LuaText.Font = LuaTextFont = f.Font;
|
LuaText.Font = f.Font;
|
||||||
ProcessText(); //Re-update coloring and such when font changes
|
Global.Config.LuaWriterFont = f.Font.Name;
|
||||||
|
Global.Config.LuaWriterFontSize = f.Font.Size;
|
||||||
|
ProcessText(); //Re-update coloring and such when font changes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,5 +594,11 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//TODO: check for changes and ask save
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue