Beginning of Lua Writer Color config form - not yet functioning.

Renamed a global variable for consistency with others.
This commit is contained in:
jxq2000 2012-07-24 01:11:36 +00:00
parent d774e49cd8
commit 6c5c33ea7a
5 changed files with 248 additions and 42 deletions

View File

@ -555,7 +555,7 @@ namespace BizHawk.MultiClient
public int LuaKeyWordColor = -16776961;
public int LuaCommentColor = -16744448;
public int LuaStringColor = -8355712;
public int LuaSymbolsColor = -16777216;
public int LuaSymbolColor = -16777216;
public int LuaLibraryColor = 10349567;
}

View File

@ -85,7 +85,7 @@ namespace BizHawk.MultiClient
while (LuaText.Find(mark.ToString(), currPos, RichTextBoxFinds.None) >= 0)
{
if (LuaText.SelectionColor.ToArgb() != Global.Config.LuaCommentColor && LuaText.SelectionColor.ToArgb() != Global.Config.LuaStringColor)
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaSymbolsColor);
LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaSymbolColor);
currPos = LuaText.SelectionStart + 1;
if (currPos == LuaText.Text.Length)
@ -447,7 +447,8 @@ namespace BizHawk.MultiClient
private void syntaxHighlightingToolStripMenuItem_Click(object sender, EventArgs e)
{
LuaWriterColorConfig l = new LuaWriterColorConfig();
l.ShowDialog();
// l.Load();
l.ShowDialog();
}
private void fontToolStripMenuItem_Click(object sender, EventArgs e)
@ -457,7 +458,7 @@ namespace BizHawk.MultiClient
if (result == DialogResult.OK)
{
LuaText.Font = LuaTextFont = f.Font;
ProcessText(); //Re-update coloring and such when font changes
}
}

View File

