diff --git a/Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs b/Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs index cffe1df..670f187 100644 --- a/Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs +++ b/Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs @@ -122,7 +122,7 @@ private void InitializeComponent() { this.chkExcludeComments = new System.Windows.Forms.CheckBox(); this.lblTraceComment = new System.Windows.Forms.Label(); this.pageOutput = new System.Windows.Forms.TabPage(); - this.txtOutput = new System.Windows.Forms.TextBox(); + this.txtOutput = new WinForms.ConsoleTextBox(); this.pnlRuntimeInfo = new System.Windows.Forms.Panel(); this.label14 = new System.Windows.Forms.Label(); this.lblGCCount = new System.Windows.Forms.Label(); @@ -1146,12 +1146,8 @@ private void InitializeComponent() { // txtOutput // this.txtOutput.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtOutput.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtOutput.Location = new System.Drawing.Point(3, 3); - this.txtOutput.Multiline = true; this.txtOutput.Name = "txtOutput"; - this.txtOutput.ReadOnly = true; - this.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtOutput.Size = new System.Drawing.Size(857, 155); this.txtOutput.TabIndex = 1; // @@ -1329,7 +1325,7 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem miRemoveAll; private System.Windows.Forms.TabControl tabBottom; private System.Windows.Forms.TabPage pageOutput; - private System.Windows.Forms.TextBox txtOutput; + private Irony.WinForms.ConsoleTextBox txtOutput; private System.Windows.Forms.TabPage pageLanguage; private System.Windows.Forms.Splitter splitBottom; private System.Windows.Forms.GroupBox grpLanguageInfo; diff --git a/Irony.GrammarExplorer/fmGrammarExplorer.cs b/Irony.GrammarExplorer/fmGrammarExplorer.cs index 1df69b1..21df429 100644 --- a/Irony.GrammarExplorer/fmGrammarExplorer.cs +++ b/Irony.GrammarExplorer/fmGrammarExplorer.cs @@ -355,7 +355,7 @@ private void RunSample() { ClearRuntimeInfo(); Stopwatch sw = new Stopwatch(); int oldGcCount; - txtOutput.Text = ""; + txtOutput.Text = string.Empty; try { if (_parseTree == null) ParseSample(); @@ -367,7 +367,7 @@ private void RunSample() { sw.Start(); var iRunner = _grammar as ICanRunSample; - var args = new RunSampleArgs(_language, txtSource.Text, _parseTree); + var args = new RunSampleArgs(_language, txtSource.Text, _parseTree, txtOutput); string output = iRunner.RunSample(args); sw.Stop(); lblRunTime.Text = sw.ElapsedMilliseconds.ToString(); diff --git a/Irony.WinForms/ConsoleTextBox.cs b/Irony.WinForms/ConsoleTextBox.cs index 87f6018..dccea6e 100644 --- a/Irony.WinForms/ConsoleTextBox.cs +++ b/Irony.WinForms/ConsoleTextBox.cs @@ -36,7 +36,6 @@ public ConsoleTextBox() { protected override FastColoredTextBox CreateFastColoredTextBox() { var textBox = new FctbConsoleTextBox { LeftPadding = 2, - PreferredLineWidth = 80, ShowLineNumbers = false, WordWrap = true, WordWrapMode = WordWrapMode.CharWrapPreferredWidth, @@ -53,8 +52,11 @@ private FctbConsoleTextBox Console { [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public override string Text { - get { return base.Text; } - set { base.Text = value; } + get { return Console.Text; } + set { + Console.Clear(); + Console.WriteLine(value); + } } protected override void OnHandleDestroyed(EventArgs e) { diff --git a/Irony.WinForms/FastColoredTextBox/ConsoleTextBox.cs b/Irony.WinForms/FastColoredTextBox/ConsoleTextBox.cs index bc50644..31a42f0 100644 --- a/Irony.WinForms/FastColoredTextBox/ConsoleTextBox.cs +++ b/Irony.WinForms/FastColoredTextBox/ConsoleTextBox.cs @@ -26,6 +26,19 @@ public bool IsReadLineMode set { isReadLineMode = value; } } + public new void Clear() + { + isUpdating = true; + try + { + base.Clear(); + } + finally + { + isUpdating = false; + } + } + /// /// Append line to end of text. /// diff --git a/Irony.WinForms/IronyTextBoxBase.cs b/Irony.WinForms/IronyTextBoxBase.cs index 78030a6..cbfa271 100644 --- a/Irony.WinForms/IronyTextBoxBase.cs +++ b/Irony.WinForms/IronyTextBoxBase.cs @@ -118,6 +118,12 @@ protected override void OnPaint(PaintEventArgs args) { } } + [DefaultValue(false)] + public bool ReadOnly { + get { return FastColoredTextBox.ReadOnly; } + set { FastColoredTextBox.ReadOnly = value; } + } + /// /// Selects a range of text in the text box. ///