Skip to content

Commit

Permalink
Replaced txtOutput TextBox in GrammarExplorer with ConsoleTextBox.
Browse files Browse the repository at this point in the history
  • Loading branch information
yallie committed Mar 11, 2018
1 parent c16476b commit fefa362
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
8 changes: 2 additions & 6 deletions Irony.GrammarExplorer/fmGrammarExplorer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Irony.GrammarExplorer/fmGrammarExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
8 changes: 5 additions & 3 deletions Irony.WinForms/ConsoleTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
13 changes: 13 additions & 0 deletions Irony.WinForms/FastColoredTextBox/ConsoleTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ public bool IsReadLineMode
set { isReadLineMode = value; }
}

public new void Clear()
{
isUpdating = true;
try
{
base.Clear();
}
finally
{
isUpdating = false;
}
}

/// <summary>
/// Append line to end of text.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Irony.WinForms/IronyTextBoxBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ protected override void OnPaint(PaintEventArgs args) {
}
}

[DefaultValue(false)]
public bool ReadOnly {
get { return FastColoredTextBox.ReadOnly; }
set { FastColoredTextBox.ReadOnly = value; }
}

/// <summary>
/// Selects a range of text in the text box.
/// </summary>
Expand Down

0 comments on commit fefa362

Please sign in to comment.