Lua writer color config is now functional, with default button; small fix to default library color; reverted introduction of redundant "Emulua..." value.

This commit is contained in:
jxq2000 2012-07-26 00:48:19 +00:00
parent c0015a5b4c
commit caa606af71
4 changed files with 246 additions and 174 deletions

View File

@ -556,8 +556,7 @@ namespace BizHawk.MultiClient
public int LuaCommentColor = -16744448;
public int LuaStringColor = -8355712;
public int LuaSymbolColor = -16777216;
public int EmuluaLibraryColor = 10349567;
public int LuaLibraryColor = -8388480;
public int LuaLibraryColor = -6427649;
}
public class SMSControllerTemplate

View File

@ -271,7 +271,7 @@ namespace BizHawk.MultiClient
if (after == '.')
{
LuaText.Select(libraryWordMatch.Index, libraryWordMatch.Length);
LuaText.SelectionColor = Color.FromArgb(Global.Config.EmuluaLibraryColor);
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor);
}
}
}
@ -453,8 +453,11 @@ namespace BizHawk.MultiClient
private void syntaxHighlightingToolStripMenuItem_Click(object sender, EventArgs e)
{
LuaWriterColorConfig l = new LuaWriterColorConfig();
// l.Load();
l.ShowDialog();
if (l.ShowDialog() == DialogResult.OK)
{
ProcessText(); //Update display with new settings
}
}
private void fontToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -45,6 +45,7 @@
this.StringColorDialog = new System.Windows.Forms.ColorDialog();
this.SymbolColorDialog = new System.Windows.Forms.ColorDialog();
this.LibraryColorDialog = new System.Windows.Forms.ColorDialog();
this.buttonDefaults = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// OK
@ -76,6 +77,7 @@
this.panelKeyWord.Name = "panelKeyWord";
this.panelKeyWord.Size = new System.Drawing.Size(20, 20);
this.panelKeyWord.TabIndex = 1;
this.panelKeyWord.DoubleClick += new System.EventHandler(this.panelKeyWord_DoubleClick);
//
// lblKeyWords
//
@ -102,6 +104,7 @@
this.panelComment.Name = "panelComment";
this.panelComment.Size = new System.Drawing.Size(20, 20);
this.panelComment.TabIndex = 3;
this.panelComment.DoubleClick += new System.EventHandler(this.panelComment_DoubleClick);
//
// panelString
//
@ -110,6 +113,7 @@
this.panelString.Name = "panelString";
this.panelString.Size = new System.Drawing.Size(20, 20);
this.panelString.TabIndex = 5;
this.panelString.DoubleClick += new System.EventHandler(this.panelString_DoubleClick);
//
// lblStrings
//
@ -127,6 +131,7 @@
this.panelSymbol.Name = "panelSymbol";
this.panelSymbol.Size = new System.Drawing.Size(20, 20);
this.panelSymbol.TabIndex = 7;
this.panelSymbol.DoubleClick += new System.EventHandler(this.panelSymbol_DoubleClick);
//
// lblSymbols
//
@ -144,6 +149,7 @@
this.panelLibrary.Name = "panelLibrary";
this.panelLibrary.Size = new System.Drawing.Size(20, 20);
this.panelLibrary.TabIndex = 9;
this.panelLibrary.DoubleClick += new System.EventHandler(this.panelLibrary_DoubleClick);
//
// lblLibraries
//
@ -154,6 +160,17 @@
this.lblLibraries.TabIndex = 8;
this.lblLibraries.Text = "Libraries";
//
// buttonDefaults
//
this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDefaults.Location = new System.Drawing.Point(12, 227);
this.buttonDefaults.Name = "buttonDefaults";
this.buttonDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonDefaults.TabIndex = 12;
this.buttonDefaults.Text = "&Deafults";
this.buttonDefaults.UseVisualStyleBackColor = true;
this.buttonDefaults.Click += new System.EventHandler(this.buttonDefaults_Click);
//
// LuaWriterColorConfig
//
this.AcceptButton = this.OK;
@ -161,6 +178,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.buttonDefaults);
this.Controls.Add(this.panelLibrary);
this.Controls.Add(this.lblLibraries);
this.Controls.Add(this.panelSymbol);
@ -201,5 +219,6 @@
private System.Windows.Forms.ColorDialog StringColorDialog;
private System.Windows.Forms.ColorDialog SymbolColorDialog;
private System.Windows.Forms.ColorDialog LibraryColorDialog;
private System.Windows.Forms.Button buttonDefaults;
}
}

View File

