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 LuaCommentColor = -16744448;
public int LuaStringColor = -8355712; public int LuaStringColor = -8355712;
public int LuaSymbolColor = -16777216; public int LuaSymbolColor = -16777216;
public int EmuluaLibraryColor = 10349567; public int LuaLibraryColor = -6427649;
public int LuaLibraryColor = -8388480;
} }
public class SMSControllerTemplate public class SMSControllerTemplate

View File

@ -271,7 +271,7 @@ namespace BizHawk.MultiClient
if (after == '.') if (after == '.')
{ {
LuaText.Select(libraryWordMatch.Index, libraryWordMatch.Length); 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) private void syntaxHighlightingToolStripMenuItem_Click(object sender, EventArgs e)
{ {
LuaWriterColorConfig l = new LuaWriterColorConfig(); LuaWriterColorConfig l = new LuaWriterColorConfig();
// l.Load(); if (l.ShowDialog() == DialogResult.OK)
l.ShowDialog(); {
ProcessText(); //Update display with new settings
}
} }
private void fontToolStripMenuItem_Click(object sender, EventArgs e) private void fontToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -28,157 +28,175 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.OK = new System.Windows.Forms.Button(); this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button(); this.Cancel = new System.Windows.Forms.Button();
this.panelKeyWord = new System.Windows.Forms.Panel(); this.panelKeyWord = new System.Windows.Forms.Panel();
this.lblKeyWords = new System.Windows.Forms.Label(); this.lblKeyWords = new System.Windows.Forms.Label();
this.lblComments = new System.Windows.Forms.Label(); this.lblComments = new System.Windows.Forms.Label();
this.panelComment = new System.Windows.Forms.Panel(); this.panelComment = new System.Windows.Forms.Panel();
this.panelString = new System.Windows.Forms.Panel(); this.panelString = new System.Windows.Forms.Panel();
this.lblStrings = new System.Windows.Forms.Label(); this.lblStrings = new System.Windows.Forms.Label();
this.panelSymbol = new System.Windows.Forms.Panel(); this.panelSymbol = new System.Windows.Forms.Panel();
this.lblSymbols = new System.Windows.Forms.Label(); this.lblSymbols = new System.Windows.Forms.Label();
this.panelLibrary = new System.Windows.Forms.Panel(); this.panelLibrary = new System.Windows.Forms.Panel();
this.lblLibraries = new System.Windows.Forms.Label(); this.lblLibraries = new System.Windows.Forms.Label();
this.KeyWordColorDialog = new System.Windows.Forms.ColorDialog(); this.KeyWordColorDialog = new System.Windows.Forms.ColorDialog();
this.CommentColorDialog = new System.Windows.Forms.ColorDialog(); this.CommentColorDialog = new System.Windows.Forms.ColorDialog();
this.StringColorDialog = new System.Windows.Forms.ColorDialog(); this.StringColorDialog = new System.Windows.Forms.ColorDialog();
this.SymbolColorDialog = new System.Windows.Forms.ColorDialog(); this.SymbolColorDialog = new System.Windows.Forms.ColorDialog();
this.LibraryColorDialog = new System.Windows.Forms.ColorDialog(); this.LibraryColorDialog = new System.Windows.Forms.ColorDialog();
this.SuspendLayout(); this.buttonDefaults = new System.Windows.Forms.Button();
// this.SuspendLayout();
// OK //
// // OK
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); //
this.OK.Location = new System.Drawing.Point(116, 227); this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Name = "OK"; this.OK.Location = new System.Drawing.Point(116, 227);
this.OK.Size = new System.Drawing.Size(75, 23); this.OK.Name = "OK";
this.OK.TabIndex = 10; this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.Text = "&OK"; this.OK.TabIndex = 10;
this.OK.UseVisualStyleBackColor = true; this.OK.Text = "&OK";
this.OK.Click += new System.EventHandler(this.OK_Click); this.OK.UseVisualStyleBackColor = true;
// this.OK.Click += new System.EventHandler(this.OK_Click);
// Cancel //
// // Cancel
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); //
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.Location = new System.Drawing.Point(197, 227); this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Name = "Cancel"; this.Cancel.Location = new System.Drawing.Point(197, 227);
this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.Name = "Cancel";
this.Cancel.TabIndex = 11; this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.Text = "&Cancel"; this.Cancel.TabIndex = 11;
this.Cancel.UseVisualStyleBackColor = true; this.Cancel.Text = "&Cancel";
// this.Cancel.UseVisualStyleBackColor = true;
// panelKeyWord //
// // panelKeyWord
this.panelKeyWord.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; //
this.panelKeyWord.Location = new System.Drawing.Point(105, 10); this.panelKeyWord.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelKeyWord.Name = "panelKeyWord"; this.panelKeyWord.Location = new System.Drawing.Point(105, 10);
this.panelKeyWord.Size = new System.Drawing.Size(20, 20); this.panelKeyWord.Name = "panelKeyWord";
this.panelKeyWord.TabIndex = 1; this.panelKeyWord.Size = new System.Drawing.Size(20, 20);
// this.panelKeyWord.TabIndex = 1;
// lblKeyWords this.panelKeyWord.DoubleClick += new System.EventHandler(this.panelKeyWord_DoubleClick);
// //
this.lblKeyWords.AutoSize = true; // lblKeyWords
this.lblKeyWords.Location = new System.Drawing.Point(40, 17); //
this.lblKeyWords.Name = "lblKeyWords"; this.lblKeyWords.AutoSize = true;
this.lblKeyWords.Size = new System.Drawing.Size(59, 13); this.lblKeyWords.Location = new System.Drawing.Point(40, 17);
this.lblKeyWords.TabIndex = 0; this.lblKeyWords.Name = "lblKeyWords";
this.lblKeyWords.Text = "Key Words"; this.lblKeyWords.Size = new System.Drawing.Size(59, 13);
// this.lblKeyWords.TabIndex = 0;
// lblComments this.lblKeyWords.Text = "Key Words";
// //
this.lblComments.AutoSize = true; // lblComments
this.lblComments.Location = new System.Drawing.Point(43, 57); //
this.lblComments.Name = "lblComments"; this.lblComments.AutoSize = true;
this.lblComments.Size = new System.Drawing.Size(56, 13); this.lblComments.Location = new System.Drawing.Point(43, 57);
this.lblComments.TabIndex = 2; this.lblComments.Name = "lblComments";
this.lblComments.Text = "Comments"; this.lblComments.Size = new System.Drawing.Size(56, 13);
// this.lblComments.TabIndex = 2;
// panelComment this.lblComments.Text = "Comments";
// //
this.panelComment.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; // panelComment
this.panelComment.Location = new System.Drawing.Point(105, 50); //
this.panelComment.Name = "panelComment"; this.panelComment.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelComment.Size = new System.Drawing.Size(20, 20); this.panelComment.Location = new System.Drawing.Point(105, 50);
this.panelComment.TabIndex = 3; this.panelComment.Name = "panelComment";
// this.panelComment.Size = new System.Drawing.Size(20, 20);
// panelString this.panelComment.TabIndex = 3;
// this.panelComment.DoubleClick += new System.EventHandler(this.panelComment_DoubleClick);
this.panelString.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; //
this.panelString.Location = new System.Drawing.Point(105, 90); // panelString
this.panelString.Name = "panelString"; //
this.panelString.Size = new System.Drawing.Size(20, 20); this.panelString.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelString.TabIndex = 5; this.panelString.Location = new System.Drawing.Point(105, 90);
// this.panelString.Name = "panelString";
// lblStrings this.panelString.Size = new System.Drawing.Size(20, 20);
// this.panelString.TabIndex = 5;
this.lblStrings.AutoSize = true; this.panelString.DoubleClick += new System.EventHandler(this.panelString_DoubleClick);
this.lblStrings.Location = new System.Drawing.Point(60, 97); //
this.lblStrings.Name = "lblStrings"; // lblStrings
this.lblStrings.Size = new System.Drawing.Size(39, 13); //
this.lblStrings.TabIndex = 4; this.lblStrings.AutoSize = true;
this.lblStrings.Text = "Strings"; this.lblStrings.Location = new System.Drawing.Point(60, 97);
// this.lblStrings.Name = "lblStrings";
// panelSymbol this.lblStrings.Size = new System.Drawing.Size(39, 13);
// this.lblStrings.TabIndex = 4;
this.panelSymbol.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.lblStrings.Text = "Strings";
this.panelSymbol.Location = new System.Drawing.Point(105, 130); //
this.panelSymbol.Name = "panelSymbol"; // panelSymbol
this.panelSymbol.Size = new System.Drawing.Size(20, 20); //
this.panelSymbol.TabIndex = 7; this.panelSymbol.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
// this.panelSymbol.Location = new System.Drawing.Point(105, 130);
// lblSymbols this.panelSymbol.Name = "panelSymbol";
// this.panelSymbol.Size = new System.Drawing.Size(20, 20);
this.lblSymbols.AutoSize = true; this.panelSymbol.TabIndex = 7;
this.lblSymbols.Location = new System.Drawing.Point(53, 137); this.panelSymbol.DoubleClick += new System.EventHandler(this.panelSymbol_DoubleClick);
this.lblSymbols.Name = "lblSymbols"; //
this.lblSymbols.Size = new System.Drawing.Size(46, 13); // lblSymbols
this.lblSymbols.TabIndex = 6; //
this.lblSymbols.Text = "Symbols"; this.lblSymbols.AutoSize = true;
// this.lblSymbols.Location = new System.Drawing.Point(53, 137);
// panelLibrary this.lblSymbols.Name = "lblSymbols";
// this.lblSymbols.Size = new System.Drawing.Size(46, 13);
this.panelLibrary.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.lblSymbols.TabIndex = 6;
this.panelLibrary.Location = new System.Drawing.Point(105, 170); this.lblSymbols.Text = "Symbols";
this.panelLibrary.Name = "panelLibrary"; //
this.panelLibrary.Size = new System.Drawing.Size(20, 20); // panelLibrary
this.panelLibrary.TabIndex = 9; //
// this.panelLibrary.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
// lblLibraries this.panelLibrary.Location = new System.Drawing.Point(105, 170);
// this.panelLibrary.Name = "panelLibrary";
this.lblLibraries.AutoSize = true; this.panelLibrary.Size = new System.Drawing.Size(20, 20);
this.lblLibraries.Location = new System.Drawing.Point(53, 177); this.panelLibrary.TabIndex = 9;
this.lblLibraries.Name = "lblLibraries"; this.panelLibrary.DoubleClick += new System.EventHandler(this.panelLibrary_DoubleClick);
this.lblLibraries.Size = new System.Drawing.Size(46, 13); //
this.lblLibraries.TabIndex = 8; // lblLibraries
this.lblLibraries.Text = "Libraries"; //
// this.lblLibraries.AutoSize = true;
// LuaWriterColorConfig this.lblLibraries.Location = new System.Drawing.Point(53, 177);
// this.lblLibraries.Name = "lblLibraries";
this.AcceptButton = this.OK; this.lblLibraries.Size = new System.Drawing.Size(46, 13);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.lblLibraries.TabIndex = 8;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.lblLibraries.Text = "Libraries";
this.CancelButton = this.Cancel; //
this.ClientSize = new System.Drawing.Size(284, 262); // buttonDefaults
this.Controls.Add(this.panelLibrary); //
this.Controls.Add(this.lblLibraries); this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Controls.Add(this.panelSymbol); this.buttonDefaults.Location = new System.Drawing.Point(12, 227);
this.Controls.Add(this.lblSymbols); this.buttonDefaults.Name = "buttonDefaults";
this.Controls.Add(this.panelString); this.buttonDefaults.Size = new System.Drawing.Size(75, 23);
this.Controls.Add(this.lblStrings); this.buttonDefaults.TabIndex = 12;
this.Controls.Add(this.panelComment); this.buttonDefaults.Text = "&Deafults";
this.Controls.Add(this.lblComments); this.buttonDefaults.UseVisualStyleBackColor = true;
this.Controls.Add(this.lblKeyWords); this.buttonDefaults.Click += new System.EventHandler(this.buttonDefaults_Click);
this.Controls.Add(this.panelKeyWord); //
this.Controls.Add(this.Cancel); // LuaWriterColorConfig
this.Controls.Add(this.OK); //
this.Name = "LuaWriterColorConfig"; this.AcceptButton = this.OK;
this.ShowIcon = false; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Text = "Syntax Highlight Config"; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Load += new System.EventHandler(this.LuaWriterColorConfig_Load); this.CancelButton = this.Cancel;
this.ResumeLayout(false); this.ClientSize = new System.Drawing.Size(284, 262);
this.PerformLayout(); this.Controls.Add(this.buttonDefaults);
this.Controls.Add(this.panelLibrary);
this.Controls.Add(this.lblLibraries);
this.Controls.Add(this.panelSymbol);
this.Controls.Add(this.lblSymbols);
this.Controls.Add(this.panelString);
this.Controls.Add(this.lblStrings);
this.Controls.Add(this.panelComment);
this.Controls.Add(this.lblComments);
this.Controls.Add(this.lblKeyWords);
this.Controls.Add(this.panelKeyWord);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.OK);
this.Name = "LuaWriterColorConfig";
this.ShowIcon = false;
this.Text = "Syntax Highlight Config";
this.Load += new System.EventHandler(this.LuaWriterColorConfig_Load);
this.ResumeLayout(false);
this.PerformLayout();
} }
@ -201,5 +219,6 @@
private System.Windows.Forms.ColorDialog StringColorDialog; private System.Windows.Forms.ColorDialog StringColorDialog;
private System.Windows.Forms.ColorDialog SymbolColorDialog; private System.Windows.Forms.ColorDialog SymbolColorDialog;
private System.Windows.Forms.ColorDialog LibraryColorDialog; 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) private void LuaWriterColorConfig_Load(object sender, EventArgs e)
{ {
//Set the initial colors into the panels //Set the initial colors into the panels
KeyWordColorDialog.Color = Color.FromArgb(KeyWordColor); SetKeyWordColor(KeyWordColor);
CommentColorDialog.Color = Color.FromArgb(CommentColor); SetCommentColor(CommentColor);
StringColorDialog.Color = Color.FromArgb(StringColor); SetStringColor(StringColor);
SymbolColorDialog.Color = Color.FromArgb(SymbolColor); SetSymbolColor(SymbolColor);
LibraryColorDialog.Color = Color.FromArgb(LibraryColor); 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) private void panelKeyWord_DoubleClick(object sender, EventArgs e)
{ {
if (KeyWordColorDialog.ShowDialog() == DialogResult.OK) if (KeyWordColorDialog.ShowDialog() == DialogResult.OK)
{ {
KeyWordColor = KeyWordColorDialog.Color.ToArgb(); //Set new color SetKeyWordColor(KeyWordColorDialog.Color.ToArgb());
panelKeyWord.BackColor = KeyWordColorDialog.Color; //Update panel color with selection
} }
} }
//Pop up color dialog when double-clicked
private void panelComment_DoubleClick(object sender, EventArgs e) private void panelComment_DoubleClick(object sender, EventArgs e)
{ {
if (CommentColorDialog.ShowDialog() == DialogResult.OK) if (CommentColorDialog.ShowDialog() == DialogResult.OK)
{ {
CommentColor = CommentColorDialog.Color.ToArgb(); //Set new color SetCommentColor(CommentColorDialog.Color.ToArgb());
panelComment.BackColor = CommentColorDialog.Color; //Update panel color with selection
} }
} }
//Pop up color dialog when double-clicked
private void panelString_DoubleClick(object sender, EventArgs e) private void panelString_DoubleClick(object sender, EventArgs e)
{ {
if (StringColorDialog.ShowDialog() == DialogResult.OK) if (StringColorDialog.ShowDialog() == DialogResult.OK)
{ {
StringColor = StringColorDialog.Color.ToArgb(); //Set new color SetStringColor(StringColorDialog.Color.ToArgb());
panelString.BackColor = StringColorDialog.Color; //Update panel color with selection
} }
} }
//Pop up color dialog when double-clicked
private void panelSymbol_DoubleClick(object sender, EventArgs e) private void panelSymbol_DoubleClick(object sender, EventArgs e)
{ {
if (SymbolColorDialog.ShowDialog() == DialogResult.OK) if (SymbolColorDialog.ShowDialog() == DialogResult.OK)
{ {
SymbolColor = SymbolColorDialog.Color.ToArgb(); //Set new color SetSymbolColor(SymbolColorDialog.Color.ToArgb());
panelSymbol.BackColor = SymbolColorDialog.Color; //Update panel color with selection
} }
} }
//Pop up color dialog when double-clicked
private void panelLibrary_DoubleClick(object sender, EventArgs e) private void panelLibrary_DoubleClick(object sender, EventArgs e)
{ {
if (LibraryColorDialog.ShowDialog() == DialogResult.OK) if (LibraryColorDialog.ShowDialog() == DialogResult.OK)
{ {
LibraryColor = LibraryColorDialog.Color.ToArgb(); //Set new color SetLibraryColor(LibraryColorDialog.Color.ToArgb());
panelLibrary.BackColor = LibraryColorDialog.Color; //Update panel color with selection LibraryColorDialog.Color = Color.FromArgb(10349567);
} }
} }
private void OK_Click(object sender, EventArgs e) 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);
}
} }
} }