@ -28,43 +28,155 @@
/// </summary>
private void InitializeComponent()
{
this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// 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.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 0;
this.OK.Text = "&Ok";
this.OK.UseVisualStyleBackColor = true;
//
// 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.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 1;
this.Cancel.Text = "&Cancel";
this.Cancel.UseVisualStyleBackColor = true;
//
// LuaWriterColorConfig
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.OK);
this.Name = "LuaWriterColorConfig";
this.ShowIcon = false;
this.Text = "Syntax Highlight Config";
this.ResumeLayout(false);
this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.panelKeyWord = new System.Windows.Forms.Panel();
this.lblKeyWords = new System.Windows.Forms.Label();
this.lblComments = new System.Windows.Forms.Label();
this.panelComment = new System.Windows.Forms.Panel();
this.panelString = new System.Windows.Forms.Panel();
this.lblStrings = new System.Windows.Forms.Label();
this.panelSymbol = new System.Windows.Forms.Panel();
this.lblSymbols = new System.Windows.Forms.Label();
this.panelLibrary = new System.Windows.Forms.Panel();
this.lblLibraries = new System.Windows.Forms.Label();
this.KeyWordColorDialog = new System.Windows.Forms.ColorDialog();
this.CommentColorDialog = new System.Windows.Forms.ColorDialog();
this.StringColorDialog = new System.Windows.Forms.ColorDialog();
this.SymbolColorDialog = new System.Windows.Forms.ColorDialog();
this.LibraryColorDialog = new System.Windows.Forms.ColorDialog();
this.SuspendLayout();
//
// 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.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 10;
this.OK.Text = "&OK";
this.OK.UseVisualStyleBackColor = true;
//
// 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.Location = new System.Drawing.Point(197, 227);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 11;
this.Cancel.Text = "&Cancel";
this.Cancel.UseVisualStyleBackColor = true;
//
// panelKeyWord
//
this.panelKeyWord.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelKeyWord.Location = new System.Drawing.Point(105, 10);
this.panelKeyWord.Name = "panelKeyWord";
this.panelKeyWord.Size = new System.Drawing.Size(20, 20);
this.panelKeyWord.TabIndex = 1;
//
// lblKeyWords
//
this.lblKeyWords.AutoSize = true;
this.lblKeyWords.Location = new System.Drawing.Point(40, 17);
this.lblKeyWords.Name = "lblKeyWords";
this.lblKeyWords.Size = new System.Drawing.Size(59, 13);
this.lblKeyWords.TabIndex = 0;
this.lblKeyWords.Text = "Key Words";
//
// lblComments
//
this.lblComments.AutoSize = true;
this.lblComments.Location = new System.Drawing.Point(43, 57);
this.lblComments.Name = "lblComments";
this.lblComments.Size = new System.Drawing.Size(56, 13);
this.lblComments.TabIndex = 2;
this.lblComments.Text = "Comments";
//
// panelComment
//
this.panelComment.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelComment.Location = new System.Drawing.Point(105, 50);
this.panelComment.Name = "panelComment";
this.panelComment.Size = new System.Drawing.Size(20, 20);
this.panelComment.TabIndex = 3;
//
// panelString
//
this.panelString.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelString.Location = new System.Drawing.Point(105, 90);
this.panelString.Name = "panelString";
this.panelString.Size = new System.Drawing.Size(20, 20);
this.panelString.TabIndex = 5;
//
// lblStrings
//
this.lblStrings.AutoSize = true;
this.lblStrings.Location = new System.Drawing.Point(60, 97);
this.lblStrings.Name = "lblStrings";
this.lblStrings.Size = new System.Drawing.Size(39, 13);
this.lblStrings.TabIndex = 4;
this.lblStrings.Text = "Strings";
//
// panelSymbol
//
this.panelSymbol.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelSymbol.Location = new System.Drawing.Point(105, 130);
this.panelSymbol.Name = "panelSymbol";
this.panelSymbol.Size = new System.Drawing.Size(20, 20);
this.panelSymbol.TabIndex = 7;
//
// lblSymbols
//
this.lblSymbols.AutoSize = true;
this.lblSymbols.Location = new System.Drawing.Point(53, 137);
this.lblSymbols.Name = "lblSymbols";
this.lblSymbols.Size = new System.Drawing.Size(46, 13);
this.lblSymbols.TabIndex = 6;
this.lblSymbols.Text = "Symbols";
//
// panelLibrary
//
this.panelLibrary.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panelLibrary.Location = new System.Drawing.Point(105, 170);
this.panelLibrary.Name = "panelLibrary";
this.panelLibrary.Size = new System.Drawing.Size(20, 20);
this.panelLibrary.TabIndex = 9;
//
// lblLibraries
//
this.lblLibraries.AutoSize = true;
this.lblLibraries.Location = new System.Drawing.Point(53, 177);
this.lblLibraries.Name = "lblLibraries";
this.lblLibraries.Size = new System.Drawing.Size(46, 13);
this.lblLibraries.TabIndex = 8;
this.lblLibraries.Text = "Libraries";
//
// LuaWriterColorConfig
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(284, 262);
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.ResumeLayout(false);
this.PerformLayout();
}
@ -72,5 +184,20 @@
private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Panel panelKeyWord;
private System.Windows.Forms.Label lblKeyWords;
private System.Windows.Forms.Label lblComments;
private System.Windows.Forms.Panel panelComment;
private System.Windows.Forms.Panel panelString;
private System.Windows.Forms.Label lblStrings;
private System.Windows.Forms.Panel panelSymbol;
private System.Windows.Forms.Label lblSymbols;
private System.Windows.Forms.Panel panelLibrary;
private System.Windows.Forms.Label lblLibraries;
private System.Windows.Forms.ColorDialog KeyWordColorDialog;
private System.Windows.Forms.ColorDialog CommentColorDialog;
private System.Windows.Forms.ColorDialog StringColorDialog;
private System.Windows.Forms.ColorDialog SymbolColorDialog;
private System.Windows.Forms.ColorDialog LibraryColorDialog;
}
}

View File

@ -11,9 +11,72 @@ namespace BizHawk.MultiClient.tools
{
public partial class LuaWriterColorConfig : Form
{
//Get existing global Lua color settings
int KeyWordColor = Global.Config.LuaKeyWordColor;
int CommentColor = Global.Config.LuaCommentColor;
int StringColor = Global.Config.LuaStringColor;
int SymbolColor = Global.Config.LuaSymbolColor;
int LibraryColor = Global.Config.LuaLibraryColor;
public LuaWriterColorConfig()
{
InitializeComponent();
}
}
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);
}
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
}
}
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
}
}
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
}
}
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
}
}
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
}
}
}
}

View File

@ -117,4 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="KeyWordColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="CommentColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>183, 17</value>
</metadata>
<metadata name="StringColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 20</value>
</metadata>
<metadata name="SymbolColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>502, 19</value>
</metadata>
<metadata name="LibraryColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>652, 18</value>
</metadata>
</root>