1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-02-14 03:44:58 +00:00

Added full-screen mode, tweaked layout of debugger UI a bit.

This commit is contained in:
Josh Dersch
2016-05-17 15:51:27 -07:00
parent 46d625586f
commit 7faeb824f5
5 changed files with 908 additions and 823 deletions

View File

@@ -29,7 +29,7 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AltoWindow));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this._mainMenu = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -56,22 +56,23 @@
this.CaptureStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.SystemStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.DisplayBox = new System.Windows.Forms.PictureBox();
this.menuStrip1.SuspendLayout();
this.fullScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this._mainMenu.SuspendLayout();
this.StatusLine.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DisplayBox)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
// _mainMenu
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this._mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.settingsToolStripMenuItem,
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(608, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
this._mainMenu.Location = new System.Drawing.Point(0, 0);
this._mainMenu.Name = "_mainMenu";
this._mainMenu.Size = new System.Drawing.Size(608, 24);
this._mainMenu.TabIndex = 2;
this._mainMenu.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
@@ -108,7 +109,8 @@
this.AlternateBootToolStripMenuItem,
this.SystemEthernetBootMenu,
this.optionsToolStripMenuItem,
this.SystemShowDebuggerMenuItem});
this.SystemShowDebuggerMenuItem,
this.fullScreenToolStripMenuItem});
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
this.settingsToolStripMenuItem.Text = "System";
@@ -253,7 +255,7 @@
this.StatusLine.Size = new System.Drawing.Size(608, 25);
this.StatusLine.TabIndex = 3;
this.StatusLine.Text = "statusStrip1";
this.StatusLine.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
this.StatusLine.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
//
// DiskStatusLabel
//
@@ -305,6 +307,15 @@
this.DisplayBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnDisplayMouseMove);
this.DisplayBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnDisplayMouseUp);
//
// fullScreenToolStripMenuItem
//
this.fullScreenToolStripMenuItem.Name = "fullScreenToolStripMenuItem";
this.fullScreenToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
| System.Windows.Forms.Keys.F)));
this.fullScreenToolStripMenuItem.Size = new System.Drawing.Size(223, 22);
this.fullScreenToolStripMenuItem.Text = "Full Screen";
this.fullScreenToolStripMenuItem.Click += new System.EventHandler(this.OnFullScreenMenuClick);
//
// AltoWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -312,22 +323,23 @@
this.ClientSize = new System.Drawing.Size(608, 859);
this.Controls.Add(this.StatusLine);
this.Controls.Add(this.DisplayBox);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this._mainMenu);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MainMenuStrip = this._mainMenu;
this.MaximizeBox = false;
this.Name = "AltoWindow";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "ContrAlto";
this.Deactivate += new System.EventHandler(this.OnWindowDeactivate);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnAltoWindowClosed);
this.SizeChanged += new System.EventHandler(this.OnWindowSizeChanged);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnKeyUp);
this.Leave += new System.EventHandler(this.OnWindowLeave);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this._mainMenu.ResumeLayout(false);
this._mainMenu.PerformLayout();
this.StatusLine.ResumeLayout(false);
this.StatusLine.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.DisplayBox)).EndInit();
@@ -339,7 +351,7 @@
#endregion
private System.Windows.Forms.PictureBox DisplayBox;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.MenuStrip _mainMenu;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
@@ -365,5 +377,6 @@
private System.Windows.Forms.ToolStripMenuItem AlternateBootToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveScreenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel FPSLabel;
private System.Windows.Forms.ToolStripMenuItem fullScreenToolStripMenuItem;
}
}

View File

