From 754422b0e4a7e0e1a9182612d160c8a986f4a746 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 2 Aug 2012 17:48:17 +0000 Subject: [PATCH] Lua Writer - bold for syntax highlighting option --- BizHawk.MultiClient/Config.cs | 9 +- BizHawk.MultiClient/tools/LuaWriter.cs | 88 ++-- .../tools/LuaWriterColorConfig.Designer.cs | 448 ++++++++++-------- .../tools/LuaWriterColorConfig.cs | 21 +- 4 files changed, 330 insertions(+), 236 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index b6956fbbe4..8e1556414e 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -552,12 +552,17 @@ namespace BizHawk.MultiClient //LuaWriter Settings public int LuaDefaultTextColor = -16777216; + public int LuaKeyWordColor = -16776961; + public bool LuaKeyWordBold = false; public int LuaCommentColor = -16744448; + public bool LuaCommentBold = false; public int LuaStringColor = -8355712; + public bool LuaStringBold = false; public int LuaSymbolColor = -16777216; - //public int LuaLibraryColor = -6427649; - public int LuaLibraryColor = -16711681; + public bool LuaSymbolBold = false; + public int LuaLibraryColor = -16711681; + public bool LuaLibraryBold = false; public float LuaWriterFontSize = 11; public string LuaWriterFont = "Courier New"; public float LuaWriterZoom = 1; diff --git a/BizHawk.MultiClient/tools/LuaWriter.cs b/BizHawk.MultiClient/tools/LuaWriter.cs index 9ec6f6dc70..81aae064b3 100644 --- a/BizHawk.MultiClient/tools/LuaWriter.cs +++ b/BizHawk.MultiClient/tools/LuaWriter.cs @@ -40,7 +40,6 @@ namespace BizHawk.MultiClient public Regex keyWords = new Regex("and|break|do|else|if|end|false|for|function|in|local|nil|not|or|repeat|return|then|true|until|while|elseif"); char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' }; public Regex libraryWords; - public Regex LuaLibraryWords = new Regex("coroutine|package|debug|file|io|math|os|package|string|table"); public LuaWriter() { @@ -81,42 +80,16 @@ namespace BizHawk.MultiClient LuaText.SelectAll(); LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaDefaultTextColor); + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Regular); ColorReservedWords(); ColorLibraries(); - ColorLuaLibraries(); ColorComments(); ColorStrings(); ColorSymbols(); LuaText.Select(selPos, selChars); } - private void ColorLuaLibraries() - { - foreach (Match libraryWordMatch in LuaLibraryWords.Matches(LuaText.Text)) - { - if (libraryWordMatch.Index >= 0) - { - char before = ' ', after = ' '; - - if (libraryWordMatch.Index > 0) - before = LuaText.Text[libraryWordMatch.Index - 1]; - - if (libraryWordMatch.Index + libraryWordMatch.Length != LuaText.Text.Length) - after = LuaText.Text[libraryWordMatch.Index + libraryWordMatch.Length]; - - if (!char.IsLetterOrDigit(before)) - { - if (after == '.') - { - LuaText.Select(libraryWordMatch.Index, libraryWordMatch.Length); - LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor); - } - } - } - } - } - private void ColorSymbols() { foreach (char mark in Symbols) @@ -126,6 +99,8 @@ namespace BizHawk.MultiClient { if (LuaText.SelectionColor.ToArgb() != Global.Config.LuaCommentColor && LuaText.SelectionColor.ToArgb() != Global.Config.LuaStringColor) LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaSymbolColor); + if (Global.Config.LuaSymbolBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); currPos = LuaText.SelectionStart + 1; if (currPos == LuaText.Text.Length) @@ -184,6 +159,8 @@ namespace BizHawk.MultiClient { LuaText.Select(opening, ending - opening + 1); LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaStringColor); + if (Global.Config.LuaStringBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); if (ending >= LuaText.Text.Length) ending++; else @@ -229,6 +206,8 @@ namespace BizHawk.MultiClient LuaText.Select(CommentMatch.Index, endComment); LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaCommentColor); + if (Global.Config.LuaCommentBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); } else { @@ -239,6 +218,8 @@ namespace BizHawk.MultiClient LuaText.Select(CommentMatch.Index, endComment); LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaCommentColor); + if (Global.Config.LuaCommentBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); } } } @@ -261,6 +242,8 @@ namespace BizHawk.MultiClient { LuaText.Select(keyWordMatch.Index, keyWordMatch.Length); LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaKeyWordColor); + if (Global.Config.LuaKeyWordBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); } } } @@ -284,7 +267,9 @@ namespace BizHawk.MultiClient if (after == '.') { LuaText.Select(libraryWordMatch.Index, libraryWordMatch.Length); - LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor); + LuaText.SelectionColor = Color.FromArgb(Global.Config.LuaLibraryColor); + if (Global.Config.LuaLibraryBold) + LuaText.SelectionFont = new Font(LuaText.SelectionFont, FontStyle.Bold); } } } @@ -304,6 +289,7 @@ namespace BizHawk.MultiClient } } + list.Append("|coroutine|package|debug|file|io|math|os|package|string|table"); libraryWords = new Regex(list.ToString()); } @@ -510,35 +496,34 @@ namespace BizHawk.MultiClient if (IsLibraryWord(currentword)) { List libfunctions = Global.MainForm.LuaConsole1.LuaImp.docs.GetFunctionsByLibrary(currentword); + + /* This part doesn't work yet. + int x = 0; + int y = 0; - /* This part doesn't work yet. - int x = 0; - int y = 0; + int currentRow; + int currentColumn; + int fontHeight; + int topRow; - int currentRow; - int currentColumn; - int fontHeight; - int topRow; + currentRow = LuaText.GetLineFromCharIndex(LuaText.SelectionStart); //Currently selected row + currentColumn = LuaText.SelectionStart - LuaText.GetFirstCharIndexFromLine(currentRow); + fontHeight = (int)LuaText.Font.GetHeight(); //Explicilty cast to int (may be a problem later) - currentRow = LuaText.GetLineFromCharIndex(LuaText.SelectionStart); //Currently selected row - currentColumn = LuaText.SelectionStart - LuaText.GetFirstCharIndexFromLine(currentRow); - fontHeight = (int)LuaText.Font.GetHeight(); //Explicilty cast to int (may be a problem later) + x = ((currentRow + 1) * fontHeight) + LuaText.Location.Y; + y = 50; - x = ((currentRow + 1) * fontHeight) + LuaText.Location.Y; - y = 50; - - AutoCompleteView.Location = new Point(y, x); - */ - - AutoCompleteView.Location = new Point(0, 0); - AutoCompleteView.Visible = true; + AutoCompleteView.Location = new Point(y, x); + */ + + AutoCompleteView.Location = new Point(0, 0); + AutoCompleteView.Visible = true; AutoCompleteView.Items.Clear(); foreach(string function in libfunctions) { ListViewItem item = new ListViewItem(function); AutoCompleteView.Items.Add(item); } - } } @@ -652,6 +637,13 @@ namespace BizHawk.MultiClient Global.Config.LuaStringColor = -8355712; Global.Config.LuaSymbolColor = -16777216; Global.Config.LuaLibraryColor = -16711681; + + Global.Config.LuaKeyWordBold = false; + Global.Config.LuaCommentBold = false; + Global.Config.LuaStringBold = false; + Global.Config.LuaSymbolBold = false; + Global.Config.LuaLibraryBold = false; + ProcessText(); Global.Config.LuaWriterFontSize = 11; diff --git a/BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs b/BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs index 6b78f795be..696d5e3db2 100644 --- a/BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs @@ -28,191 +28,263 @@ /// private void InitializeComponent() { - 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.buttonDefaults = 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 = 10; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.OK_Click); - // - // 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; - this.panelKeyWord.DoubleClick += new System.EventHandler(this.panelKeyWord_DoubleClick); - // - // 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; - this.panelComment.DoubleClick += new System.EventHandler(this.panelComment_DoubleClick); - // - // 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; - this.panelString.DoubleClick += new System.EventHandler(this.panelString_DoubleClick); - // - // 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; - this.panelSymbol.DoubleClick += new System.EventHandler(this.panelSymbol_DoubleClick); - // - // 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; - this.panelLibrary.DoubleClick += new System.EventHandler(this.panelLibrary_DoubleClick); - // - // 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"; - // - // KeyWordColorDialog - // - this.KeyWordColorDialog.Color = System.Drawing.Color.Blue; - // - // CommentColorDialog - // - this.CommentColorDialog.Color = System.Drawing.Color.Green; - // - // StringColorDialog - // - this.StringColorDialog.Color = System.Drawing.Color.Gray; - // - // LibraryColorDialog - // - this.LibraryColorDialog.Color = System.Drawing.Color.Cyan; - // - // 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; - 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.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(); + 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.buttonDefaults = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.BoldKeyWords = new System.Windows.Forms.CheckBox(); + this.BoldComments = new System.Windows.Forms.CheckBox(); + this.BoldStrings = new System.Windows.Forms.CheckBox(); + this.BoldSymbols = new System.Windows.Forms.CheckBox(); + this.BoldLibraries = new System.Windows.Forms.CheckBox(); + this.groupBox1.SuspendLayout(); + 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; + this.OK.Click += new System.EventHandler(this.OK_Click); + // + // 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(77, 12); + 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 + // + this.lblKeyWords.AutoSize = true; + this.lblKeyWords.Location = new System.Drawing.Point(12, 19); + 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(15, 59); + 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(77, 52); + 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 + // + this.panelString.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panelString.Location = new System.Drawing.Point(77, 92); + 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 + // + this.lblStrings.AutoSize = true; + this.lblStrings.Location = new System.Drawing.Point(32, 99); + 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(77, 132); + 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 + // + this.lblSymbols.AutoSize = true; + this.lblSymbols.Location = new System.Drawing.Point(25, 139); + 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(77, 172); + 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 + // + this.lblLibraries.AutoSize = true; + this.lblLibraries.Location = new System.Drawing.Point(25, 179); + this.lblLibraries.Name = "lblLibraries"; + this.lblLibraries.Size = new System.Drawing.Size(46, 13); + this.lblLibraries.TabIndex = 8; + this.lblLibraries.Text = "Libraries"; + // + // KeyWordColorDialog + // + this.KeyWordColorDialog.Color = System.Drawing.Color.Blue; + // + // CommentColorDialog + // + this.CommentColorDialog.Color = System.Drawing.Color.Green; + // + // StringColorDialog + // + this.StringColorDialog.Color = System.Drawing.Color.Gray; + // + // LibraryColorDialog + // + this.LibraryColorDialog.Color = System.Drawing.Color.Cyan; + // + // 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); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.BoldLibraries); + this.groupBox1.Controls.Add(this.BoldSymbols); + this.groupBox1.Controls.Add(this.BoldStrings); + this.groupBox1.Controls.Add(this.BoldComments); + this.groupBox1.Controls.Add(this.BoldKeyWords); + this.groupBox1.Controls.Add(this.panelKeyWord); + this.groupBox1.Controls.Add(this.lblKeyWords); + this.groupBox1.Controls.Add(this.panelLibrary); + this.groupBox1.Controls.Add(this.lblComments); + this.groupBox1.Controls.Add(this.lblLibraries); + this.groupBox1.Controls.Add(this.panelComment); + this.groupBox1.Controls.Add(this.panelSymbol); + this.groupBox1.Controls.Add(this.lblStrings); + this.groupBox1.Controls.Add(this.lblSymbols); + this.groupBox1.Controls.Add(this.panelString); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(260, 202); + this.groupBox1.TabIndex = 13; + this.groupBox1.TabStop = false; + // + // BoldKeyWords + // + this.BoldKeyWords.AutoSize = true; + this.BoldKeyWords.Location = new System.Drawing.Point(132, 15); + this.BoldKeyWords.Name = "BoldKeyWords"; + this.BoldKeyWords.Size = new System.Drawing.Size(47, 17); + this.BoldKeyWords.TabIndex = 10; + this.BoldKeyWords.Text = "Bold"; + this.BoldKeyWords.UseVisualStyleBackColor = true; + // + // BoldComments + // + this.BoldComments.AutoSize = true; + this.BoldComments.Location = new System.Drawing.Point(132, 55); + this.BoldComments.Name = "BoldComments"; + this.BoldComments.Size = new System.Drawing.Size(47, 17); + this.BoldComments.TabIndex = 11; + this.BoldComments.Text = "Bold"; + this.BoldComments.UseVisualStyleBackColor = true; + // + // BoldStrings + // + this.BoldStrings.AutoSize = true; + this.BoldStrings.Location = new System.Drawing.Point(132, 95); + this.BoldStrings.Name = "BoldStrings"; + this.BoldStrings.Size = new System.Drawing.Size(47, 17); + this.BoldStrings.TabIndex = 12; + this.BoldStrings.Text = "Bold"; + this.BoldStrings.UseVisualStyleBackColor = true; + // + // BoldSymbols + // + this.BoldSymbols.AutoSize = true; + this.BoldSymbols.Location = new System.Drawing.Point(132, 135); + this.BoldSymbols.Name = "BoldSymbols"; + this.BoldSymbols.Size = new System.Drawing.Size(47, 17); + this.BoldSymbols.TabIndex = 13; + this.BoldSymbols.Text = "Bold"; + this.BoldSymbols.UseVisualStyleBackColor = true; + // + // BoldLibraries + // + this.BoldLibraries.AutoSize = true; + this.BoldLibraries.Location = new System.Drawing.Point(132, 175); + this.BoldLibraries.Name = "BoldLibraries"; + this.BoldLibraries.Size = new System.Drawing.Size(47, 17); + this.BoldLibraries.TabIndex = 14; + this.BoldLibraries.Text = "Bold"; + this.BoldLibraries.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.groupBox1); + this.Controls.Add(this.buttonDefaults); + 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.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); } @@ -236,5 +308,11 @@ private System.Windows.Forms.ColorDialog SymbolColorDialog; private System.Windows.Forms.ColorDialog LibraryColorDialog; private System.Windows.Forms.Button buttonDefaults; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox BoldLibraries; + private System.Windows.Forms.CheckBox BoldSymbols; + private System.Windows.Forms.CheckBox BoldStrings; + private System.Windows.Forms.CheckBox BoldComments; + private System.Windows.Forms.CheckBox BoldKeyWords; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/LuaWriterColorConfig.cs b/BizHawk.MultiClient/tools/LuaWriterColorConfig.cs index d8d081bbb8..2736103bda 100644 --- a/BizHawk.MultiClient/tools/LuaWriterColorConfig.cs +++ b/BizHawk.MultiClient/tools/LuaWriterColorConfig.cs @@ -31,6 +31,12 @@ namespace BizHawk.MultiClient.tools SetStringColor(StringColor); SetSymbolColor(SymbolColor); SetLibraryColor(LibraryColor); + + BoldKeyWords.Checked = Global.Config.LuaKeyWordBold; + BoldComments.Checked = Global.Config.LuaCommentBold; + BoldStrings.Checked = Global.Config.LuaStringBold; + BoldSymbols.Checked = Global.Config.LuaSymbolBold; + BoldLibraries.Checked = Global.Config.LuaLibraryBold; } private void SetKeyWordColor(int color) @@ -61,7 +67,6 @@ namespace BizHawk.MultiClient.tools { LibraryColor = color; //Set new color panelLibrary.BackColor = Color.FromArgb(color); //Update panel color with new selection - //MessageBox.Show(color.ToString()); } //Pop up color dialog when double-clicked @@ -119,11 +124,19 @@ namespace BizHawk.MultiClient.tools private void SaveData() { + //Colors Global.Config.LuaKeyWordColor = KeyWordColor; Global.Config.LuaCommentColor = CommentColor; Global.Config.LuaStringColor = StringColor; Global.Config.LuaSymbolColor = SymbolColor; Global.Config.LuaLibraryColor = LibraryColor; + + //Bold + Global.Config.LuaKeyWordBold = BoldKeyWords.Checked; + Global.Config.LuaCommentBold = BoldComments.Checked; + Global.Config.LuaStringBold = BoldStrings.Checked; + Global.Config.LuaSymbolBold = BoldSymbols.Checked; + Global.Config.LuaLibraryBold = BoldLibraries.Checked; } private void buttonDefaults_Click(object sender, EventArgs e) @@ -133,6 +146,12 @@ namespace BizHawk.MultiClient.tools SetStringColor(-8355712); SetSymbolColor(-16777216); SetLibraryColor(-16711681); + + BoldKeyWords.Checked = false; + BoldComments.Checked = false; + BoldStrings.Checked = false; + BoldSymbols.Checked = false; + BoldLibraries.Checked = false; } } }