Message Config - Simplify code and some cleanup (#2183)

* move messageConfig to its own folder

* start MessageEdit user control

* more setup

* wire stuff up

* progress

* progress

* fixes and cleanup

* start mesage row component

* move method from MessageConfig to extension method

* MessageRow - progress

* progress

* Message row - progress

* progress

* fix initial load

* fix Restore btn

* use RadioButtonEx

* start ColorRow user control

* progress

* progress

* progress

* rename

* make color picker work

* cleanup

* cleanup

* Message config - don't immediate set config values on restore defaults, allow user to press ok or cancel to decide to actually save

* cleanup

* cleanup
This commit is contained in:
adelikat 2020-06-30 16:16:54 -05:00 committed by GitHub
parent 7aa1a497f7
commit e5bbec1800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1509 additions and 1335 deletions

View File

@ -30,6 +30,8 @@
return type == MessagePosition.AnchorType.TopLeft
|| type == MessagePosition.AnchorType.BottomLeft;
}
public static string ToCoordinateStr(this MessagePosition position) => $"{position.X}, {position.Y}";
}
public static class DefaultMessagePositions

View File

@ -147,6 +147,24 @@
<ItemGroup>
<Compile Update="ArchiveChooser.cs" SubType="Form" />
<Compile Update="ArchiveChooser.Designer.cs" DependentUpon="ArchiveChooser.cs" />
<Compile Update="config\Messages\ColorRow.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="config\Messages\ColorRow.Designer.cs">
<DependentUpon>ColorRow.cs</DependentUpon>
</Compile>
<Compile Update="config\Messages\MessageRow.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="config\Messages\MessageRow.Designer.cs">
<DependentUpon>MessageRow.cs</DependentUpon>
</Compile>
<Compile Update="config\Messages\MessageEdit.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="config\Messages\MessageEdit.Designer.cs">
<DependentUpon>MessageEdit.cs</DependentUpon>
</Compile>
<EmbeddedResource Update="ArchiveChooser.resx" DependentUpon="ArchiveChooser.cs" SubType="Designer" />
<Compile Update="AVOut/FFmpegWriterForm.cs" SubType="Form" />
<Compile Update="AVOut/FFmpegWriterForm.Designer.cs" DependentUpon="FFmpegWriterForm.cs" />
@ -258,9 +276,15 @@
<Compile Update="config/INTV/IntvControllerSettings.cs" SubType="Form" />
<Compile Update="config/INTV/IntvControllerSettings.Designer.cs" DependentUpon="IntvControllerSettings.cs" />
<EmbeddedResource Update="config/INTV/IntvControllerSettings.resx" DependentUpon="IntvControllerSettings.cs" />
<Compile Update="config/MessageConfig.cs" SubType="Form" />
<Compile Update="config/MessageConfig.Designer.cs" DependentUpon="MessageConfig.cs" />
<EmbeddedResource Update="config/MessageConfig.resx" DependentUpon="MessageConfig.cs" SubType="Designer" />
<Compile Update="config\Messages\MessageConfig.cs" SubType="Form" />
<Compile Update="config\Messages\MessageConfig.Designer.cs" DependentUpon="MessageConfig.cs" />
<EmbeddedResource Update="config\Messages\ColorRow.resx">
<DependentUpon>ColorRow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="config\Messages\MessageRow.resx">
<DependentUpon>MessageRow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="config\Messages\MessageConfig.resx" DependentUpon="MessageConfig.cs" SubType="Designer" />
<Compile Update="config/N64/N64ControllerSettingControl.cs" SubType="UserControl" />
<Compile Update="config/N64/N64ControllerSettingControl.Designer.cs" DependentUpon="N64ControllerSettingControl.cs" />
<EmbeddedResource Update="config/N64/N64ControllerSettingControl.resx" DependentUpon="N64ControllerSettingControl.cs" />

View File