@@ -22,6 +22,7 @@ namespace Contralto
_mouseCaptured = false;
_currentCursorState = true;
_fullScreenDisplay = false;
_displayBuffer = new Bitmap(608, 808, PixelFormat.Format1bppIndexed);
DisplayBox.Image = _displayBuffer;
@@ -54,18 +55,17 @@ namespace Contralto
this.DoubleBuffered = true;
System.Timers.Timer fpsTimer = new System.Timers.Timer();
fpsTimer.AutoReset = true;
fpsTimer.Interval = 1000;
fpsTimer.Elapsed += OnFPSTimerElapsed;
fpsTimer.Start();
_fpsTimer = new System.Timers.Timer();
_fpsTimer.AutoReset = true;
_fpsTimer.Interval = 1000;
_fpsTimer.Elapsed += OnFPSTimerElapsed;
_fpsTimer.Start();
System.Timers.Timer diskTimer = new System.Timers.Timer();
diskTimer.AutoReset = true;
diskTimer.Interval = 25;
diskTimer.Elapsed += OnDiskTimerElapsed;
diskTimer.Start();
_diskAccessTimer = new System.Timers.Timer();
_diskAccessTimer.AutoReset = true;
_diskAccessTimer.Interval = 25;
_diskAccessTimer.Elapsed += OnDiskTimerElapsed;
_diskAccessTimer.Start();
}
public void AttachSystem(AltoSystem system)
@@ -188,6 +188,11 @@ namespace Contralto
optionsWindow.ShowDialog();
}
private void OnFullScreenMenuClick(object sender, EventArgs e)
{
BeginInvoke(new DisplayDelegate(ToggleFullScreen));
}
private void OnHelpAboutClick(object sender, EventArgs e)
{
AboutBox about = new AboutBox();
@@ -270,6 +275,12 @@ namespace Contralto
private void OnAltoWindowClosed(object sender, FormClosedEventArgs e)
{
//
// Stop UI timers
//
_fpsTimer.Stop();
_diskAccessTimer.Stop();
// Halt the system and detach our display
_controller.StopExecution();
_system.DetachDisplay();
@@ -278,7 +289,7 @@ namespace Contralto
//
// Commit current configuration to disk
//
Configuration.WriteConfiguration();
Configuration.WriteConfiguration();
DialogResult = DialogResult.OK;
}
@@ -764,6 +775,23 @@ namespace Contralto
ReleaseMouse();
}
private void OnWindowSizeChanged(object sender, EventArgs e)
{
//
// If we've switched to a fullscreen mode, update the
// Alto's display area.
//
if (_fullScreenDisplay)
{
DisplayBox.Top = 0;
DisplayBox.Left = 0;
DisplayBox.Width = this.Width;
DisplayBox.Height = this.Height;
DisplayBox.SizeMode = PictureBoxSizeMode.Zoom;
DisplayBox.BackColor = Color.Black;
}
}
private void OnFPSTimerElapsed(object sender, ElapsedEventArgs e)
{
string fpsMessage = String.Format("{0} fields/sec", _system.DisplayController.Fields);
@@ -804,6 +832,41 @@ namespace Contralto
}
}
private void ToggleFullScreen()
{
_fullScreenDisplay = !_fullScreenDisplay;
if (_fullScreenDisplay)
{
// Save the original size and location of the Alto's Display so we can
// restore it when full-screen mode is exited.
_windowedDisplayBoxLocation = DisplayBox.Location;
_windowedDisplayBoxSize = DisplayBox.Size;
// Hide window adornments and make the window full screen on the current
// display.
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
_mainMenu.Visible = false;
StatusLine.Visible = false;
// Once the window repaints we will center the Alto's display and
// stretch if applicable.
}
else
{
// Show everything that was hidden before.
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.WindowState = FormWindowState.Normal;
_mainMenu.Visible = true;
StatusLine.Visible = true;
DisplayBox.SizeMode = PictureBoxSizeMode.Normal;
DisplayBox.Location = _windowedDisplayBoxLocation;
DisplayBox.Size = _windowedDisplayBoxSize;
}
}
private void InitKeymap()
{
_keyMap = new Dictionary<Keys, AltoKey>();
@@ -907,10 +970,16 @@ namespace Contralto
// Keyboard mapping from windows vkeys to Alto keys
private Dictionary<Keys, AltoKey> _keyMap;
// Mouse capture state
private bool _mouseCaptured;
private bool _currentCursorState;
private bool _skipNextMouseMove;
// Full-screen state
private bool _fullScreenDisplay;
private Point _windowedDisplayBoxLocation;
private Size _windowedDisplayBoxSize;
// The Alto system we're running
private AltoSystem _system;
@@ -920,17 +989,20 @@ namespace Contralto
// The debugger, which may or may not be running.
private Debugger _debugger;
// strings. TODO: move to resource
private const string _noImageLoadedText = "<no image loaded>";
private const string _systemStoppedText = "Alto Stopped.";
private const string _systemRunningText = "Alto Running.";
private const string _systemErrorText = "Alto Stopped due to error. See Debugger.";
// Status bar things
System.Timers.Timer _fpsTimer;
System.Timers.Timer _diskAccessTimer;
private DiskActivityType _lastActivity;
private Image _diskIdleImage;
private Image _diskReadImage;
private Image _diskWriteImage;
private Image _diskSeekImage;
private Image _diskSeekImage;
}
// strings. TODO: move to resource
private const string _noImageLoadedText = "<no image loaded>";
private const string _systemStoppedText = "Alto Stopped.";
private const string _systemRunningText = "Alto Running.";
private const string _systemErrorText = "Alto Stopped due to error. See Debugger.";
}
}

View File

@@ -117,10 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="_mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="_mainMenu.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="StatusLine.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

File diff suppressed because it is too large Load Diff