@ -26,61 +26,112 @@ namespace BizHawk.MultiClient.tools
private void LuaWriterColorConfig_Load(object sender, EventArgs e)
{
//Set the initial colors into the panels
KeyWordColorDialog.Color = Color.FromArgb(KeyWordColor);
CommentColorDialog.Color = Color.FromArgb(CommentColor);
StringColorDialog.Color = Color.FromArgb(StringColor);
SymbolColorDialog.Color = Color.FromArgb(SymbolColor);
LibraryColorDialog.Color = Color.FromArgb(LibraryColor);
SetKeyWordColor(KeyWordColor);
SetCommentColor(CommentColor);
SetStringColor(StringColor);
SetSymbolColor(SymbolColor);
SetLibraryColor(LibraryColor);
}
private void SetKeyWordColor(int color)
{
KeyWordColor = color; //Set new color
panelKeyWord.BackColor = Color.FromArgb(color); //Update panel color with new selection
}
private void SetCommentColor(int color)
{
CommentColor = color; //Set new color
panelComment.BackColor = Color.FromArgb(color); //Update panel color with new selection
}
private void SetStringColor(int color)
{
StringColor = color; //Set new color
panelString.BackColor = Color.FromArgb(color); //Update panel color with new selection
}
private void SetSymbolColor(int color)
{
SymbolColor = color; //Set new color
panelSymbol.BackColor = Color.FromArgb(color); //Update panel color with new selection
}
private void SetLibraryColor(int color)
{
LibraryColor = color; //Set new color
panelLibrary.BackColor = Color.FromArgb(color); //Update panel color with new selection
}
//Pop up color dialog when double-clicked
private void panelKeyWord_DoubleClick(object sender, EventArgs e)
{
if (KeyWordColorDialog.ShowDialog() == DialogResult.OK)
{
KeyWordColor = KeyWordColorDialog.Color.ToArgb(); //Set new color
panelKeyWord.BackColor = KeyWordColorDialog.Color; //Update panel color with selection
SetKeyWordColor(KeyWordColorDialog.Color.ToArgb());
}
}
//Pop up color dialog when double-clicked
private void panelComment_DoubleClick(object sender, EventArgs e)
{
if (CommentColorDialog.ShowDialog() == DialogResult.OK)
{
CommentColor = CommentColorDialog.Color.ToArgb(); //Set new color
panelComment.BackColor = CommentColorDialog.Color; //Update panel color with selection
SetCommentColor(CommentColorDialog.Color.ToArgb());
}
}
//Pop up color dialog when double-clicked
private void panelString_DoubleClick(object sender, EventArgs e)
{
if (StringColorDialog.ShowDialog() == DialogResult.OK)
{
StringColor = StringColorDialog.Color.ToArgb(); //Set new color
panelString.BackColor = StringColorDialog.Color; //Update panel color with selection
SetStringColor(StringColorDialog.Color.ToArgb());
}
}
//Pop up color dialog when double-clicked
private void panelSymbol_DoubleClick(object sender, EventArgs e)
{
if (SymbolColorDialog.ShowDialog() == DialogResult.OK)
{
SymbolColor = SymbolColorDialog.Color.ToArgb(); //Set new color
panelSymbol.BackColor = SymbolColorDialog.Color; //Update panel color with selection
SetSymbolColor(SymbolColorDialog.Color.ToArgb());
}
}
//Pop up color dialog when double-clicked
private void panelLibrary_DoubleClick(object sender, EventArgs e)
{
if (LibraryColorDialog.ShowDialog() == DialogResult.OK)
{
LibraryColor = LibraryColorDialog.Color.ToArgb(); //Set new color
panelLibrary.BackColor = LibraryColorDialog.Color; //Update panel color with selection
SetLibraryColor(LibraryColorDialog.Color.ToArgb());
LibraryColorDialog.Color = Color.FromArgb(10349567);
}
}
private void OK_Click(object sender, EventArgs e)
{
SaveData(); //Save the chosen settings
this.DialogResult = DialogResult.OK;
this.Close();
}
private void SaveData()
{
Global.Config.LuaKeyWordColor = KeyWordColor;
Global.Config.LuaCommentColor = CommentColor;
Global.Config.LuaStringColor = StringColor;
Global.Config.LuaSymbolColor = SymbolColor;
Global.Config.LuaLibraryColor = LibraryColor;
}
private void buttonDefaults_Click(object sender, EventArgs e)
{
SetKeyWordColor(-16776961);
SetCommentColor(-16744448);
SetStringColor(-8355712);
SetSymbolColor(-16777216);
SetLibraryColor(-6427649);
}
}
}