@ -1,692 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class MessageConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.OK = new System.Windows.Forms.Button();
this.MessageTypeBox = new System.Windows.Forms.GroupBox();
this.WatchesLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.WatchesRadio = new System.Windows.Forms.RadioButton();
this.AutoholdLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.AutoholdRadio = new System.Windows.Forms.RadioButton();
this.RerecLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.RerecordsRadio = new System.Windows.Forms.RadioButton();
this.MessLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.InpLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.LagLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.FCLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.FpsPosLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.MessagesRadio = new System.Windows.Forms.RadioButton();
this.InputDisplayRadio = new System.Windows.Forms.RadioButton();
this.LagCounterRadio = new System.Windows.Forms.RadioButton();
this.FrameCounterRadio = new System.Windows.Forms.RadioButton();
this.FPSRadio = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label12 = new BizHawk.WinForms.Controls.LocLabelEx();
this.MovieInputText = new System.Windows.Forms.TextBox();
this.label11 = new BizHawk.WinForms.Controls.LocLabelEx();
this.MovieInputColor = new System.Windows.Forms.Panel();
this.LInputColorPanel = new System.Windows.Forms.Panel();
this.AlertColorPanel = new System.Windows.Forms.Panel();
this.ColorPanel = new System.Windows.Forms.Panel();
this.label7 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label8 = new BizHawk.WinForms.Controls.LocLabelEx();
this.LInputText = new System.Windows.Forms.TextBox();
this.label6 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label5 = new BizHawk.WinForms.Controls.LocLabelEx();
this.AlertColorText = new System.Windows.Forms.TextBox();
this.label4 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label3 = new BizHawk.WinForms.Controls.LocLabelEx();
this.ColorText = new System.Windows.Forms.TextBox();
this.MessageColorDialog = new System.Windows.Forms.ColorDialog();
this.Cancel = new System.Windows.Forms.Button();
this.ResetDefaultsButton = new System.Windows.Forms.Button();
this.PositionPanel = new System.Windows.Forms.Panel();
this.XNumeric = new System.Windows.Forms.NumericUpDown();
this.YNumeric = new System.Windows.Forms.NumericUpDown();
this.label1 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label2 = new BizHawk.WinForms.Controls.LocLabelEx();
this.PositionGroupBox = new System.Windows.Forms.GroupBox();
this.BR = new System.Windows.Forms.RadioButton();
this.BL = new System.Windows.Forms.RadioButton();
this.TR = new System.Windows.Forms.RadioButton();
this.TL = new System.Windows.Forms.RadioButton();
this.AlertColorDialog = new System.Windows.Forms.ColorDialog();
this.LInputColorDialog = new System.Windows.Forms.ColorDialog();
this.MovieInputColorDialog = new System.Windows.Forms.ColorDialog();
this.StackMessagesCheckbox = new System.Windows.Forms.CheckBox();
this.MessageTypeBox.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.XNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.YNumeric)).BeginInit();
this.PositionGroupBox.SuspendLayout();
this.SuspendLayout();
//
// OK
//
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Location = new System.Drawing.Point(348, 418);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 1;
this.OK.Text = "&OK";
this.OK.UseVisualStyleBackColor = true;
this.OK.Click += new System.EventHandler(this.Ok_Click);
//
// MessageTypeBox
//
this.MessageTypeBox.Controls.Add(this.WatchesLabel);
this.MessageTypeBox.Controls.Add(this.WatchesRadio);
this.MessageTypeBox.Controls.Add(this.AutoholdLabel);
this.MessageTypeBox.Controls.Add(this.AutoholdRadio);
this.MessageTypeBox.Controls.Add(this.RerecLabel);
this.MessageTypeBox.Controls.Add(this.RerecordsRadio);
this.MessageTypeBox.Controls.Add(this.MessLabel);
this.MessageTypeBox.Controls.Add(this.InpLabel);
this.MessageTypeBox.Controls.Add(this.LagLabel);
this.MessageTypeBox.Controls.Add(this.FCLabel);
this.MessageTypeBox.Controls.Add(this.FpsPosLabel);
this.MessageTypeBox.Controls.Add(this.MessagesRadio);
this.MessageTypeBox.Controls.Add(this.InputDisplayRadio);
this.MessageTypeBox.Controls.Add(this.LagCounterRadio);
this.MessageTypeBox.Controls.Add(this.FrameCounterRadio);
this.MessageTypeBox.Controls.Add(this.FPSRadio);
this.MessageTypeBox.Location = new System.Drawing.Point(12, 12);
this.MessageTypeBox.Name = "MessageTypeBox";
this.MessageTypeBox.Size = new System.Drawing.Size(177, 211);
this.MessageTypeBox.TabIndex = 2;
this.MessageTypeBox.TabStop = false;
this.MessageTypeBox.Text = "Message Type";
//
// WatchesLabel
//
this.WatchesLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.WatchesLabel.Location = new System.Drawing.Point(126, 116);
this.WatchesLabel.Name = "WatchesLabel";
this.WatchesLabel.Text = "255, 255";
//
// WatchesRadio
//
this.WatchesRadio.AutoSize = true;
this.WatchesRadio.Location = new System.Drawing.Point(6, 114);
this.WatchesRadio.Name = "WatchesRadio";
this.WatchesRadio.Size = new System.Drawing.Size(68, 17);
this.WatchesRadio.TabIndex = 16;
this.WatchesRadio.Text = "Watches";
this.WatchesRadio.UseVisualStyleBackColor = true;
//
// AutoholdLabel
//
this.AutoholdLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.AutoholdLabel.Location = new System.Drawing.Point(126, 185);
this.AutoholdLabel.Name = "AutoholdLabel";
this.AutoholdLabel.Text = "255, 255";
//
// AutoholdRadio
//
this.AutoholdRadio.AutoSize = true;
this.AutoholdRadio.Location = new System.Drawing.Point(6, 186);
this.AutoholdRadio.Name = "AutoholdRadio";
this.AutoholdRadio.Size = new System.Drawing.Size(67, 17);
this.AutoholdRadio.TabIndex = 14;
this.AutoholdRadio.TabStop = true;
this.AutoholdRadio.Text = "Autohold";
this.AutoholdRadio.UseVisualStyleBackColor = true;
this.AutoholdRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// RerecLabel
//
this.RerecLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.RerecLabel.Location = new System.Drawing.Point(126, 161);
this.RerecLabel.Name = "RerecLabel";
this.RerecLabel.Text = "255, 255";
//
// RerecordsRadio
//
this.RerecordsRadio.AutoSize = true;
this.RerecordsRadio.Location = new System.Drawing.Point(6, 162);
this.RerecordsRadio.Name = "RerecordsRadio";
this.RerecordsRadio.Size = new System.Drawing.Size(74, 17);
this.RerecordsRadio.TabIndex = 10;
this.RerecordsRadio.Text = "Rerecords";
this.RerecordsRadio.UseVisualStyleBackColor = true;
this.RerecordsRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// MessLabel
//
this.MessLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.MessLabel.Location = new System.Drawing.Point(126, 137);
this.MessLabel.Name = "MessLabel";
this.MessLabel.Text = "255, 255";
//
// InpLabel
//
this.InpLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.InpLabel.Location = new System.Drawing.Point(126, 92);
this.InpLabel.Name = "InpLabel";
this.InpLabel.Text = "255, 255";
//
// LagLabel
//
this.LagLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.LagLabel.Location = new System.Drawing.Point(126, 68);
this.LagLabel.Name = "LagLabel";
this.LagLabel.Text = "255, 255";
//
// FCLabel
//
this.FCLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.FCLabel.Location = new System.Drawing.Point(126, 44);
this.FCLabel.Name = "FCLabel";
this.FCLabel.Text = "255, 255";
//
// FpsPosLabel
//
this.FpsPosLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.FpsPosLabel.Location = new System.Drawing.Point(126, 20);
this.FpsPosLabel.Name = "FpsPosLabel";
this.FpsPosLabel.Text = "255, 255";
//
// MessagesRadio
//
this.MessagesRadio.AutoSize = true;
this.MessagesRadio.Location = new System.Drawing.Point(6, 138);
this.MessagesRadio.Name = "MessagesRadio";
this.MessagesRadio.Size = new System.Drawing.Size(73, 17);
this.MessagesRadio.TabIndex = 4;
this.MessagesRadio.Text = "Messages";
this.MessagesRadio.UseVisualStyleBackColor = true;
this.MessagesRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// InputDisplayRadio
//
this.InputDisplayRadio.AutoSize = true;
this.InputDisplayRadio.Location = new System.Drawing.Point(6, 90);
this.InputDisplayRadio.Name = "InputDisplayRadio";
this.InputDisplayRadio.Size = new System.Drawing.Size(86, 17);
this.InputDisplayRadio.TabIndex = 3;
this.InputDisplayRadio.Text = "Input Display";
this.InputDisplayRadio.UseVisualStyleBackColor = true;
this.InputDisplayRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// LagCounterRadio
//
this.LagCounterRadio.AutoSize = true;
this.LagCounterRadio.Location = new System.Drawing.Point(6, 66);
this.LagCounterRadio.Name = "LagCounterRadio";
this.LagCounterRadio.Size = new System.Drawing.Size(83, 17);
this.LagCounterRadio.TabIndex = 2;
this.LagCounterRadio.Text = "Lag Counter";
this.LagCounterRadio.UseVisualStyleBackColor = true;
this.LagCounterRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// FrameCounterRadio
//
this.FrameCounterRadio.AutoSize = true;
this.FrameCounterRadio.Location = new System.Drawing.Point(6, 42);
this.FrameCounterRadio.Name = "FrameCounterRadio";
this.FrameCounterRadio.Size = new System.Drawing.Size(93, 17);
this.FrameCounterRadio.TabIndex = 1;
this.FrameCounterRadio.Text = "Frame counter";
this.FrameCounterRadio.UseVisualStyleBackColor = true;
this.FrameCounterRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// FPSRadio
//
this.FPSRadio.AutoSize = true;
this.FPSRadio.Checked = true;
this.FPSRadio.Location = new System.Drawing.Point(6, 18);
this.FPSRadio.Name = "FPSRadio";
this.FPSRadio.Size = new System.Drawing.Size(42, 17);
this.FPSRadio.TabIndex = 0;
this.FPSRadio.TabStop = true;
this.FPSRadio.Text = "Fps";
this.FPSRadio.UseVisualStyleBackColor = true;
this.FPSRadio.CheckedChanged += new System.EventHandler(this.MessageTypeRadio_CheckedChanged);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.MovieInputText);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.MovieInputColor);
this.groupBox2.Controls.Add(this.LInputColorPanel);
this.groupBox2.Controls.Add(this.AlertColorPanel);
this.groupBox2.Controls.Add(this.ColorPanel);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.LInputText);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.AlertColorText);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.ColorText);
this.groupBox2.Location = new System.Drawing.Point(12, 231);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(177, 210);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Message Colors";
//
// label12
//
this.label12.Location = new System.Drawing.Point(1, 161);
this.label12.Name = "label12";
this.label12.Text = "Movie Input";
//
// MovieInputText
//
this.MovieInputText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.MovieInputText.Location = new System.Drawing.Point(45, 178);
this.MovieInputText.MaxLength = 8;
this.MovieInputText.Name = "MovieInputText";
this.MovieInputText.ReadOnly = true;
this.MovieInputText.Size = new System.Drawing.Size(59, 20);
this.MovieInputText.TabIndex = 23;
//
// label11
//
this.label11.Location = new System.Drawing.Point(28, 181);
this.label11.Name = "label11";
this.label11.Text = "0x";
//
// MovieInputColor
//
this.MovieInputColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.MovieInputColor.Location = new System.Drawing.Point(4, 178);
this.MovieInputColor.Name = "MovieInputColor";
this.MovieInputColor.Size = new System.Drawing.Size(20, 20);
this.MovieInputColor.TabIndex = 9;
this.MovieInputColor.Click += new System.EventHandler(this.MovieInputColor_Click);
//
// LInputColorPanel
//
this.LInputColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.LInputColorPanel.Location = new System.Drawing.Point(6, 130);
this.LInputColorPanel.Name = "LInputColorPanel";
this.LInputColorPanel.Size = new System.Drawing.Size(20, 20);
this.LInputColorPanel.TabIndex = 7;
this.LInputColorPanel.Click += new System.EventHandler(this.LInputColorPanel_Click);
//
// AlertColorPanel
//
this.AlertColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.AlertColorPanel.Location = new System.Drawing.Point(6, 81);
this.AlertColorPanel.Name = "AlertColorPanel";
this.AlertColorPanel.Size = new System.Drawing.Size(20, 20);
this.AlertColorPanel.TabIndex = 7;
this.AlertColorPanel.Click += new System.EventHandler(this.AlertColorPanel_Click);
//
// ColorPanel
//
this.ColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ColorPanel.Location = new System.Drawing.Point(6, 34);
this.ColorPanel.Name = "ColorPanel";
this.ColorPanel.Size = new System.Drawing.Size(20, 20);
this.ColorPanel.TabIndex = 7;
this.ColorPanel.Click += new System.EventHandler(this.ColorPanel_Click);
//
// label7
//
this.label7.Location = new System.Drawing.Point(1, 111);
this.label7.Name = "label7";
this.label7.Text = "Previous Frame Input";
//
// label8
//
this.label8.Location = new System.Drawing.Point(28, 133);
this.label8.Name = "label8";
this.label8.Text = "0x";
//
// LInputText
//
this.LInputText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.LInputText.Location = new System.Drawing.Point(46, 130);
this.LInputText.MaxLength = 8;
this.LInputText.Name = "LInputText";
this.LInputText.ReadOnly = true;
this.LInputText.Size = new System.Drawing.Size(59, 20);
this.LInputText.TabIndex = 16;
//
// label6
//
this.label6.Location = new System.Drawing.Point(1, 62);
this.label6.Name = "label6";
this.label6.Text = "Alert messages";
//
// label5
//
this.label5.Location = new System.Drawing.Point(28, 84);
this.label5.Name = "label5";
this.label5.Text = "0x";
//
// AlertColorText
//
this.AlertColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AlertColorText.Location = new System.Drawing.Point(46, 81);
this.AlertColorText.MaxLength = 8;
this.AlertColorText.Name = "AlertColorText";
this.AlertColorText.ReadOnly = true;
this.AlertColorText.Size = new System.Drawing.Size(59, 20);
this.AlertColorText.TabIndex = 11;
//
// label4
//
this.label4.Location = new System.Drawing.Point(6, 18);
this.label4.Name = "label4";
this.label4.Text = "Main messages";
//
// label3
//
this.label3.Location = new System.Drawing.Point(28, 37);
this.label3.Name = "label3";
this.label3.Text = "0x";
//
// ColorText
//
this.ColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ColorText.Location = new System.Drawing.Point(46, 34);
this.ColorText.MaxLength = 8;
this.ColorText.Name = "ColorText";
this.ColorText.ReadOnly = true;
this.ColorText.Size = new System.Drawing.Size(59, 20);
this.ColorText.TabIndex = 2;
//
// MessageColorDialog
//
this.MessageColorDialog.FullOpen = true;
//
// Cancel
//
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(429, 418);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 5;
this.Cancel.Text = "&Cancel";
this.Cancel.UseVisualStyleBackColor = true;
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
//
// ResetDefaultsButton
//
this.ResetDefaultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ResetDefaultsButton.Location = new System.Drawing.Point(195, 418);
this.ResetDefaultsButton.Name = "ResetDefaultsButton";
this.ResetDefaultsButton.Size = new System.Drawing.Size(96, 23);
this.ResetDefaultsButton.TabIndex = 6;
this.ResetDefaultsButton.Text = "Restore Defaults";
this.ResetDefaultsButton.UseVisualStyleBackColor = true;
this.ResetDefaultsButton.Click += new System.EventHandler(this.ResetDefaultsButton_Click);
//
// PositionPanel
//
this.PositionPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.PositionPanel.Location = new System.Drawing.Point(22, 18);
this.PositionPanel.Name = "PositionPanel";
this.PositionPanel.Size = new System.Drawing.Size(264, 248);
this.PositionPanel.TabIndex = 0;
this.PositionPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.PositionPanel_Paint);
this.PositionPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseDown);
this.PositionPanel.MouseEnter += new System.EventHandler(this.PositionPanel_MouseEnter);
this.PositionPanel.MouseLeave += new System.EventHandler(this.PositionPanel_MouseLeave);
this.PositionPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseMove);
this.PositionPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseUp);
//
// XNumeric
//
this.XNumeric.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.XNumeric.Location = new System.Drawing.Point(43, 271);
this.XNumeric.Maximum = new decimal(new int[] {
256,
0,
0,
0});
this.XNumeric.Name = "XNumeric";
this.XNumeric.Size = new System.Drawing.Size(44, 20);
this.XNumeric.TabIndex = 1;
this.XNumeric.Value = new decimal(new int[] {
255,
0,
0,
0});
this.XNumeric.ValueChanged += new System.EventHandler(this.XNumeric_Changed);
//
// YNumeric
//
this.YNumeric.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.YNumeric.Location = new System.Drawing.Point(106, 271);
this.YNumeric.Maximum = new decimal(new int[] {
256,
0,
0,
0});
this.YNumeric.Name = "YNumeric";
this.YNumeric.Size = new System.Drawing.Size(44, 20);
this.YNumeric.TabIndex = 2;
this.YNumeric.Value = new decimal(new int[] {
255,
0,
0,
0});
this.YNumeric.ValueChanged += new System.EventHandler(this.YNumeric_Changed);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.Location = new System.Drawing.Point(27, 274);
this.label1.Name = "label1";
this.label1.Text = "x";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.Location = new System.Drawing.Point(92, 273);
this.label2.Name = "label2";
this.label2.Text = "y";
//
// PositionGroupBox
//
this.PositionGroupBox.Controls.Add(this.BR);
this.PositionGroupBox.Controls.Add(this.BL);
this.PositionGroupBox.Controls.Add(this.TR);
this.PositionGroupBox.Controls.Add(this.TL);
this.PositionGroupBox.Controls.Add(this.label2);
this.PositionGroupBox.Controls.Add(this.label1);
this.PositionGroupBox.Controls.Add(this.YNumeric);
this.PositionGroupBox.Controls.Add(this.XNumeric);
this.PositionGroupBox.Controls.Add(this.PositionPanel);
this.PositionGroupBox.Location = new System.Drawing.Point(195, 12);
this.PositionGroupBox.Name = "PositionGroupBox";
this.PositionGroupBox.Size = new System.Drawing.Size(307, 299);
this.PositionGroupBox.TabIndex = 3;
this.PositionGroupBox.TabStop = false;
this.PositionGroupBox.Text = "Position";
//
// BR
//
this.BR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BR.AutoSize = true;
this.BR.Location = new System.Drawing.Point(289, 253);
this.BR.Name = "BR";
this.BR.Size = new System.Drawing.Size(14, 13);
this.BR.TabIndex = 8;
this.BR.TabStop = true;
this.BR.UseVisualStyleBackColor = true;
this.BR.Click += new System.EventHandler(this.BR_CheckedChanged);
//
// BL
//
this.BL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BL.AutoSize = true;
this.BL.Location = new System.Drawing.Point(6, 253);
this.BL.Name = "BL";
this.BL.Size = new System.Drawing.Size(14, 13);
this.BL.TabIndex = 7;
this.BL.TabStop = true;
this.BL.UseVisualStyleBackColor = true;
this.BL.Click += new System.EventHandler(this.BL_CheckedChanged);
//
// TR
//
this.TR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.TR.AutoSize = true;
this.TR.Location = new System.Drawing.Point(288, 18);
this.TR.Name = "TR";
this.TR.Size = new System.Drawing.Size(14, 13);
this.TR.TabIndex = 6;
this.TR.TabStop = true;
this.TR.UseVisualStyleBackColor = true;
this.TR.Click += new System.EventHandler(this.TR_CheckedChanged);
//
// TL
//
this.TL.AutoSize = true;
this.TL.Location = new System.Drawing.Point(6, 18);
this.TL.Name = "TL";
this.TL.Size = new System.Drawing.Size(14, 13);
this.TL.TabIndex = 5;
this.TL.TabStop = true;
this.TL.UseVisualStyleBackColor = true;
this.TL.Click += new System.EventHandler(this.TL_CheckedChanged);
//
// AlertColorDialog
//
this.AlertColorDialog.FullOpen = true;
//
// LInputColorDialog
//
this.LInputColorDialog.FullOpen = true;
//
// MovieInputColorDialog
//
this.MovieInputColorDialog.FullOpen = true;
//
// StackMessagesCheckbox
//
this.StackMessagesCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.StackMessagesCheckbox.AutoSize = true;
this.StackMessagesCheckbox.Location = new System.Drawing.Point(195, 388);
this.StackMessagesCheckbox.Name = "StackMessagesCheckbox";
this.StackMessagesCheckbox.Size = new System.Drawing.Size(105, 17);
this.StackMessagesCheckbox.TabIndex = 7;
this.StackMessagesCheckbox.Text = "Stack Messages";
this.StackMessagesCheckbox.UseVisualStyleBackColor = true;
//
// MessageConfig
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(512, 446);
this.Controls.Add(this.StackMessagesCheckbox);
this.Controls.Add(this.ResetDefaultsButton);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.PositionGroupBox);
this.Controls.Add(this.MessageTypeBox);
this.Controls.Add(this.OK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MinimumSize = new System.Drawing.Size(404, 375);
this.Name = "MessageConfig";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configure On Screen Messages";
this.Load += new System.EventHandler(this.MessageConfig_Load);
this.MessageTypeBox.ResumeLayout(false);
this.MessageTypeBox.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.XNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.YNumeric)).EndInit();
this.PositionGroupBox.ResumeLayout(false);
this.PositionGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button OK;
private System.Windows.Forms.GroupBox MessageTypeBox;
private System.Windows.Forms.RadioButton MessagesRadio;
private System.Windows.Forms.RadioButton InputDisplayRadio;
private System.Windows.Forms.RadioButton LagCounterRadio;
private System.Windows.Forms.RadioButton FrameCounterRadio;
private System.Windows.Forms.RadioButton FPSRadio;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ColorDialog MessageColorDialog;
private System.Windows.Forms.Button Cancel;
private BizHawk.WinForms.Controls.LocLabelEx MessLabel;
private BizHawk.WinForms.Controls.LocLabelEx InpLabel;
private BizHawk.WinForms.Controls.LocLabelEx LagLabel;
private BizHawk.WinForms.Controls.LocLabelEx FCLabel;
private BizHawk.WinForms.Controls.LocLabelEx FpsPosLabel;
private System.Windows.Forms.Button ResetDefaultsButton;
private System.Windows.Forms.TextBox ColorText;
private BizHawk.WinForms.Controls.LocLabelEx label3;
private System.Windows.Forms.Panel PositionPanel;
private System.Windows.Forms.NumericUpDown XNumeric;
private System.Windows.Forms.NumericUpDown YNumeric;
private BizHawk.WinForms.Controls.LocLabelEx label1;
private BizHawk.WinForms.Controls.LocLabelEx label2;
private System.Windows.Forms.GroupBox PositionGroupBox;
private BizHawk.WinForms.Controls.LocLabelEx label5;
private System.Windows.Forms.TextBox AlertColorText;
private System.Windows.Forms.Panel AlertColorPanel;
private BizHawk.WinForms.Controls.LocLabelEx label4;
private BizHawk.WinForms.Controls.LocLabelEx label6;
private BizHawk.WinForms.Controls.LocLabelEx label7;
private BizHawk.WinForms.Controls.LocLabelEx label8;
private System.Windows.Forms.TextBox LInputText;
private System.Windows.Forms.Panel LInputColorPanel;
private System.Windows.Forms.ColorDialog AlertColorDialog;
private System.Windows.Forms.ColorDialog LInputColorDialog;
private System.Windows.Forms.RadioButton BR;
private System.Windows.Forms.RadioButton BL;
private System.Windows.Forms.RadioButton TR;
private System.Windows.Forms.RadioButton TL;
private BizHawk.WinForms.Controls.LocLabelEx RerecLabel;
private System.Windows.Forms.RadioButton RerecordsRadio;
private System.Windows.Forms.Panel ColorPanel;
private System.Windows.Forms.TextBox MovieInputText;
private BizHawk.WinForms.Controls.LocLabelEx label11;
private System.Windows.Forms.Panel MovieInputColor;
private BizHawk.WinForms.Controls.LocLabelEx label12;
private System.Windows.Forms.ColorDialog MovieInputColorDialog;
private System.Windows.Forms.CheckBox StackMessagesCheckbox;
private BizHawk.WinForms.Controls.LocLabelEx AutoholdLabel;
private System.Windows.Forms.RadioButton AutoholdRadio;
private BizHawk.WinForms.Controls.LocLabelEx WatchesLabel;
private System.Windows.Forms.RadioButton WatchesRadio;
}
}

