Commit adcd5bfe authored by Alexander Dietsch's avatar Alexander Dietsch

- small bugfixes

- new Pre-execution command #IMPORT: import all macros from another piece
  of code to use in your own code
- Log window should flicker less now
parent 0ba079d8
...@@ -11,6 +11,13 @@ namespace LWSimulatorGUI ...@@ -11,6 +11,13 @@ namespace LWSimulatorGUI
{ {
class CustomRichTextBox : RichTextBox class CustomRichTextBox : RichTextBox
{ {
private bool onUnix = false;
internal void setOnUnix(bool onUnix)
{
this.onUnix = onUnix;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{ {
if (keyData == Keys.Tab) if (keyData == Keys.Tab)
...@@ -20,6 +27,19 @@ namespace LWSimulatorGUI ...@@ -20,6 +27,19 @@ namespace LWSimulatorGUI
return true; return true;
} }
if (keyData == Keys.Enter && !onUnix)
{
SelectionLength = 0;
int countSpaces = 0;
string line = "";
if(Lines.Length > 0)
line = Lines[GetLineFromCharIndex(SelectionStart)];
while (countSpaces < line.Length && line[countSpaces] == ' ')
countSpaces++;
SelectedText = "\n" + new string(' ', countSpaces);
return true;
}
return base.ProcessCmdKey(ref msg, keyData); return base.ProcessCmdKey(ref msg, keyData);
} }
} }
......
...@@ -10,24 +10,63 @@ namespace LWSimulatorGUI ...@@ -10,24 +10,63 @@ namespace LWSimulatorGUI
{ {
public class DoubleBufferedListBox : ListBox public class DoubleBufferedListBox : ListBox
{ {
/*
* Code by http://yacsharpblog.blogspot.de/2008/07/listbox-flicker.html
*/
public DoubleBufferedListBox() public DoubleBufferedListBox()
{ {
this.SetStyle( this.SetStyle(
ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer |
ControlStyles.OptimizedDoubleBuffer, true); ControlStyles.ResizeRedraw |
SetStyle(ControlStyles.ResizeRedraw, true); ControlStyles.UserPaint,
true);
this.DrawMode = DrawMode.OwnerDrawFixed; this.DrawMode = DrawMode.OwnerDrawFixed;
this.DoubleBuffered = true; this.DoubleBuffered = true;
} }
/*
protected override void OnPaint(PaintEventArgs pe) protected override void OnDrawItem(DrawItemEventArgs e)
{
if (this.Items.Count > 0)
{
e.DrawBackground();
e.Graphics.DrawString(this.Items[e.Index].ToString(), e.Font, new SolidBrush(this.ForeColor), new PointF(e.Bounds.X, e.Bounds.Y));
}
base.OnDrawItem(e);
}
protected override void OnPaint(PaintEventArgs e)
{ {
// we draw the progressbar normally with Region iRegion = new Region(e.ClipRectangle);
// the flags sets to our settings e.Graphics.FillRegion(new SolidBrush(this.BackColor), iRegion);
base.OnPaintBackground(pe); if (this.Items.Count > 0)
base.OnPaint(pe); {
for (int i = 0; i < this.Items.Count; ++i)
{
System.Drawing.Rectangle irect = this.GetItemRectangle(i);
if (e.ClipRectangle.IntersectsWith(irect))
{
if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i)
|| (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i))
|| (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i)))
{
OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font,
irect, i,
DrawItemState.Selected, this.ForeColor,
this.BackColor));
}
else
{
OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font,
irect, i,
DrawItemState.Default, this.ForeColor,
this.BackColor));
}
iRegion.Complement(irect);
}
}
}
base.OnPaint(e);
} }
*/
} }
} }
namespace LWSimulatorGUI using System.Windows.Forms;
namespace LWSimulatorGUI
{ {
partial class LogWindow partial class LogWindow
{ {
...@@ -34,6 +36,7 @@ ...@@ -34,6 +36,7 @@
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btLogOk = new System.Windows.Forms.Button(); this.btLogOk = new System.Windows.Forms.Button();
this.lBLog = new LWSimulatorGUI.DoubleBufferedListBox();
this.mSLogMenu.SuspendLayout(); this.mSLogMenu.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -59,14 +62,14 @@ ...@@ -59,14 +62,14 @@
// exportToolStripMenuItem // exportToolStripMenuItem
// //
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exportToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.exportToolStripMenuItem.Text = "Export"; this.exportToolStripMenuItem.Text = "Export";
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click); this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
// //
// clearToolStripMenuItem // clearToolStripMenuItem
// //
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
this.clearToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.clearToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.clearToolStripMenuItem.Text = "Clear"; this.clearToolStripMenuItem.Text = "Clear";
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
// //
...@@ -81,6 +84,21 @@ ...@@ -81,6 +84,21 @@
this.btLogOk.UseVisualStyleBackColor = true; this.btLogOk.UseVisualStyleBackColor = true;
this.btLogOk.Click += new System.EventHandler(this.btLogOk_Click); this.btLogOk.Click += new System.EventHandler(this.btLogOk_Click);
// //
// lBLog
//
this.lBLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lBLog.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.lBLog.FormattingEnabled = true;
this.lBLog.HorizontalScrollbar = true;
this.lBLog.Location = new System.Drawing.Point(13, 28);
this.lBLog.Name = "lBLog";
this.lBLog.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lBLog.Size = new System.Drawing.Size(343, 238);
this.lBLog.TabIndex = 1;
this.lBLog.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lBlog_DrawItem);
//
// LogWindow // LogWindow
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
...@@ -88,10 +106,10 @@ ...@@ -88,10 +106,10 @@
this.ClientSize = new System.Drawing.Size(368, 313); this.ClientSize = new System.Drawing.Size(368, 313);
this.Controls.Add(this.btLogOk); this.Controls.Add(this.btLogOk);
this.Controls.Add(this.mSLogMenu); this.Controls.Add(this.mSLogMenu);
this.Controls.Add(this.lBLog);
this.DoubleBuffered = true; this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.mSLogMenu; this.MainMenuStrip = this.mSLogMenu;
this.MaximizeBox = false;
this.Name = "LogWindow"; this.Name = "LogWindow";
this.Text = "Log"; this.Text = "Log";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LogWindow_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LogWindow_FormClosing);
...@@ -107,7 +125,7 @@ ...@@ -107,7 +125,7 @@
private System.Windows.Forms.MenuStrip mSLogMenu; private System.Windows.Forms.MenuStrip mSLogMenu;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
private System.Windows.Forms.ListBox lBLog; private LWSimulatorGUI.DoubleBufferedListBox lBLog;
private System.Windows.Forms.Button btLogOk; private System.Windows.Forms.Button btLogOk;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
} }
......
...@@ -21,24 +21,7 @@ namespace LWSimulatorGUI ...@@ -21,24 +21,7 @@ namespace LWSimulatorGUI
public LogWindow(MainGUI parent, LWCoordinator simul) public LogWindow(MainGUI parent, LWCoordinator simul)
{ {
InitializeComponent(); InitializeComponent();
// //this.lBLog.DrawMode = DrawMode.OwnerDrawFixed;
// lBLog
//
this.lBLog = new LWSimulatorGUI.DoubleBufferedListBox();
this.lBLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lBLog.FormattingEnabled = true;
this.lBLog.Location = new System.Drawing.Point(13, 28);
this.lBLog.Name = "lBLog";
this.lBLog.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lBLog.Size = new System.Drawing.Size(343, 238);
this.lBLog.TabIndex = 1;
this.lBLog.DrawMode = DrawMode.OwnerDrawFixed;
this.lBLog.DrawItem += lBlog_DrawItem;
this.Controls.Add(this.lBLog);
this.PerformLayout();
this.parent = parent; this.parent = parent;
simulator = simul; simulator = simul;
simulator.setLogFuncs(addLine_Notify, newRun, saveLog); simulator.setLogFuncs(addLine_Notify, newRun, saveLog);
...@@ -84,7 +67,6 @@ namespace LWSimulatorGUI ...@@ -84,7 +67,6 @@ namespace LWSimulatorGUI
else else
textBrush = lBlogTextNormalBrush; textBrush = lBlogTextNormalBrush;
g.DrawString(text, e.Font, textBrush, lBLog.GetItemRectangle(index).Location); g.DrawString(text, e.Font, textBrush, lBLog.GetItemRectangle(index).Location);
} }
e.DrawFocusRectangle(); e.DrawFocusRectangle();
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
this.projectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.projectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.runProgramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.runProgramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.enableBreakpointsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.enableBreakpointsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showTransitionFunctionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.registersToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.registersToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.insertRegistersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.insertRegistersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
...@@ -246,7 +245,6 @@ ...@@ -246,7 +245,6 @@
this.projectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.projectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.runProgramToolStripMenuItem, this.runProgramToolStripMenuItem,
this.enableBreakpointsToolStripMenuItem, this.enableBreakpointsToolStripMenuItem,
this.showTransitionFunctionToolStripMenuItem,
this.displayLogToolStripMenuItem}); this.displayLogToolStripMenuItem});
this.projectToolStripMenuItem.Name = "projectToolStripMenuItem"; this.projectToolStripMenuItem.Name = "projectToolStripMenuItem";
this.projectToolStripMenuItem.Size = new System.Drawing.Size(56, 20); this.projectToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
...@@ -256,7 +254,7 @@ ...@@ -256,7 +254,7 @@
// //
this.runProgramToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("runProgramToolStripMenuItem.Image"))); this.runProgramToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("runProgramToolStripMenuItem.Image")));
this.runProgramToolStripMenuItem.Name = "runProgramToolStripMenuItem"; this.runProgramToolStripMenuItem.Name = "runProgramToolStripMenuItem";
this.runProgramToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.runProgramToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
this.runProgramToolStripMenuItem.Text = "Run Program"; this.runProgramToolStripMenuItem.Text = "Run Program";
this.runProgramToolStripMenuItem.Click += new System.EventHandler(this.tSBRun_Click); this.runProgramToolStripMenuItem.Click += new System.EventHandler(this.tSBRun_Click);
// //
...@@ -267,20 +265,13 @@ ...@@ -267,20 +265,13 @@
this.enableBreakpointsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.enableBreakpointsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.enableBreakpointsToolStripMenuItem.Enabled = false; this.enableBreakpointsToolStripMenuItem.Enabled = false;
this.enableBreakpointsToolStripMenuItem.Name = "enableBreakpointsToolStripMenuItem"; this.enableBreakpointsToolStripMenuItem.Name = "enableBreakpointsToolStripMenuItem";
this.enableBreakpointsToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.enableBreakpointsToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
this.enableBreakpointsToolStripMenuItem.Text = "Enable Breakpoints"; this.enableBreakpointsToolStripMenuItem.Text = "Enable Breakpoints";
// //
// showTransitionFunctionToolStripMenuItem
//
this.showTransitionFunctionToolStripMenuItem.Enabled = false;
this.showTransitionFunctionToolStripMenuItem.Name = "showTransitionFunctionToolStripMenuItem";
this.showTransitionFunctionToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.showTransitionFunctionToolStripMenuItem.Text = "Show Transition Function";
//
// displayLogToolStripMenuItem // displayLogToolStripMenuItem
// //
this.displayLogToolStripMenuItem.Name = "displayLogToolStripMenuItem"; this.displayLogToolStripMenuItem.Name = "displayLogToolStripMenuItem";
this.displayLogToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.displayLogToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
this.displayLogToolStripMenuItem.Text = "Display Log"; this.displayLogToolStripMenuItem.Text = "Display Log";
this.displayLogToolStripMenuItem.Click += new System.EventHandler(this.displayLogToolStripMenuItem_Click); this.displayLogToolStripMenuItem.Click += new System.EventHandler(this.displayLogToolStripMenuItem_Click);
// //
...@@ -632,7 +623,6 @@ ...@@ -632,7 +623,6 @@
private System.Windows.Forms.ToolStripMenuItem projectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem projectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem runProgramToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem runProgramToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem enableBreakpointsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem enableBreakpointsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showTransitionFunctionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayLogToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem displayLogToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem registersToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem registersToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem insertRegistersToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem insertRegistersToolStripMenuItem;
......
...@@ -43,8 +43,8 @@ namespace LWSimulatorGUI ...@@ -43,8 +43,8 @@ namespace LWSimulatorGUI
@"((a|i|o|x)(0|[1-9]([0-9])*))", //registers @"((a|i|o|x)(0|[1-9]([0-9])*))", //registers
@"(?<=(\s)|^)(def|enddef|do|loop|while|as)(?=(\s|$))", //commands ending with whitespace @"(?<=(\s)|^)(def|enddef|do|loop|while|as)(?=(\s|$))", //commands ending with whitespace
@"(?<=(\s)|^)(in|out|aux)(?=(\s|:))", //commands ending with whitespace or colon @"(?<=(\s)|^)(in|out|aux)(?=(\s|:))", //commands ending with whitespace or colon
@"(?<=(\s)|^)end(?=(\s|;))", //commands ending with whitespace or semicolon @"(?<=(\s)|^)end(?=(\s|;|$))", //commands ending with whitespace or semicolon
@"((?<=(\s|\())|^)(pred|succ)(?=(\s|\())", //commands ending with whitespace or bracket @"((?<=(\s|\())|^)(pred|succ)(?=(\s|\())", //commands ending with whitespace or bracket
@"#[A-Z]+", //Preprocessor commands @"#[A-Z]+", //Preprocessor commands
}; };
...@@ -77,6 +77,7 @@ namespace LWSimulatorGUI ...@@ -77,6 +77,7 @@ namespace LWSimulatorGUI
if (platform == 4 || platform == 6 || platform == 128) if (platform == 4 || platform == 6 || platform == 128)
onUnix = true; onUnix = true;
InitializeComponent(); InitializeComponent();
fCTBProgram.setOnUnix(onUnix);
// Remove ugly selection colors (usually cell has blue background => cell is selected) // Remove ugly selection colors (usually cell has blue background => cell is selected)
/*this.dGVRegisters.DefaultCellStyle.SelectionBackColor = SystemColors.Highlight; /*this.dGVRegisters.DefaultCellStyle.SelectionBackColor = SystemColors.Highlight;
this.dGVRegisters.DefaultCellStyle.SelectionForeColor = SystemColors.HighlightText;*/ this.dGVRegisters.DefaultCellStyle.SelectionForeColor = SystemColors.HighlightText;*/
...@@ -370,7 +371,7 @@ namespace LWSimulatorGUI ...@@ -370,7 +371,7 @@ namespace LWSimulatorGUI
if (res == DialogResult.Yes) if (res == DialogResult.Yes)
{ {
saveFile(); saveFile(currentFilePath);
return true; return true;
} }
return false; return false;
...@@ -858,7 +859,7 @@ namespace LWSimulatorGUI ...@@ -858,7 +859,7 @@ namespace LWSimulatorGUI
dGVRegisters.CurrentCell = null; dGVRegisters.CurrentCell = null;
dGVRegisters.Columns[1].ReadOnly = true; // Prevent deadlocks by calling this here. dGVRegisters.Columns[1].ReadOnly = true; // Prevent deadlocks by calling this here.
} }
simulator.runProgram(fCTBProgram.Text); simulator.runProgram(fCTBProgram.Text, currentFilePath);
failSafeTimer = new System.Timers.Timer(100); failSafeTimer = new System.Timers.Timer(100);
failSafeTimer.Elapsed += FailSafeTimer_Elapsed; failSafeTimer.Elapsed += FailSafeTimer_Elapsed;
failSafeTimer.Enabled = true; failSafeTimer.Enabled = true;
...@@ -896,7 +897,7 @@ namespace LWSimulatorGUI ...@@ -896,7 +897,7 @@ namespace LWSimulatorGUI
dGVRegisters.CurrentCell = null; // Workaround to validate cell even if run is pressed dGVRegisters.CurrentCell = null; // Workaround to validate cell even if run is pressed
dGVRegisters.Columns[1].ReadOnly = true; // Prevent deadlocks by calling this here. dGVRegisters.Columns[1].ReadOnly = true; // Prevent deadlocks by calling this here.
} }
simulator.singleStepProgram(fCTBProgram.Text); simulator.singleStepProgram(fCTBProgram.Text, currentFilePath);
failSafeTimer = new System.Timers.Timer(100); failSafeTimer = new System.Timers.Timer(100);
failSafeTimer.Elapsed += FailSafeTimer_Elapsed; failSafeTimer.Elapsed += FailSafeTimer_Elapsed;
failSafeTimer.Enabled = true; failSafeTimer.Enabled = true;
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
this.pPreferences.Controls.Add(this.gBRegisters); this.pPreferences.Controls.Add(this.gBRegisters);
this.pPreferences.Location = new System.Drawing.Point(13, 13); this.pPreferences.Location = new System.Drawing.Point(13, 13);
this.pPreferences.Name = "pPreferences"; this.pPreferences.Name = "pPreferences";
this.pPreferences.Size = new System.Drawing.Size(436, 385); this.pPreferences.Size = new System.Drawing.Size(439, 395);
this.pPreferences.TabIndex = 0; this.pPreferences.TabIndex = 0;
// //
// gBEditor // gBEditor
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
this.gBEditor.Controls.Add(this.chBHighlight); this.gBEditor.Controls.Add(this.chBHighlight);
this.gBEditor.Location = new System.Drawing.Point(4, 331); this.gBEditor.Location = new System.Drawing.Point(4, 331);
this.gBEditor.Name = "gBEditor"; this.gBEditor.Name = "gBEditor";
this.gBEditor.Size = new System.Drawing.Size(427, 47); this.gBEditor.Size = new System.Drawing.Size(427, 59);
this.gBEditor.TabIndex = 3; this.gBEditor.TabIndex = 3;
this.gBEditor.TabStop = false; this.gBEditor.TabStop = false;
this.gBEditor.Text = "Texteditor"; this.gBEditor.Text = "Texteditor";
...@@ -103,10 +103,10 @@ ...@@ -103,10 +103,10 @@
this.chBHighlight.AutoSize = true; this.chBHighlight.AutoSize = true;
this.chBHighlight.Location = new System.Drawing.Point(10, 19); this.chBHighlight.Location = new System.Drawing.Point(10, 19);
this.chBHighlight.Name = "chBHighlight"; this.chBHighlight.Name = "chBHighlight";
this.chBHighlight.Size = new System.Drawing.Size(421, 17); this.chBHighlight.Size = new System.Drawing.Size(473, 17);
this.chBHighlight.TabIndex = 8; this.chBHighlight.TabIndex = 8;
this.chBHighlight.Text = "Highlight code after 2 seconds of no input (currently not supported on Unix Syste" + this.chBHighlight.Text = "Highlight code after 2 seconds of no input \n(may cause unexpected behaviour on Uni" +
"ms)"; "x Systems)";
this.chBHighlight.UseVisualStyleBackColor = true; this.chBHighlight.UseVisualStyleBackColor = true;
// //
// gBSimulation // gBSimulation
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
// bPrefCancel // bPrefCancel
// //
this.bPrefCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bPrefCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bPrefCancel.Location = new System.Drawing.Point(374, 404); this.bPrefCancel.Location = new System.Drawing.Point(377, 414);
this.bPrefCancel.Name = "bPrefCancel"; this.bPrefCancel.Name = "bPrefCancel";
this.bPrefCancel.Size = new System.Drawing.Size(75, 23); this.bPrefCancel.Size = new System.Drawing.Size(75, 23);
this.bPrefCancel.TabIndex = 2; this.bPrefCancel.TabIndex = 2;
...@@ -419,7 +419,7 @@ ...@@ -419,7 +419,7 @@
// bPrefOK // bPrefOK
// //
this.bPrefOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bPrefOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bPrefOK.Location = new System.Drawing.Point(293, 404); this.bPrefOK.Location = new System.Drawing.Point(296, 414);
this.bPrefOK.Name = "bPrefOK"; this.bPrefOK.Name = "bPrefOK";
this.bPrefOK.Size = new System.Drawing.Size(75, 23); this.bPrefOK.Size = new System.Drawing.Size(75, 23);
this.bPrefOK.TabIndex = 3; this.bPrefOK.TabIndex = 3;
...@@ -435,7 +435,7 @@ ...@@ -435,7 +435,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(461, 439); this.ClientSize = new System.Drawing.Size(464, 449);
this.Controls.Add(this.bPrefOK); this.Controls.Add(this.bPrefOK);
this.Controls.Add(this.bPrefCancel); this.Controls.Add(this.bPrefCancel);
this.Controls.Add(this.pPreferences); this.Controls.Add(this.pPreferences);
......
This diff is collapsed.
This diff is collapsed.
...@@ -60,6 +60,7 @@ namespace MainLWSimulator ...@@ -60,6 +60,7 @@ namespace MainLWSimulator
} }
} }
defVal = newDefVal;
parent.performRegisterUpdate(); parent.performRegisterUpdate();
return true; return true;
} }
...@@ -85,7 +86,14 @@ namespace MainLWSimulator ...@@ -85,7 +86,14 @@ namespace MainLWSimulator
} }
if (registers.Count < newSize) if (registers.Count < newSize)
{ {
registers.InsertRange(oldCount, Enumerable.Repeat<long>(0, newSize - oldCount).ToList()); if (parent.onUnix)
for(int i = oldCount; i < newSize; i++)
{
registers.Insert(i, defVal);
registers[i] = defVal;
}
else
registers.InsertRange(oldCount, Enumerable.Repeat<long>(defVal, newSize - oldCount).ToList());
updateRange(oldCount, newSize - oldCount); updateRange(oldCount, newSize - oldCount);
changed = true; changed = true;
} }
......
...@@ -170,8 +170,8 @@ namespace TinyPG ...@@ -170,8 +170,8 @@ namespace TinyPG
case TokenType.Start: case TokenType.Start:
Value = EvalStart(tree, paramlist); Value = EvalStart(tree, paramlist);
break; break;
case TokenType.PreProcDef: case TokenType.PreExecComs:
Value = EvalPreProcDef(tree, paramlist); Value = EvalPreExecComs(tree, paramlist);
break; break;
case TokenType.MacroDef: case TokenType.MacroDef:
Value = EvalMacroDef(tree, paramlist); Value = EvalMacroDef(tree, paramlist);
...@@ -285,7 +285,7 @@ namespace TinyPG ...@@ -285,7 +285,7 @@ namespace TinyPG
return "Could not interpret input; no semantics implemented."; return "Could not interpret input; no semantics implemented.";
} }
protected virtual object EvalPreProcDef(ParseTree tree, params object[] paramlist) protected virtual object EvalPreExecComs(ParseTree tree, params object[] paramlist)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
......
...@@ -53,11 +53,12 @@ namespace TinyPG ...@@ -53,11 +53,12 @@ namespace TinyPG
} }
tok = scanner.LookAhead(TokenType.PREPROCESSORCOM); tok = scanner.LookAhead(TokenType.PRE_EXEC_COMS_INT, TokenType.PRE_EXEC_COMS_STRING);
while (tok.Type == TokenType.PREPROCESSORCOM) while (tok.Type == TokenType.PRE_EXEC_COMS_INT
|| tok.Type == TokenType.PRE_EXEC_COMS_STRING)
{ {
ParsePreProcDef(node); ParsePreExecComs(node);
tok = scanner.LookAhead(TokenType.PREPROCESSORCOM); tok = scanner.LookAhead(TokenType.PRE_EXEC_COMS_INT, TokenType.PRE_EXEC_COMS_STRING);
} }