diff -ruw GearSrcOrig/Gear/GUI/CogView.cs GearSrcNew/Gear/GUI/CogView.cs --- GearSrcOrig/Gear/GUI/CogView.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/CogView.cs 2009-06-05 00:00:17.000000000 -0700 @@ -57,6 +57,14 @@ } } + public override Boolean IsClosable + { + get + { + return false; + } + } + public CogView(int host) { HostID = host; diff -ruw GearSrcOrig/Gear/GUI/Emulator.Designer.cs GearSrcNew/Gear/GUI/Emulator.Designer.cs --- GearSrcOrig/Gear/GUI/Emulator.Designer.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/Emulator.Designer.cs 2009-06-05 00:00:18.000000000 -0700 @@ -53,11 +53,13 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Emulator)); this.controlBar = new System.Windows.Forms.ToolStrip(); this.openBinaryButton = new System.Windows.Forms.ToolStripButton(); + this.reloadBinaryButton = new System.Windows.Forms.ToolStripButton(); this.resetEmulatorButton = new System.Windows.Forms.ToolStripButton(); this.runEmulatorButton = new System.Windows.Forms.ToolStripButton(); this.stopEmulatorButton = new System.Windows.Forms.ToolStripButton(); this.stepInstructionButton = new System.Windows.Forms.ToolStripButton(); this.stepClockButton = new System.Windows.Forms.ToolStripButton(); + this.closeButton = new System.Windows.Forms.ToolStripButton(); this.unpinButton = new System.Windows.Forms.ToolStripButton(); this.pinButton = new System.Windows.Forms.ToolStripButton(); this.floatButton = new System.Windows.Forms.ToolStripButton(); @@ -86,6 +88,7 @@ // this.controlBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.openBinaryButton, + this.reloadBinaryButton, toolStripSeparator1, this.resetEmulatorButton, this.runEmulatorButton, @@ -93,6 +96,7 @@ this.stepInstructionButton, this.stepClockButton, toolStripSeparator2, + this.closeButton, this.unpinButton, this.pinButton, this.floatButton, @@ -113,6 +117,15 @@ this.openBinaryButton.Text = "Open"; this.openBinaryButton.Click += new System.EventHandler(this.openBinary_Click); // + // reloadBinaryButton + // + this.reloadBinaryButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.reloadBinaryButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.reloadBinaryButton.Name = "reloadBinaryButton"; + this.reloadBinaryButton.Size = new System.Drawing.Size(44, 22); + this.reloadBinaryButton.Text = "Reload"; + this.reloadBinaryButton.Click += new System.EventHandler(this.reloadBinary_Click); + // // resetEmulatorButton // this.resetEmulatorButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; @@ -163,6 +176,16 @@ this.stepClockButton.Text = "Step Clock"; this.stepClockButton.Click += new System.EventHandler(this.stepEmulator_Click); // + // closeButton + // + this.closeButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.closeButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.closeButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.closeButton.Name = "closeButton"; + this.closeButton.Size = new System.Drawing.Size(37, 22); + this.closeButton.Text = "Close"; + this.closeButton.Click += new System.EventHandler(this.closeActiveTab_Click); + // // unpinButton // this.unpinButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; @@ -283,8 +306,10 @@ this.controlBar.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); - } + private System.Windows.Forms.ToolStripButton reloadBinaryButton; + private System.Windows.Forms.ToolStripButton closeButton; + private System.Windows.Forms.ToolStripButton openBinaryButton; #endregion @@ -293,7 +318,6 @@ private System.Windows.Forms.Panel pinnedPanel; private Gear.GUI.CollapsibleSplitter pinnedSplitter; private System.Windows.Forms.TabControl documentsTab; - private System.Windows.Forms.ToolStripButton openBinaryButton; private System.Windows.Forms.ToolStripButton resetEmulatorButton; private System.Windows.Forms.ToolStripButton runEmulatorButton; private System.Windows.Forms.ToolStripButton stopEmulatorButton; diff -ruw GearSrcOrig/Gear/GUI/Emulator.cs GearSrcNew/Gear/GUI/Emulator.cs --- GearSrcOrig/Gear/GUI/Emulator.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/Emulator.cs 2009-06-05 00:00:17.000000000 -0700 @@ -40,6 +40,7 @@ { private Propeller Chip; private String Source; + private String LastFileName; private List FloatControls; private Timer runTimer; @@ -61,6 +62,7 @@ AttachPlugin(new MemoryView()); AttachPlugin(new LogicProbe.LogicView()); AttachPlugin(new SpinView()); + documentsTab.SelectedIndex = 0; // TEMPORARY RUN FUNCTION runTimer = new Timer(); @@ -85,6 +87,7 @@ t.Parent = documentsTab; bm.Dock = DockStyle.Fill; bm.Parent = t; + documentsTab.SelectedTab = t; } private void RunEmulatorStep(object sender, EventArgs e) @@ -114,6 +117,8 @@ try { Chip.Initialize(File.ReadAllBytes(FileName)); + LastFileName = FileName; + RepaintViews(); return true; } catch (IOException ioe) @@ -209,11 +214,18 @@ OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Propeller Runtime Image (*.binary;*.eeprom)|*.binary;*.eeprom|All Files (*.*)|*.*"; openFileDialog.Title = "Open Propeller Binary..."; + openFileDialog.FileName = Source; if (openFileDialog.ShowDialog(this) == DialogResult.OK) OpenFile(openFileDialog.FileName); } + private void reloadBinary_Click(object sender, EventArgs e) + { + OpenFile(LastFileName); + Chip.Reset(); + } + protected override void OnClosed(EventArgs e) { foreach (Control c in FloatControls) @@ -252,6 +264,21 @@ RepaintViews(); } + private void closeActiveTab_Click(object sender, EventArgs e) + { + TabPage tp = documentsTab.SelectedTab; + PluginBase p = (PluginBase)tp.Controls[0]; + + if (p.IsClosable) + { + if (documentsTab.SelectedIndex > 0) + { + documentsTab.SelectedIndex = documentsTab.SelectedIndex - 1; + } + tp.Parent = null; + } + } + private void floatActiveTab_Click(object sender, EventArgs e) { TabPage tp = documentsTab.SelectedTab; diff -ruw GearSrcOrig/Gear/GUI/LogicProbe/LogicView.cs GearSrcNew/Gear/GUI/LogicProbe/LogicView.cs --- GearSrcOrig/Gear/GUI/LogicProbe/LogicView.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/LogicProbe/LogicView.cs 2009-06-05 00:00:18.000000000 -0700 @@ -54,6 +54,14 @@ } } + public override Boolean IsClosable + { + get + { + return false; + } + } + public LogicView() { InitializeComponent(); diff -ruw GearSrcOrig/Gear/GUI/MemoryView.cs GearSrcNew/Gear/GUI/MemoryView.cs --- GearSrcOrig/Gear/GUI/MemoryView.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/MemoryView.cs 2009-06-05 00:00:18.000000000 -0700 @@ -48,6 +48,14 @@ } } + public override Boolean IsClosable + { + get + { + return false; + } + } + public MemoryView() { MonoFont = new Font(FontFamily.GenericMonospace, 10); diff -ruw GearSrcOrig/Gear/GUI/SpinView.cs GearSrcNew/Gear/GUI/SpinView.cs --- GearSrcOrig/Gear/GUI/SpinView.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/GUI/SpinView.cs 2009-06-05 00:00:18.000000000 -0700 @@ -43,7 +43,7 @@ private VScrollBar scrollPosition; private Brush[] Colorize; private Splitter splitter1; - private System.ComponentModel.IContainer components; + //private System.ComponentModel.IContainer components; private Bitmap BackBuffer; public override string Title @@ -54,6 +54,14 @@ } } + public override Boolean IsClosable + { + get + { + return false; + } + } + public SpinView() { MonoSpace = new Font(FontFamily.GenericMonospace, 8); diff -ruw GearSrcOrig/Gear/PluginSupport/PluginBase.cs GearSrcNew/Gear/PluginSupport/PluginBase.cs --- GearSrcOrig/Gear/PluginSupport/PluginBase.cs 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/Gear/PluginSupport/PluginBase.cs 2009-06-05 00:00:17.000000000 -0700 @@ -42,5 +42,6 @@ public virtual void OnPinChange(double time, PinState[] pins) { } public virtual void Repaint(bool force) { } public virtual Boolean AllowHotKeys { get { return true; } } + public virtual Boolean IsClosable { get { return true; } } } } diff -ruw GearSrcOrig/SerialIO.xml GearSrcNew/SerialIO.xml --- GearSrcOrig/SerialIO.xml 2009-06-04 23:54:41.000000000 -0700 +++ GearSrcNew/SerialIO.xml 2009-06-05 00:00:17.000000000 -0700 @@ -1,12 +1,15 @@ // -// SerialIO v0.2 +// SerialIO v0.4 // A Plugin to the Gear Propeller Simulator that allows connecting // to a FullDuplexSerial object running on the propeller chip. // // CHANGELOG +// v0.4 - Fix tab order. Clear transmit buffer on "Clear Text" button click. +// v0.3 - Adds a scrollbar and automatically scrolls down as text comes in. // v0.2 - Fixes a bug in handling receiving a 0 byte. +// v0.1 - Initial release. // // 2009 Ben Levitt // @@ -186,7 +189,7 @@ this.rxPinField.Text = Convert.ToString(rxPin); this.rxPinField.Dock = System.Windows.Forms.DockStyle.Fill; this.rxPinField.Name = "rxPinField"; - this.rxPinField.TabIndex = 1; + this.rxPinField.TabIndex = 2; this.txPinField.BackColor = System.Drawing.SystemColors.Window; this.txPinField.Font = new System.Drawing.Font("Courier New", 9.75F, @@ -196,7 +199,7 @@ this.txPinField.Text = Convert.ToString(txPin); this.txPinField.Dock = System.Windows.Forms.DockStyle.Fill; this.txPinField.Name = "txPinField"; - this.txPinField.TabIndex = 2; + this.txPinField.TabIndex = 3; this.baudField.BackColor = System.Drawing.SystemColors.Window; this.baudField.Font = new System.Drawing.Font("Courier New", 9.75F, @@ -206,7 +209,7 @@ this.baudField.Text = Convert.ToString(baud); this.baudField.Dock = System.Windows.Forms.DockStyle.Fill; this.baudField.Name = "baudField"; - this.baudField.TabIndex = 3; + this.baudField.TabIndex = 4; this.bodyField.BackColor = System.Drawing.SystemColors.Window; this.bodyField.Font = new System.Drawing.Font("Courier New", 9.75F, @@ -214,20 +217,22 @@ System.Drawing.GraphicsUnit.Point, ((byte)(0))); //this.bodyField.ReadOnly = true; this.bodyField.Multiline = true; + this.bodyField.WordWrap = true; this.bodyField.Name = "bodyField"; + this.bodyField.ScrollBars = ScrollBars.Vertical; this.bodyField.TabIndex = 0; this.bodyField.Dock = System.Windows.Forms.DockStyle.Fill; this.bodyField.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_KeyPress); this.bodyField.serial = this; resetButton.Text = "Reset Serial"; - resetButton.TabIndex = 4; + resetButton.TabIndex = 5; resetButton.Name = "resetButton"; resetButton.Dock = System.Windows.Forms.DockStyle.Fill; resetButton.Click += new System.EventHandler(this.reset_Click); clearButton.Text = "Clear Text"; - clearButton.TabIndex = 4; + clearButton.TabIndex = 1; clearButton.Name = "clearButton"; clearButton.Dock = System.Windows.Forms.DockStyle.Fill; clearButton.Click += new System.EventHandler(this.clear_Click); @@ -293,8 +298,6 @@ } rxBitPos++; - // displayBuffer += ((bit) ? '1' : '.'); - if (rxBitPos == 8) { rxBitPos = 0; rxPhase = 0; @@ -307,9 +310,11 @@ } rxCurrentByte = 0; - } + this.bodyField.Text = displayBuffer; this.bodyField.SelectionStart = this.bodyField.Text.Length; + this.bodyField.ScrollToCaret(); + } } @@ -364,6 +369,8 @@ txBuffer += str; displayBuffer += str; this.bodyField.Text = displayBuffer; + this.bodyField.SelectionStart = this.bodyField.Text.Length; + this.bodyField.ScrollToCaret(); if (txPhase == 0) { txPhase = 1; @@ -375,6 +382,10 @@ { displayBuffer = ""; this.bodyField.Text = displayBuffer; + if (txBuffer.Length > 0) + { + txBuffer = txBuffer.Substring(0,1); + } } @@ -396,6 +407,8 @@ } this.bodyField.Text = displayBuffer; + this.bodyField.SelectionStart = this.bodyField.Text.Length; + this.bodyField.ScrollToCaret(); if (txPhase == 0) { txPhase = 1;