View File

@ -1,509 +0,0 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class MessageConfig : Form
{
private readonly Config _config;
private MessagePosition _fps;
private MessagePosition _frameCounter;
private MessagePosition _lagCounter;
private MessagePosition _inputDisplay;
private MessagePosition _reRecordCounter;
private MessagePosition _messages;
private MessagePosition _autohold;
private MessagePosition _ramWatches;
private int _messageColor;
private int _alertColor;
private int _lastInputColor;
private int _movieInput;
private int _px;
private int _py;
private bool _mousedown;
private bool _programmaticallyChangingValues;
public MessageConfig(Config config)
{
_config = config;
_fps = _config.Fps.Clone();
_frameCounter = _config.FrameCounter.Clone();
_lagCounter = _config.LagCounter.Clone();
_inputDisplay = _config.InputDisplay.Clone();
_reRecordCounter = _config.ReRecordCounter.Clone();
_messages = _config.Messages.Clone();
_autohold = _config.Autohold.Clone();
_ramWatches = _config.RamWatches.Clone();
_messageColor = _config.MessagesColor;
_alertColor = _config.AlertMessageColor;
_lastInputColor = _config.LastInputColor;
_movieInput = _config.MovieInput;
InitializeComponent();
}
private void MessageConfig_Load(object sender, EventArgs e)
{
SetMaxXy();
MessageColorDialog.Color = Color.FromArgb(_messageColor);
AlertColorDialog.Color = Color.FromArgb(_alertColor);
LInputColorDialog.Color = Color.FromArgb(_lastInputColor);
MovieInputColorDialog.Color = Color.FromArgb(_movieInput);
SetColorBox();
SetPositionInfo();
StackMessagesCheckbox.Checked = _config.StackOSDMessages;
}
private void SetMaxXy()
{
var video = NullVideo.Instance; // Good enough
XNumeric.Maximum = video.BufferWidth - 12;
YNumeric.Maximum = video.BufferHeight - 12;
PositionPanel.Size = new Size(video.BufferWidth + 2, video.BufferHeight + 2);
PositionGroupBox.Size = new Size(
Math.Max(video.BufferWidth, UIHelper.ScaleX(128)) + UIHelper.ScaleX(44),
video.BufferHeight + UIHelper.ScaleY(52));
}
private void SetColorBox()
{
_messageColor = MessageColorDialog.Color.ToArgb();
ColorPanel.BackColor = MessageColorDialog.Color;
ColorText.Text = $"{_messageColor:X8}";
_alertColor = AlertColorDialog.Color.ToArgb();
AlertColorPanel.BackColor = AlertColorDialog.Color;
AlertColorText.Text = $"{_alertColor:X8}";
_lastInputColor = LInputColorDialog.Color.ToArgb();
LInputColorPanel.BackColor = LInputColorDialog.Color;
LInputText.Text = $"{_lastInputColor:X8}";
_movieInput = MovieInputColorDialog.Color.ToArgb();
MovieInputColor.BackColor = MovieInputColorDialog.Color;
MovieInputText.Text = $"{_movieInput:X8}";
}
private void SetFromOption(MessagePosition position)
{
_programmaticallyChangingValues = true;
XNumeric.Value = position.X;
YNumeric.Value = position.Y;
_px = position.X;
_py = position.Y;
switch (position.Anchor)
{
default:
case MessagePosition.AnchorType.TopLeft:
TL.Checked = true;
break;
case MessagePosition.AnchorType.TopRight:
TR.Checked = true;
break;
case MessagePosition.AnchorType.BottomLeft:
BL.Checked = true;
break;
case MessagePosition.AnchorType.BottomRight:
BR.Checked = true;
break;
}
_programmaticallyChangingValues = false;
}
private void SetPositionInfo()
{
if (FPSRadio.Checked)
{
SetFromOption(_fps);
}
else if (FrameCounterRadio.Checked)
{
SetFromOption(_frameCounter);
}
else if (LagCounterRadio.Checked)
{
SetFromOption(_lagCounter);
}
else if (InputDisplayRadio.Checked)
{
SetFromOption(_inputDisplay);
}
else if (WatchesRadio.Checked)
{
SetFromOption(_ramWatches);
}
else if (MessagesRadio.Checked)
{
SetFromOption(_messages);
}
else if (RerecordsRadio.Checked)
{
SetFromOption(_reRecordCounter);
}
else if (AutoholdRadio.Checked)
{
SetFromOption(_autohold);
}
PositionPanel.Refresh();
XNumeric.Refresh();
YNumeric.Refresh();
SetPositionLabels();
}
private void Ok_Click(object sender, EventArgs e)
{
_config.Fps = _fps;
_config.FrameCounter = _frameCounter;
_config.LagCounter = _lagCounter;
_config.InputDisplay = _inputDisplay;
_config.ReRecordCounter = _reRecordCounter;
_config.Messages = _messages;
_config.Autohold = _autohold;
_config.RamWatches = _ramWatches;
_config.MessagesColor = _messageColor;
_config.AlertMessageColor = _alertColor;
_config.LastInputColor = _lastInputColor;
_config.MovieInput = _movieInput;
_config.StackOSDMessages = StackMessagesCheckbox.Checked;
DialogResult = DialogResult.OK;
Close();
}
private void Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void MessageTypeRadio_CheckedChanged(object sender, EventArgs e)
{
SetPositionInfo();
}
private void PositionPanel_MouseEnter(object sender, EventArgs e)
{
Cursor = Cursors.Hand;
}
private void PositionPanel_MouseLeave(object sender, EventArgs e)
{
Cursor = Cursors.Default;
}
private void PositionPanel_Paint(object sender, PaintEventArgs e)
{
int x = 0;
int y = 0;
if (TL.Checked)
{
x = _px;
y = _py;
}
else if (TR.Checked)
{
x = (int)XNumeric.Maximum - _px;
y = _py;
}
else if (BL.Checked)
{
x = _px;
y = (int)YNumeric.Maximum - _py;
}
else if (BR.Checked)
{
x = (int)XNumeric.Maximum - _px;
y = (int)YNumeric.Maximum - _py;
}
using var p = new Pen(Color.Black);
e.Graphics.DrawLine(p, new Point(x, y), new Point(x + 8, y + 8));
e.Graphics.DrawLine(p, new Point(x + 8, y), new Point(x, y + 8));
e.Graphics.DrawRectangle(p, new Rectangle(x, y, 8, 8));
}
private void PositionPanel_MouseDown(object sender, MouseEventArgs e)
{
Cursor = Cursors.Arrow;
_mousedown = true;
SetNewPosition(e.X, e.Y);
}
private void PositionPanel_MouseUp(object sender, MouseEventArgs e)
{
Cursor = Cursors.Hand;
_mousedown = false;
}
private void SetNewPosition(int mx, int my)
{
_programmaticallyChangingValues = true;
if (mx < 0) mx = 0;
if (my < 0) my = 0;
if (mx > XNumeric.Maximum) mx = (int)XNumeric.Maximum;
if (my > YNumeric.Maximum) my = (int)YNumeric.Maximum;
if (TL.Checked)
{
// Do nothing
}
else if (TR.Checked)
{
mx = (int)XNumeric.Maximum - mx;
}
else if (BL.Checked)
{
my = (int)YNumeric.Maximum - my;
}
else if (BR.Checked)
{
mx = (int)XNumeric.Maximum - mx;
my = (int)YNumeric.Maximum - my;
}
XNumeric.Value = mx;
YNumeric.Value = my;
_px = mx;
_py = my;
PositionPanel.Refresh();
SetPositionLabels();
_programmaticallyChangingValues = false;
}
private void PositionPanel_MouseMove(object sender, MouseEventArgs e)
{
if (_mousedown)
{
SetNewPosition(e.X, e.Y);
}
}
private void SetOptionPosition(MessagePosition position)
{
position.X = _px;
position.Y = _py;
}
private void SetPositionLabels()
{
if (FPSRadio.Checked)
{
SetOptionPosition(_fps);
}
else if (FrameCounterRadio.Checked)
{
SetOptionPosition(_frameCounter);
}
else if (LagCounterRadio.Checked)
{
SetOptionPosition(_lagCounter);
}
else if (InputDisplayRadio.Checked)
{
SetOptionPosition(_inputDisplay);
}
else if (WatchesRadio.Checked)
{
SetOptionPosition(_ramWatches);
}
else if (RerecordsRadio.Checked)
{
SetOptionPosition(_reRecordCounter);
}
else if (MessagesRadio.Checked)
{
SetOptionPosition(_messages);
}
else if (AutoholdRadio.Checked)
{
SetOptionPosition(_autohold);
}
FpsPosLabel.Text = ToCoordinateStr(_fps);
FCLabel.Text = ToCoordinateStr(_frameCounter);
LagLabel.Text = ToCoordinateStr(_lagCounter);
InpLabel.Text = ToCoordinateStr(_inputDisplay);
WatchesLabel.Text = ToCoordinateStr(_ramWatches);
RerecLabel.Text = ToCoordinateStr(_reRecordCounter);
MessLabel.Text = ToCoordinateStr(_messages);
AutoholdLabel.Text = ToCoordinateStr(_autohold);
}
private string ToCoordinateStr(MessagePosition position)
{
return $"{position.X}, {position.Y}";
}
private void ResetDefaultsButton_Click(object sender, EventArgs e)
{
_fps = _config.Fps = DefaultMessagePositions.Fps.Clone();
_frameCounter = _config.FrameCounter = DefaultMessagePositions.FrameCounter.Clone();
_lagCounter = _config.LagCounter = DefaultMessagePositions.LagCounter.Clone();
_inputDisplay = _config.InputDisplay = DefaultMessagePositions.InputDisplay.Clone();
_reRecordCounter = _config.ReRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone();
_messages = _config.Messages = DefaultMessagePositions.Messages.Clone();
_autohold = _config.Autohold = DefaultMessagePositions.Autohold.Clone();
_ramWatches = _config.RamWatches = DefaultMessagePositions.RamWatches.Clone();
_messageColor = _config.MessagesColor = DefaultMessagePositions.MessagesColor;
_alertColor = _config.AlertMessageColor = DefaultMessagePositions.AlertMessageColor;
_lastInputColor = _config.LastInputColor = DefaultMessagePositions.LastInputColor;
_movieInput = _config.MovieInput = DefaultMessagePositions.MovieInput;
MessageColorDialog.Color = Color.FromArgb(_messageColor);
AlertColorDialog.Color = Color.FromArgb(_alertColor);
LInputColorDialog.Color = Color.FromArgb(_lastInputColor);
MovieInputColorDialog.Color = Color.FromArgb(_movieInput);
SetMaxXy();
SetColorBox();
SetPositionInfo();
StackMessagesCheckbox.Checked = _config.StackOSDMessages = true;
}
private void SetAnchorValue(MessagePosition.AnchorType value)
{
if (FPSRadio.Checked)
{
_fps.Anchor = value;
}
else if (FrameCounterRadio.Checked)
{
_frameCounter.Anchor = value;
}
else if (LagCounterRadio.Checked)
{
_lagCounter.Anchor = value;
}
else if (InputDisplayRadio.Checked)
{
_inputDisplay.Anchor = value;
}
else if (WatchesRadio.Checked)
{
_ramWatches.Anchor = value;
}
else if (MessagesRadio.Checked)
{
_messages.Anchor = value;
}
else if (RerecordsRadio.Checked)
{
_reRecordCounter.Anchor = value;
}
else if (AutoholdRadio.Checked)
{
_autohold.Anchor = value;
}
}
private void TL_CheckedChanged(object sender, EventArgs e)
{
if (TL.Checked)
{
SetAnchorValue(MessagePosition.AnchorType.TopLeft);
}
PositionPanel.Refresh();
}
private void TR_CheckedChanged(object sender, EventArgs e)
{
if (TR.Checked)
{
SetAnchorValue(MessagePosition.AnchorType.TopRight);
}
PositionPanel.Refresh();
}
private void BL_CheckedChanged(object sender, EventArgs e)
{
if (BL.Checked)
{
SetAnchorValue(MessagePosition.AnchorType.BottomLeft);
}
PositionPanel.Refresh();
}
private void BR_CheckedChanged(object sender, EventArgs e)
{
if (BR.Checked)
{
SetAnchorValue(MessagePosition.AnchorType.BottomRight);
}
PositionPanel.Refresh();
}
private void XNumeric_Changed(object sender, EventArgs e)
{
if (!_programmaticallyChangingValues)
{
_px = (int)XNumeric.Value;
SetPositionLabels();
PositionPanel.Refresh();
}
}
private void YNumeric_Changed(object sender, EventArgs e)
{
if (!_programmaticallyChangingValues)
{
_py = (int)YNumeric.Value;
SetPositionLabels();
PositionPanel.Refresh();
}
}
private void ColorPanel_Click(object sender, EventArgs e)
{
if (MessageColorDialog.ShowDialog().IsOk())
{
SetColorBox();
}
}
private void AlertColorPanel_Click(object sender, EventArgs e)
{
if (AlertColorDialog.ShowDialog().IsOk())
{
SetColorBox();
}
}
private void LInputColorPanel_Click(object sender, EventArgs e)
{
if (LInputColorDialog.ShowDialog().IsOk())
{
SetColorBox();
}
}
private void MovieInputColor_Click(object sender, EventArgs e)
{
if (MovieInputColorDialog.ShowDialog().IsOk())
{
SetColorBox();
}
}
}
}

View File

@ -0,0 +1,95 @@
namespace BizHawk.Client.EmuHawk
{
partial class ColorRow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DisplayNameLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.ColorPanel = new System.Windows.Forms.Panel();
this.HexLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.ColorText = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// DisplayNameLabel
//
this.DisplayNameLabel.Location = new System.Drawing.Point(3, 0);
this.DisplayNameLabel.Name = "DisplayNameLabel";
this.DisplayNameLabel.Text = "Messages";
//
// ColorPanel
//
this.ColorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ColorPanel.Location = new System.Drawing.Point(6, 16);
this.ColorPanel.Name = "ColorPanel";
this.ColorPanel.Size = new System.Drawing.Size(46, 20);
this.ColorPanel.TabIndex = 8;
this.ColorPanel.Click += new System.EventHandler(this.ColorPanel_Click);
//
// HexLabel
//
this.HexLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.HexLabel.Location = new System.Drawing.Point(55, 20);
this.HexLabel.Margin = new System.Windows.Forms.Padding(0);
this.HexLabel.Name = "HexLabel";
this.HexLabel.Text = "0x";
//
// ColorText
//
this.ColorText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ColorText.Location = new System.Drawing.Point(75, 16);
this.ColorText.MaxLength = 8;
this.ColorText.Name = "ColorText";
this.ColorText.ReadOnly = true;
this.ColorText.Size = new System.Drawing.Size(59, 20);
this.ColorText.TabIndex = 11;
//
// ColorRow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.ColorText);
this.Controls.Add(this.HexLabel);
this.Controls.Add(this.ColorPanel);
this.Controls.Add(this.DisplayNameLabel);
this.Name = "ColorRow";
this.Size = new System.Drawing.Size(143, 41);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private WinForms.Controls.LocLabelEx DisplayNameLabel;
private System.Windows.Forms.Panel ColorPanel;
private WinForms.Controls.LocLabelEx HexLabel;
private System.Windows.Forms.TextBox ColorText;
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class ColorRow : UserControl
{
private int _selectedColor;
public int SelectedColor
{
get => _selectedColor;
set
{
_selectedColor = value;
SetColor();
}
}
public string DisplayName
{
get => DisplayNameLabel.Text;
set => DisplayNameLabel.Text = value;
}
public ColorRow()
{
InitializeComponent();
}
private void SetColor()
{
ColorPanel.BackColor = Color.FromArgb(_selectedColor);
ColorText.Text = $"{SelectedColor:X8}";
}
private void ColorPanel_Click(object sender, EventArgs e)
{
using var colorPicker = new ColorDialog
{
FullOpen = true, Color = Color.FromArgb(_selectedColor)
};
if (colorPicker.ShowDialog().IsOk())
{
_selectedColor = colorPicker.Color.ToArgb();
SetColor();
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,144 @@
namespace BizHawk.Client.EmuHawk
{
partial class MessageConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.OK = new System.Windows.Forms.Button();
this.MessageTypeBox = new BizHawk.WinForms.Controls.LocSzGroupBoxEx();
this.ColorBox = new BizHawk.WinForms.Controls.LocSzGroupBoxEx();
this.Cancel = new System.Windows.Forms.Button();
this.ResetDefaultsButton = new System.Windows.Forms.Button();
this.StackMessagesCheckbox = new System.Windows.Forms.CheckBox();
this.MessageEditor = new BizHawk.Client.EmuHawk.MessageEdit();
this.SuspendLayout();
//
// OK
//
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.OK.Location = new System.Drawing.Point(348, 418);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 1;
this.OK.Text = "&OK";
this.OK.UseVisualStyleBackColor = true;
this.OK.Click += new System.EventHandler(this.Ok_Click);
//
// MessageTypeBox
//
this.MessageTypeBox.Location = new System.Drawing.Point(12, 12);
this.MessageTypeBox.Name = "MessageTypeBox";
this.MessageTypeBox.Size = new System.Drawing.Size(177, 211);
this.MessageTypeBox.Text = "Message Type";
//
// ColorBox
//
this.ColorBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ColorBox.Location = new System.Drawing.Point(12, 231);
this.ColorBox.Name = "ColorBox";
this.ColorBox.Size = new System.Drawing.Size(177, 210);
this.ColorBox.Text = "Message Colors";
//
// Cancel
//
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(429, 418);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 5;
this.Cancel.Text = "&Cancel";
this.Cancel.UseVisualStyleBackColor = true;
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
//
// ResetDefaultsButton
//
this.ResetDefaultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ResetDefaultsButton.Location = new System.Drawing.Point(195, 418);
this.ResetDefaultsButton.Name = "ResetDefaultsButton";
this.ResetDefaultsButton.Size = new System.Drawing.Size(96, 23);
this.ResetDefaultsButton.TabIndex = 6;
this.ResetDefaultsButton.Text = "Restore Defaults";
this.ResetDefaultsButton.UseVisualStyleBackColor = true;
this.ResetDefaultsButton.Click += new System.EventHandler(this.ResetDefaultsButton_Click);
//
// StackMessagesCheckbox
//
this.StackMessagesCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.StackMessagesCheckbox.AutoSize = true;
this.StackMessagesCheckbox.Location = new System.Drawing.Point(195, 388);
this.StackMessagesCheckbox.Name = "StackMessagesCheckbox";
this.StackMessagesCheckbox.Size = new System.Drawing.Size(105, 17);
this.StackMessagesCheckbox.TabIndex = 7;
this.StackMessagesCheckbox.Text = "Stack Messages";
this.StackMessagesCheckbox.UseVisualStyleBackColor = true;
//
// MessageEditor
//
this.MessageEditor.Location = new System.Drawing.Point(195, 12);
this.MessageEditor.Name = "MessageEditor";
this.MessageEditor.Size = new System.Drawing.Size(310, 256);
this.MessageEditor.TabIndex = 8;
//
// MessageConfig
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(512, 446);
this.Controls.Add(this.MessageEditor);
this.Controls.Add(this.StackMessagesCheckbox);
this.Controls.Add(this.ResetDefaultsButton);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.ColorBox);
this.Controls.Add(this.MessageTypeBox);
this.Controls.Add(this.OK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MinimumSize = new System.Drawing.Size(404, 375);
this.Name = "MessageConfig";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configure On Screen Messages";
this.Load += new System.EventHandler(this.MessageConfig_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button OK;
private BizHawk.WinForms.Controls.LocSzGroupBoxEx MessageTypeBox;
private BizHawk.WinForms.Controls.LocSzGroupBoxEx ColorBox;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Button ResetDefaultsButton;
private System.Windows.Forms.CheckBox StackMessagesCheckbox;
private MessageEdit MessageEditor;
}
}

View File

@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class MessageConfig : Form
{
private readonly Config _config;
private MessagePosition _fps;
private MessagePosition _frameCounter;
private MessagePosition _lagCounter;
private MessagePosition _inputDisplay;
private MessagePosition _reRecordCounter;
private MessagePosition _messages;
private MessagePosition _autohold;
private MessagePosition _ramWatches;
private Dictionary<string, MessagePosition> Positions => new Dictionary<string, MessagePosition>
{
["Fps"] = _fps,
["Frame Counter"] = _frameCounter,
["Lag Counter"] = _lagCounter,
["Input Display"] = _inputDisplay,
["Watches"] = _ramWatches,
["Messages"] = _messages,
["Rerecords"] = _reRecordCounter,
["Autohold"] = _autohold
};
private Dictionary<string, int> Colors => new Dictionary<string, int>
{
["Main Messages"] = _config.MessagesColor,
["Alert Messages"] = _config.AlertMessageColor,
["Previous Frame Input"] = _config.LastInputColor,
["Movie Input"] = _config.MovieInput
};
private IEnumerable<ColorRow> ColorRows => ColorBox.Controls.OfType<ColorRow>();
public MessageConfig(Config config)
{
_config = config;
_fps = _config.Fps.Clone();
_frameCounter = _config.FrameCounter.Clone();
_lagCounter = _config.LagCounter.Clone();
_inputDisplay = _config.InputDisplay.Clone();
_reRecordCounter = _config.ReRecordCounter.Clone();
_messages = _config.Messages.Clone();
_autohold = _config.Autohold.Clone();
_ramWatches = _config.RamWatches.Clone();
InitializeComponent();
}
private void MessageConfig_Load(object sender, EventArgs e)
{
CreateMessageRows();
CreateColorBoxes();
StackMessagesCheckbox.Checked = _config.StackOSDMessages;
}
private void CreateMessageRows()
{
void SetMessagePosition(MessageRow row, MessagePosition position)
{
MessageTypeBox.Controls
.OfType<MessageRow>()
.ToList()
.ForEach(m => m.Checked = false);
row.Checked = true;
MessageEditor.Bind(position, () => { row.SetText(); });
}
MessageTypeBox.Controls.Clear();
int y = 12;
foreach (var position in Positions)
{
var row = new MessageRow
{
Name = position.Key,
Location = new Point(10, y)
};
row.Size = new Size(MessageTypeBox.Width - 12, row.Size.Height);
row.Bind(position.Key, position.Value, (e) => { SetMessagePosition(row, e); });
if (position.Value == _fps)
{
row.Checked = true;
MessageEditor.Bind(position.Value, () => { row.SetText(); });
}
y += row.Size.Height;
MessageTypeBox.Controls.Add(row);
}
}
private void CreateColorBoxes()
{
ColorBox.Controls.Clear();
int y = 20;
foreach (var color in Colors)
{
var row = new ColorRow
{
Name = color.Key,
Location = new Point(10, y),
DisplayName = color.Key,
SelectedColor = color.Value
};
row.Size = new Size(ColorBox.Width - 12, row.Size.Height);
y += row.Size.Height;
ColorBox.Controls.Add(row);
}
}
private void Ok_Click(object sender, EventArgs e)
{
_config.Fps = _fps;
_config.FrameCounter = _frameCounter;
_config.LagCounter = _lagCounter;
_config.InputDisplay = _inputDisplay;
_config.ReRecordCounter = _reRecordCounter;
_config.Messages = _messages;
_config.Autohold = _autohold;
_config.RamWatches = _ramWatches;
_config.MessagesColor = ColorRows.Single(r => r.Name == "Main Messages").SelectedColor;
_config.AlertMessageColor = ColorRows.Single(r => r.Name == "Alert Messages").SelectedColor;
_config.LastInputColor = ColorRows.Single(r => r.Name == "Previous Frame Input").SelectedColor;
_config.MovieInput = ColorRows.Single(r => r.Name == "Movie Input").SelectedColor;
_config.StackOSDMessages = StackMessagesCheckbox.Checked;
Close();
}
private void Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void ResetDefaultsButton_Click(object sender, EventArgs e)
{
_fps = DefaultMessagePositions.Fps.Clone();
_frameCounter = DefaultMessagePositions.FrameCounter.Clone();
_lagCounter = DefaultMessagePositions.LagCounter.Clone();
_inputDisplay = DefaultMessagePositions.InputDisplay.Clone();
_reRecordCounter = DefaultMessagePositions.ReRecordCounter.Clone();
_messages = DefaultMessagePositions.Messages.Clone();
_autohold = DefaultMessagePositions.Autohold.Clone();
_ramWatches = DefaultMessagePositions.RamWatches.Clone();
ColorRows.Single(r => r.Name == "Main Messages").SelectedColor = DefaultMessagePositions.MessagesColor;
ColorRows.Single(r => r.Name == "Alert Messages").SelectedColor = DefaultMessagePositions.AlertMessageColor;
ColorRows.Single(r => r.Name == "Previous Frame Input").SelectedColor = DefaultMessagePositions.LastInputColor;
ColorRows.Single(r => r.Name == "Movie Input").SelectedColor = DefaultMessagePositions.MovieInput;
CreateMessageRows();
StackMessagesCheckbox.Checked = true;
}
}
}

View File

@ -1,132 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="MessageColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="AlertColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>168, 17</value>
</metadata>
<metadata name="LInputColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>299, 17</value>
</metadata>
<metadata name="MovieInputColorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>577, 17</value>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,211 @@
namespace BizHawk.Client.EmuHawk
{
partial class MessageEdit
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.PositionGroupBox = new System.Windows.Forms.GroupBox();
this.BR = new System.Windows.Forms.RadioButton();
this.BL = new System.Windows.Forms.RadioButton();
this.TR = new System.Windows.Forms.RadioButton();
this.TL = new System.Windows.Forms.RadioButton();
this.YNumeric = new System.Windows.Forms.NumericUpDown();
this.XNumeric = new System.Windows.Forms.NumericUpDown();
this.PositionPanel = new System.Windows.Forms.Panel();
this.label2 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label1 = new BizHawk.WinForms.Controls.LocLabelEx();
this.PositionGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.YNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.XNumeric)).BeginInit();
this.SuspendLayout();
//
// PositionGroupBox
//
this.PositionGroupBox.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.PositionGroupBox.Controls.Add(this.BR);
this.PositionGroupBox.Controls.Add(this.BL);
this.PositionGroupBox.Controls.Add(this.TR);
this.PositionGroupBox.Controls.Add(this.TL);
this.PositionGroupBox.Controls.Add(this.label2);
this.PositionGroupBox.Controls.Add(this.label1);
this.PositionGroupBox.Controls.Add(this.YNumeric);
this.PositionGroupBox.Controls.Add(this.XNumeric);
this.PositionGroupBox.Controls.Add(this.PositionPanel);
this.PositionGroupBox.Location = new System.Drawing.Point(3, 3);
this.PositionGroupBox.Name = "PositionGroupBox";
this.PositionGroupBox.Size = new System.Drawing.Size(299, 245);
this.PositionGroupBox.TabIndex = 4;
this.PositionGroupBox.TabStop = false;
this.PositionGroupBox.Text = "Position";
//
// BR
//
this.BR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.BR.AutoSize = true;
this.BR.Location = new System.Drawing.Point(281, 199);
this.BR.Name = "BR";
this.BR.Size = new System.Drawing.Size(14, 13);
this.BR.TabIndex = 8;
this.BR.TabStop = true;
this.BR.UseVisualStyleBackColor = true;
this.BR.CheckedChanged += new System.EventHandler(this.BR_CheckedChanged);
//
// BL
//
this.BL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BL.AutoSize = true;
this.BL.Location = new System.Drawing.Point(6, 199);
this.BL.Name = "BL";
this.BL.Size = new System.Drawing.Size(14, 13);
this.BL.TabIndex = 7;
this.BL.TabStop = true;
this.BL.UseVisualStyleBackColor = true;
this.BL.CheckedChanged += new System.EventHandler(this.BL_CheckedChanged);
//
// TR
//
this.TR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.TR.AutoSize = true;
this.TR.Location = new System.Drawing.Point(280, 18);
this.TR.Name = "TR";
this.TR.Size = new System.Drawing.Size(14, 13);
this.TR.TabIndex = 6;
this.TR.TabStop = true;
this.TR.UseVisualStyleBackColor = true;
this.TR.CheckedChanged += new System.EventHandler(this.TR_CheckedChanged);
//
// TL
//
this.TL.AutoSize = true;
this.TL.Location = new System.Drawing.Point(6, 18);
this.TL.Name = "TL";
this.TL.Size = new System.Drawing.Size(14, 13);
this.TL.TabIndex = 5;
this.TL.TabStop = true;
this.TL.UseVisualStyleBackColor = true;
this.TL.CheckedChanged += new System.EventHandler(this.TL_CheckedChanged);
//
// YNumeric
//
this.YNumeric.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.YNumeric.Location = new System.Drawing.Point(106, 217);
this.YNumeric.Maximum = new decimal(new int[] {
180,
0,
0,
0});
this.YNumeric.Name = "YNumeric";
this.YNumeric.Size = new System.Drawing.Size(44, 20);
this.YNumeric.TabIndex = 2;
this.YNumeric.Value = new decimal(new int[] {
180,
0,
0,
0});
this.YNumeric.ValueChanged += new System.EventHandler(this.YNumeric_ValueChanged);
//
// XNumeric
//
this.XNumeric.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.XNumeric.Location = new System.Drawing.Point(43, 217);
this.XNumeric.Maximum = new decimal(new int[] {
244,
0,
0,
0});
this.XNumeric.Name = "XNumeric";
this.XNumeric.Size = new System.Drawing.Size(44, 20);
this.XNumeric.TabIndex = 1;
this.XNumeric.Value = new decimal(new int[] {
244,
0,
0,
0});
this.XNumeric.ValueChanged += new System.EventHandler(this.XNumeric_ValueChanged);
//
// PositionPanel
//
this.PositionPanel.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.PositionPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.PositionPanel.Location = new System.Drawing.Point(22, 18);
this.PositionPanel.Name = "PositionPanel";
this.PositionPanel.Size = new System.Drawing.Size(256, 192);
this.PositionPanel.TabIndex = 0;
this.PositionPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.PositionPanel_Paint);
this.PositionPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseDown);
this.PositionPanel.MouseEnter += new System.EventHandler(this.PositionPanel_MouseEnter);
this.PositionPanel.MouseLeave += new System.EventHandler(this.PositionPanel_MouseLeave);
this.PositionPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseMove);
this.PositionPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseUp);
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.Location = new System.Drawing.Point(92, 219);
this.label2.Name = "label2";
this.label2.Text = "y";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.Location = new System.Drawing.Point(27, 220);
this.label1.Name = "label1";
this.label1.Text = "x";
//
// MessageEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.PositionGroupBox);
this.Name = "MessageEdit";
this.Size = new System.Drawing.Size(310, 256);
this.PositionGroupBox.ResumeLayout(false);
this.PositionGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.YNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.XNumeric)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox PositionGroupBox;
private System.Windows.Forms.RadioButton BR;
private System.Windows.Forms.RadioButton BL;
private System.Windows.Forms.RadioButton TR;
private System.Windows.Forms.RadioButton TL;
private WinForms.Controls.LocLabelEx label2;
private WinForms.Controls.LocLabelEx label1;
private System.Windows.Forms.NumericUpDown YNumeric;
private System.Windows.Forms.NumericUpDown XNumeric;
private System.Windows.Forms.Panel PositionPanel;
}
}

View File

@ -0,0 +1,212 @@
using BizHawk.Client.Common;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class MessageEdit : UserControl
{
private MessagePosition _messagePosition = new MessagePosition();
private Action _changeCallback;
private bool _programmaticallyChangingValues;
private bool _mousedown;
public MessageEdit()
{
InitializeComponent();
}
public void Bind(MessagePosition position, Action changeCallback)
{
_messagePosition = position;
_changeCallback = changeCallback;
_programmaticallyChangingValues = true;
XNumeric.Value = position.X;
YNumeric.Value = position.Y;
switch (position.Anchor)
{
default:
case MessagePosition.AnchorType.TopLeft:
TL.Checked = true;
break;
case MessagePosition.AnchorType.TopRight:
TR.Checked = true;
break;
case MessagePosition.AnchorType.BottomLeft:
BL.Checked = true;
break;
case MessagePosition.AnchorType.BottomRight:
BR.Checked = true;
break;
}
_programmaticallyChangingValues = false;
PositionGroupBox.Refresh();
}
private void TL_CheckedChanged(object sender, EventArgs e)
{
if (TL.Checked)
{
SetAnchor(MessagePosition.AnchorType.TopLeft);
}
PositionPanel.Refresh();
}
private void BL_CheckedChanged(object sender, EventArgs e)
{
if (BL.Checked)
{
SetAnchor(MessagePosition.AnchorType.BottomLeft);
}
PositionPanel.Refresh();
}
private void TR_CheckedChanged(object sender, EventArgs e)
{
if (TR.Checked)
{
SetAnchor(MessagePosition.AnchorType.TopRight);
}
PositionPanel.Refresh();
}
private void BR_CheckedChanged(object sender, EventArgs e)
{
if (BR.Checked)
{
SetAnchor(MessagePosition.AnchorType.BottomRight);
}
PositionPanel.Refresh();
}
private void XNumeric_ValueChanged(object sender, EventArgs e)
{
if (!_programmaticallyChangingValues)
{
_messagePosition.X = (int)XNumeric.Value;
PositionPanel.Refresh();
}
}
private void YNumeric_ValueChanged(object sender, EventArgs e)
{
if (!_programmaticallyChangingValues)
{
_messagePosition.Y = (int)YNumeric.Value;
PositionPanel.Refresh();
}
}
private void PositionPanel_MouseDown(object sender, MouseEventArgs e)
{
Cursor = Cursors.Arrow;
_mousedown = true;
SetPosition(e.X, e.Y);
}
private void PositionPanel_MouseEnter(object sender, EventArgs e)
{
Cursor = Cursors.Hand;
}
private void PositionPanel_MouseLeave(object sender, EventArgs e)
{
Cursor = Cursors.Default;
}
private void PositionPanel_MouseMove(object sender, MouseEventArgs e)
{
if (_mousedown)
{
SetPosition(e.X, e.Y);
}
}
private void PositionPanel_MouseUp(object sender, MouseEventArgs e)
{
Cursor = Cursors.Hand;
_mousedown = false;
}
private void PositionPanel_Paint(object sender, PaintEventArgs e)
{
int x = 0;
int y = 0;
switch (_messagePosition.Anchor)
{
case MessagePosition.AnchorType.TopLeft:
x = _messagePosition.X;
y = _messagePosition.Y;
break;
case MessagePosition.AnchorType.TopRight:
x = (int)XNumeric.Maximum - _messagePosition.X;
y = _messagePosition.Y;
break;
case MessagePosition.AnchorType.BottomLeft:
x = _messagePosition.X;
y = (int)YNumeric.Maximum - _messagePosition.Y;
break;
case MessagePosition.AnchorType.BottomRight:
x = (int)XNumeric.Maximum - _messagePosition.X;
y = (int)YNumeric.Maximum - _messagePosition.Y;
break;
}
using var p = new Pen(Color.Black);
e.Graphics.DrawLine(p, new Point(x, y), new Point(x + 8, y + 8));
e.Graphics.DrawLine(p, new Point(x + 8, y), new Point(x, y + 8));
e.Graphics.DrawRectangle(p, new Rectangle(x, y, 8, 8));
}
private void SetAnchor(MessagePosition.AnchorType value)
{
_messagePosition.Anchor = value;
_changeCallback?.Invoke();
}
private void SetPosition(int mx, int my)
{
_programmaticallyChangingValues = true;
if (mx < 0) mx = 0;
if (my < 0) my = 0;
if (mx > XNumeric.Maximum) mx = (int)XNumeric.Maximum;
if (my > YNumeric.Maximum) my = (int)YNumeric.Maximum;
if (TL.Checked)
{
// Do nothing
}
else if (TR.Checked)
{
mx = (int)XNumeric.Maximum - mx;
}
else if (BL.Checked)
{
my = (int)YNumeric.Maximum - my;
}
else if (BR.Checked)
{
mx = (int)XNumeric.Maximum - mx;
my = (int)YNumeric.Maximum - my;
}
XNumeric.Value = mx;
YNumeric.Value = my;
_messagePosition.X = mx;
_messagePosition.Y = my;
_changeCallback?.Invoke();
PositionPanel.Refresh();
_programmaticallyChangingValues = false;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,67 @@
namespace BizHawk.Client.EmuHawk
{
partial class MessageRow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.RowRadio = new BizHawk.WinForms.Controls.RadioButtonEx();
this.LocationLabel = new BizHawk.WinForms.Controls.LocLabelEx();
this.SuspendLayout();
//
// RowRadio
//
this.RowRadio.Name = "RowRadio";
this.RowRadio.Text = "Frame Counter";
this.RowRadio.CheckedChanged += new System.EventHandler(this.RowRadio_CheckedChanged);
//
// LocationLabel
//
this.LocationLabel.AllowDrop = true;
this.LocationLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.LocationLabel.Location = new System.Drawing.Point(167, 7);
this.LocationLabel.Name = "LocationLabel";
this.LocationLabel.Text = "255, 255";
//
// MessageRow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.LocationLabel);
this.Controls.Add(this.RowRadio);
this.Name = "MessageRow";
this.Size = new System.Drawing.Size(224, 28);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private BizHawk.WinForms.Controls.RadioButtonEx RowRadio;
private WinForms.Controls.LocLabelEx LocationLabel;
}
}

View File

@ -0,0 +1,54 @@
using BizHawk.Client.Common;
using System;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class MessageRow : UserControl
{
private Action<MessagePosition> _selectedCallback;
private bool _programmaticallyUpdating = false;
public MessagePosition MessagePosition { get; private set; } = new MessagePosition();
public MessageRow()
{
InitializeComponent();
}
public void Bind(
string displayName,
MessagePosition position,
Action<MessagePosition> selectedCallback)
{
MessagePosition = position;
_selectedCallback = selectedCallback;
RowRadio.Text = displayName;
SetText();
}
public bool Checked
{
get => RowRadio.Checked;
set
{
_programmaticallyUpdating = true;
RowRadio.Checked = value;
_programmaticallyUpdating = false;
}
}
public void SetText()
{
LocationLabel.Text = MessagePosition.ToCoordinateStr();
}
private void RowRadio_CheckedChanged(object sender, EventArgs e)
{
if (!_programmaticallyUpdating && RowRadio.Checked)
{
_selectedCallback.Invoke(MessagePosition);
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>