Commit 9fca0404 authored by keyongyu's avatar keyongyu

2.2.1.1

parent f8e3ed02
...@@ -41,16 +41,18 @@ private void InitializeComponent() ...@@ -41,16 +41,18 @@ private void InitializeComponent()
this.menuitem_open = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_open = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_save = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_save = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_saveas = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_saveas = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_quit = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_quit = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_setting = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_setting = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_showmap = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_showmap = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_showinput = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_showinput = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_find = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_replace = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_help = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_help = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_about = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_about = new System.Windows.Forms.ToolStripMenuItem();
this.fctb = new FastColoredTextBoxNS.FastColoredTextBox(); this.fctb = new FastColoredTextBoxNS.FastColoredTextBox();
this.documentMap1 = new FastColoredTextBoxNS.DocumentMap(); this.documentMap1 = new FastColoredTextBoxNS.DocumentMap();
this.tb_input = new System.Windows.Forms.TextBox(); this.tb_input = new System.Windows.Forms.TextBox();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.fctb)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fctb)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
...@@ -102,6 +104,11 @@ private void InitializeComponent() ...@@ -102,6 +104,11 @@ private void InitializeComponent()
this.menuitem_saveas.Text = "Save As"; this.menuitem_saveas.Text = "Save As";
this.menuitem_saveas.Click += new System.EventHandler(this.SaveAsToolStripMenuItemClick); this.menuitem_saveas.Click += new System.EventHandler(this.SaveAsToolStripMenuItemClick);
// //
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(152, 6);
//
// menuitem_quit // menuitem_quit
// //
this.menuitem_quit.Name = "menuitem_quit"; this.menuitem_quit.Name = "menuitem_quit";
...@@ -113,10 +120,12 @@ private void InitializeComponent() ...@@ -113,10 +120,12 @@ private void InitializeComponent()
// //
this.menuitem_setting.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuitem_setting.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_showmap, this.menuitem_showmap,
this.menuitem_showinput}); this.menuitem_showinput,
this.menuitem_find,
this.menuitem_replace});
this.menuitem_setting.Name = "menuitem_setting"; this.menuitem_setting.Name = "menuitem_setting";
this.menuitem_setting.Size = new System.Drawing.Size(75, 21); this.menuitem_setting.Size = new System.Drawing.Size(67, 21);
this.menuitem_setting.Text = "Setting(&S)"; this.menuitem_setting.Text = "Tools(&S)";
// //
// menuitem_showmap // menuitem_showmap
// //
...@@ -132,6 +141,20 @@ private void InitializeComponent() ...@@ -132,6 +141,20 @@ private void InitializeComponent()
this.menuitem_showinput.Text = "Show InputBox"; this.menuitem_showinput.Text = "Show InputBox";
this.menuitem_showinput.Click += new System.EventHandler(this.Menuitem_showinputClick); this.menuitem_showinput.Click += new System.EventHandler(this.Menuitem_showinputClick);
// //
// menuitem_find
//
this.menuitem_find.Name = "menuitem_find";
this.menuitem_find.Size = new System.Drawing.Size(163, 22);
this.menuitem_find.Text = "Find";
this.menuitem_find.Click += new System.EventHandler(this.Menuitem_findClick);
//
// menuitem_replace
//
this.menuitem_replace.Name = "menuitem_replace";
this.menuitem_replace.Size = new System.Drawing.Size(163, 22);
this.menuitem_replace.Text = "Replace";
this.menuitem_replace.Click += new System.EventHandler(this.Menuitem_replaceClick);
//
// menuitem_help // menuitem_help
// //
this.menuitem_help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuitem_help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
...@@ -164,6 +187,7 @@ private void InitializeComponent() ...@@ -164,6 +187,7 @@ private void InitializeComponent()
this.fctb.AutoIndentCharsPatterns = "\n^\\s*[\\w\\.]+(\\s\\w+)?\\s*(?<range>=)\\s*(?<range>.+)\n"; this.fctb.AutoIndentCharsPatterns = "\n^\\s*[\\w\\.]+(\\s\\w+)?\\s*(?<range>=)\\s*(?<range>.+)\n";
this.fctb.AutoScrollMinSize = new System.Drawing.Size(0, 22); this.fctb.AutoScrollMinSize = new System.Drawing.Size(0, 22);
this.fctb.BackBrush = null; this.fctb.BackBrush = null;
this.fctb.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.fctb.BracketsHighlightStrategy = FastColoredTextBoxNS.BracketsHighlightStrategy.Strategy2; this.fctb.BracketsHighlightStrategy = FastColoredTextBoxNS.BracketsHighlightStrategy.Strategy2;
this.fctb.CharHeight = 22; this.fctb.CharHeight = 22;
this.fctb.CharWidth = 10; this.fctb.CharWidth = 10;
...@@ -172,10 +196,12 @@ private void InitializeComponent() ...@@ -172,10 +196,12 @@ private void InitializeComponent()
this.fctb.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); this.fctb.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
this.fctb.Dock = System.Windows.Forms.DockStyle.Fill; this.fctb.Dock = System.Windows.Forms.DockStyle.Fill;
this.fctb.Font = new System.Drawing.Font("Consolas", 14.25F); this.fctb.Font = new System.Drawing.Font("Consolas", 14.25F);
this.fctb.ForeColor = System.Drawing.Color.GhostWhite;
this.fctb.IndentBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.fctb.IsReplaceMode = false; this.fctb.IsReplaceMode = false;
this.fctb.Language = FastColoredTextBoxNS.Language.Lua;
this.fctb.LeftBracket = '('; this.fctb.LeftBracket = '(';
this.fctb.LeftBracket2 = '{'; this.fctb.LeftBracket2 = '{';
this.fctb.LineNumberColor = System.Drawing.SystemColors.Control;
this.fctb.Location = new System.Drawing.Point(0, 25); this.fctb.Location = new System.Drawing.Point(0, 25);
this.fctb.Name = "fctb"; this.fctb.Name = "fctb";
this.fctb.Paddings = new System.Windows.Forms.Padding(0); this.fctb.Paddings = new System.Windows.Forms.Padding(0);
...@@ -187,6 +213,7 @@ private void InitializeComponent() ...@@ -187,6 +213,7 @@ private void InitializeComponent()
this.fctb.WordWrap = true; this.fctb.WordWrap = true;
this.fctb.Zoom = 100; this.fctb.Zoom = 100;
this.fctb.ToolTipNeeded += new System.EventHandler<FastColoredTextBoxNS.ToolTipNeededEventArgs>(this.FctbToolTipNeeded); this.fctb.ToolTipNeeded += new System.EventHandler<FastColoredTextBoxNS.ToolTipNeededEventArgs>(this.FctbToolTipNeeded);
this.fctb.TextChanged += new System.EventHandler<FastColoredTextBoxNS.TextChangedEventArgs>(this.FctbTextChanged);
this.fctb.SelectionChanged += new System.EventHandler(this.FctbSelectionChanged); this.fctb.SelectionChanged += new System.EventHandler(this.FctbSelectionChanged);
this.fctb.TextChangedDelayed += new System.EventHandler<FastColoredTextBoxNS.TextChangedEventArgs>(this.FctbTextChangedDelayed); this.fctb.TextChangedDelayed += new System.EventHandler<FastColoredTextBoxNS.TextChangedEventArgs>(this.FctbTextChangedDelayed);
this.fctb.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FctbKeyDown); this.fctb.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FctbKeyDown);
...@@ -212,11 +239,6 @@ private void InitializeComponent() ...@@ -212,11 +239,6 @@ private void InitializeComponent()
this.tb_input.TabIndex = 1; this.tb_input.TabIndex = 1;
this.tb_input.Visible = false; this.tb_input.Visible = false;
// //
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(152, 6);
//
// CodeEditForm // CodeEditForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -238,6 +260,8 @@ private void InitializeComponent() ...@@ -238,6 +260,8 @@ private void InitializeComponent()
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.ToolStripMenuItem menuitem_replace;
private System.Windows.Forms.ToolStripMenuItem menuitem_find;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem menuitem_showinput; private System.Windows.Forms.ToolStripMenuItem menuitem_showinput;
private System.Windows.Forms.TextBox tb_input; private System.Windows.Forms.TextBox tb_input;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
using WeifenLuo.WinFormsUI.Docking; using WeifenLuo.WinFormsUI.Docking;
using FastColoredTextBoxNS; using FastColoredTextBoxNS;
using DataEditorX.Language; using DataEditorX.Language;
using System.Text.RegularExpressions;
namespace DataEditorX namespace DataEditorX
{ {
...@@ -22,6 +23,14 @@ namespace DataEditorX ...@@ -22,6 +23,14 @@ namespace DataEditorX
/// </summary> /// </summary>
public partial class CodeEditForm : DockContent public partial class CodeEditForm : DockContent
{ {
TextStyle KeyStyle = new TextStyle(Brushes.DeepSkyBlue, null, FontStyle.Regular);
TextStyle BoldStyle = new TextStyle(null, null, FontStyle.Bold|FontStyle.Italic);
TextStyle GrayStyle = new TextStyle(Brushes.Gray, null, FontStyle.Regular);
TextStyle NumberStyle = new TextStyle(Brushes.Orange, null, FontStyle.Regular);
TextStyle ConStyle = new TextStyle(Brushes.YellowGreen, null, FontStyle.Regular);
TextStyle YellowStyle = new TextStyle(Brushes.Yellow, null, FontStyle.Italic);
TextStyle FunStyle = new TextStyle(Brushes.SlateGray, null, FontStyle.Bold);
MarkerStyle SameWordsStyle = new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.White)));
#region init #region init
AutocompleteMenu popupMenu; AutocompleteMenu popupMenu;
AutocompleteMenu popupMenu_fun; AutocompleteMenu popupMenu_fun;
...@@ -232,6 +241,19 @@ void FctbKeyDown(object sender, KeyEventArgs e) ...@@ -232,6 +241,19 @@ void FctbKeyDown(object sender, KeyEventArgs e)
void FctbSelectionChanged(object sender, EventArgs e) void FctbSelectionChanged(object sender, EventArgs e)
{ {
tb_input.Text=fctb.SelectedText; tb_input.Text=fctb.SelectedText;
fctb.VisibleRange.ClearStyle(SameWordsStyle);
if (!fctb.Selection.IsEmpty)
return;//user selected diapason
//get fragment around caret
var fragment = fctb.Selection.GetFragment(@"\w");
string text = fragment.Text;
if (text.Length == 0)
return;
//highlight same words
var ranges = fctb.VisibleRange.GetRanges("\\b" + text + "\\b");
foreach(var r in ranges)
r.SetStyle(SameWordsStyle);
} }
void Menuitem_showinputClick(object sender, EventArgs e) void Menuitem_showinputClick(object sender, EventArgs e)
...@@ -317,7 +339,58 @@ void Menuitem_openClick(object sender, EventArgs e) ...@@ -317,7 +339,58 @@ void Menuitem_openClick(object sender, EventArgs e)
} }
} }
} }
#endregion #endregion
void FctbTextChanged(object sender, TextChangedEventArgs e)
{
LuaSyntaxHighlight(e);
}
private void LuaSyntaxHighlight(TextChangedEventArgs e)
{
//fctb.LeftBracket = '(';
//fctb.RightBracket = ')';
//fctb.LeftBracket2 = '\x0';
//fctb.RightBracket2 = '\x0';
//clear style of changed range
e.ChangedRange.ClearStyle(YellowStyle, BoldStyle, GrayStyle, NumberStyle, FunStyle, ConStyle);
//string highlighting
e.ChangedRange.SetStyle(YellowStyle, @"""""|@""""|''|@"".*?""|(?<!@)(?<range>"".*?[^\\]"")|'.*?[^\\]'");
//comment highlighting
e.ChangedRange.SetStyle(GrayStyle, @"--.*$", RegexOptions.Multiline);
e.ChangedRange.SetStyle(GrayStyle, @"--\[\[[\S\s]*?|--\[\[[\S\s]*?\]\]--|[\S\s]*?\]\]--", RegexOptions.Multiline);
e.ChangedRange.SetStyle(GrayStyle, @"--\[\[[\S\s]*?|--\[\[[\S\s]*?\]\]--|[\S\s]*?\]\]--", RegexOptions.Multiline|RegexOptions.RightToLeft);
//number highlighting
e.ChangedRange.SetStyle(NumberStyle, @"\b\d+[\.]?\d*([eE]\-?\d+)?[lLdDfF]?\b|\b0x[a-fA-F\d]+\b|\bc[0-9]+\b");
//attribute highlighting
//e.ChangedRange.SetStyle(GrayStyle, @"^\s*(?<range>\[.+?\])\s*$", RegexOptions.Multiline);
//class name highlighting
e.ChangedRange.SetStyle(BoldStyle, @"\b(Effect|Card|Group|Duel|Debug)\b");
//keyword highlighting
e.ChangedRange.SetStyle(KeyStyle, @"\b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b");
//constant
e.ChangedRange.SetStyle(ConStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,]");
//function
//e.ChangedRange.SetStyle(FunStyle, @"[:|.|\s](?<range>[^\(]*?)[\(|\)|\s]");
//clear folding markers
e.ChangedRange.ClearFoldingMarkers();
//set folding markers
//e.ChangedRange.SetFoldingMarkers(@"--\[\[[\S\s]*?\]\]--", RegexOptions.Multiline);//allow to collapse comment block
e.ChangedRange.SetFoldingMarkers("if\b", "end\b");//allow to collapse brackets block
e.ChangedRange.SetFoldingMarkers("function\b", "end\b");//allow to collapse #region blocks
}
void Menuitem_findClick(object sender, EventArgs e)
{
fctb.ShowFindDialog();
}
void Menuitem_replaceClick(object sender, EventArgs e)
{
fctb.ShowReplaceDialog();
}
} }
} }
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
// //
// You can specify all the values or you can use the default the Revision and // You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below: // Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("2.2.1.1")] [assembly: AssemblyVersion("2.2.1.2")]
[DataEditorX]2.2.1.1[DataEditorX] [DataEditorX]2.2.1.2[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -34,6 +34,8 @@ mse-pendulum P怪兽模版 ...@@ -34,6 +34,8 @@ mse-pendulum P怪兽模版
mse-spelltrap 魔陷模版 mse-spelltrap 魔陷模版
mse-config 设置pendulum文本和普通文本的正则正则表达式,用来分离文本 mse-config 设置pendulum文本和普通文本的正则正则表达式,用来分离文本
★支持关联lua文件
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
关联cdb文件: 关联cdb文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。 请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
...@@ -66,6 +68,8 @@ DataEditorX.exe.config ...@@ -66,6 +68,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
2.2.1.2
lua编辑器的风格
2.2.1.1 2.2.1.1
修复文件关联打开文件,无法记录打开历史 修复文件关联打开文件,无法记录打开历史
修复新建lua,没有覆盖旧文件 修复新建lua,没有覆盖旧文件
......
No preview for this file type
# history # history
F:\games\ygocore\cards (2).cdb F:\games\ygocore\cards (2).cdb
F:\games\ygopro\cards.cdb
F:\games\ygocore\script\c126218.lua F:\games\ygocore\script\c126218.lua
F:\games\ygopro\script\c168917.lua
F:\games\ygocore\script\c131182.lua F:\games\ygocore\script\c131182.lua
F:\games\ygopro\cards.cdb F:\games\ygopro\script\c126218.lua
\ No newline at end of file \ No newline at end of file
[DataEditorX]2.2.1.1[DataEditorX] [DataEditorX]2.2.1.2[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -34,6 +34,8 @@ mse-pendulum P怪兽模版 ...@@ -34,6 +34,8 @@ mse-pendulum P怪兽模版
mse-spelltrap 魔陷模版 mse-spelltrap 魔陷模版
mse-config 设置pendulum文本和普通文本的正则正则表达式,用来分离文本 mse-config 设置pendulum文本和普通文本的正则正则表达式,用来分离文本
★支持关联lua文件
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
关联cdb文件: 关联cdb文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。 请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
...@@ -66,6 +68,8 @@ DataEditorX.exe.config ...@@ -66,6 +68,8 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
2.2.1.2
lua编辑器的风格
2.2.1.1 2.2.1.1
修复文件关联打开文件,无法记录打开历史 修复文件关联打开文件,无法记录打开历史
修复新建lua,没有覆盖旧文件 修复新建lua,没有覆盖旧文件
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment