diff --git a/src/BizHawk.Client.Common/config/MessagePosition.cs b/src/BizHawk.Client.Common/config/MessagePosition.cs index 3f1c0c3267..5cecd2af74 100644 --- a/src/BizHawk.Client.Common/config/MessagePosition.cs +++ b/src/BizHawk.Client.Common/config/MessagePosition.cs @@ -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 diff --git a/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index fcfbaacf81..f3b74032ba 100755 --- a/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/src/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -147,6 +147,24 @@ + + UserControl + + + ColorRow.cs + + + UserControl + + + MessageRow.cs + + + UserControl + + + MessageEdit.cs + @@ -258,9 +276,15 @@ - - - + + + + ColorRow.cs + + + MessageRow.cs + + diff --git a/src/BizHawk.Client.EmuHawk/config/MessageConfig.Designer.cs b/src/BizHawk.Client.EmuHawk/config/MessageConfig.Designer.cs deleted file mode 100644 index 3bcd92c677..0000000000 --- a/src/BizHawk.Client.EmuHawk/config/MessageConfig.Designer.cs +++ /dev/null @@ -1,692 +0,0 @@ -namespace BizHawk.Client.EmuHawk -{ - partial class MessageConfig - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/MessageConfig.cs b/src/BizHawk.Client.EmuHawk/config/MessageConfig.cs deleted file mode 100644 index 69c16df6e8..0000000000 --- a/src/BizHawk.Client.EmuHawk/config/MessageConfig.cs +++ /dev/null @@ -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(); - } - } - } -} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.Designer.cs b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.Designer.cs new file mode 100644 index 0000000000..326eb37de9 --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.Designer.cs @@ -0,0 +1,95 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class ColorRow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.cs b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.cs new file mode 100644 index 0000000000..75f9b4f73c --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.cs @@ -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(); + } + } + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.resx b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/ColorRow.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.Designer.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.Designer.cs new file mode 100644 index 0000000000..e92ec83bea --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.Designer.cs @@ -0,0 +1,144 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class MessageConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.cs new file mode 100644 index 0000000000..aaad750bd2 --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.cs @@ -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 Positions => new Dictionary + { + ["Fps"] = _fps, + ["Frame Counter"] = _frameCounter, + ["Lag Counter"] = _lagCounter, + ["Input Display"] = _inputDisplay, + ["Watches"] = _ramWatches, + ["Messages"] = _messages, + ["Rerecords"] = _reRecordCounter, + ["Autohold"] = _autohold + }; + + private Dictionary Colors => new Dictionary + { + ["Main Messages"] = _config.MessagesColor, + ["Alert Messages"] = _config.AlertMessageColor, + ["Previous Frame Input"] = _config.LastInputColor, + ["Movie Input"] = _config.MovieInput + }; + + private IEnumerable ColorRows => ColorBox.Controls.OfType(); + + 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() + .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; + } + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/MessageConfig.resx b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.resx similarity index 85% rename from src/BizHawk.Client.EmuHawk/config/MessageConfig.resx rename to src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.resx index e3d42b198e..d58980a38d 100644 --- a/src/BizHawk.Client.EmuHawk/config/MessageConfig.resx +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageConfig.resx @@ -1,132 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 168, 17 - - - 299, 17 - - - 577, 17 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.Designer.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.Designer.cs new file mode 100644 index 0000000000..973873e376 --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.Designer.cs @@ -0,0 +1,211 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class MessageEdit + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.cs new file mode 100644 index 0000000000..3e6661b57e --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.cs @@ -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; + } + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.resx b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageEdit.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.Designer.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.Designer.cs new file mode 100644 index 0000000000..fbb704d705 --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.Designer.cs @@ -0,0 +1,67 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class MessageRow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.cs b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.cs new file mode 100644 index 0000000000..06b2106014 --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.cs @@ -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 _selectedCallback; + private bool _programmaticallyUpdating = false; + + public MessagePosition MessagePosition { get; private set; } = new MessagePosition(); + + public MessageRow() + { + InitializeComponent(); + } + + public void Bind( + string displayName, + MessagePosition position, + Action 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); + } + } + } +} diff --git a/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.resx b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.resx new file mode 100644 index 0000000000..1af7de150c --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/config/Messages/MessageRow.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file