diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 8b77d31785..38715e2187 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -118,18 +118,23 @@ public bool DisplayFPS = false; public int DispFPSx = 0; public int DispFPSy = 0; + public int DispFPSanchor = 0; //0 = UL, 1 = UR, 2 = DL, 3 = DR public bool DisplayFrameCounter = false; public int DispFrameCx = 0; public int DispFrameCy = 12; + public int DispFrameanchor = 0; public bool DisplayLagCounter = false; public int DispLagx = 0; public int DispLagy = 36; + public int DispLaganchor = 0; public bool DisplayInput = false; public int DispInpx = 0; public int DispInpy = 24; + public int DispInpanchor = 0; public bool DisplayRerecordCount = false; public int DispRecx = 0; public int DispRecy = 48; + public int DispRecanchor = 0; public bool ForceGDI = false; public bool DisplayStatusBar = true; diff --git a/BizHawk.MultiClient/config/MessageConfig.Designer.cs b/BizHawk.MultiClient/config/MessageConfig.Designer.cs index 2dadb209a9..bdc7d7ac08 100644 --- a/BizHawk.MultiClient/config/MessageConfig.Designer.cs +++ b/BizHawk.MultiClient/config/MessageConfig.Designer.cs @@ -28,522 +28,577 @@ /// private void InitializeComponent() { - this.OK = new System.Windows.Forms.Button(); - this.MessageTypeBox = new System.Windows.Forms.GroupBox(); - this.MessLabel = new System.Windows.Forms.Label(); - this.InpLabel = new System.Windows.Forms.Label(); - this.LagLabel = new System.Windows.Forms.Label(); - this.FCLabel = new System.Windows.Forms.Label(); - this.FpsPosLabel = new System.Windows.Forms.Label(); - 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.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.LInputText = new System.Windows.Forms.TextBox(); - this.ChangeLInput = new System.Windows.Forms.Button(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.LInputColorPanel = new System.Windows.Forms.Panel(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.AlertColorText = new System.Windows.Forms.TextBox(); - this.ChangeAlertColor = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.AlertColorPanel = new System.Windows.Forms.Panel(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.ColorText = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.MessageColorBox = new System.Windows.Forms.GroupBox(); - this.ColorPanel = new System.Windows.Forms.Panel(); - 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 System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.PositionGroupBox = new System.Windows.Forms.GroupBox(); - this.AlertColorDialog = new System.Windows.Forms.ColorDialog(); - this.LInputColorDialog = new System.Windows.Forms.ColorDialog(); - this.MessageTypeBox.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.MessageColorBox.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(340, 371); - 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.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, 139); - this.MessageTypeBox.TabIndex = 2; - this.MessageTypeBox.TabStop = false; - this.MessageTypeBox.Text = "Message Type"; - // - // MessLabel - // - this.MessLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.MessLabel.AutoSize = true; - this.MessLabel.Location = new System.Drawing.Point(126, 116); - this.MessLabel.Name = "MessLabel"; - this.MessLabel.Size = new System.Drawing.Size(49, 13); - this.MessLabel.TabIndex = 9; - this.MessLabel.Text = "255, 255"; - // - // InpLabel - // - this.InpLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.InpLabel.AutoSize = true; - this.InpLabel.Location = new System.Drawing.Point(126, 92); - this.InpLabel.Name = "InpLabel"; - this.InpLabel.Size = new System.Drawing.Size(49, 13); - this.InpLabel.TabIndex = 8; - this.InpLabel.Text = "255, 255"; - // - // LagLabel - // - this.LagLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.LagLabel.AutoSize = true; - this.LagLabel.Location = new System.Drawing.Point(126, 68); - this.LagLabel.Name = "LagLabel"; - this.LagLabel.Size = new System.Drawing.Size(49, 13); - this.LagLabel.TabIndex = 7; - this.LagLabel.Text = "255, 255"; - // - // FCLabel - // - this.FCLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.FCLabel.AutoSize = true; - this.FCLabel.Location = new System.Drawing.Point(126, 44); - this.FCLabel.Name = "FCLabel"; - this.FCLabel.Size = new System.Drawing.Size(49, 13); - this.FCLabel.TabIndex = 6; - this.FCLabel.Text = "255, 255"; - // - // FpsPosLabel - // - this.FpsPosLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.FpsPosLabel.AutoSize = true; - this.FpsPosLabel.Location = new System.Drawing.Point(126, 20); - this.FpsPosLabel.Name = "FpsPosLabel"; - this.FpsPosLabel.Size = new System.Drawing.Size(49, 13); - this.FpsPosLabel.TabIndex = 5; - this.FpsPosLabel.Text = "255, 255"; - // - // MessagesRadio - // - this.MessagesRadio.AutoSize = true; - this.MessagesRadio.Enabled = false; - this.MessagesRadio.Location = new System.Drawing.Point(6, 114); - 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.MessagesRadio_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.InputDisplayRadio_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.LagCounterRadio_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.FrameCounterRadio_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.FPSRadio_CheckedChanged); - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.label7); - this.groupBox2.Controls.Add(this.label8); - this.groupBox2.Controls.Add(this.LInputText); - this.groupBox2.Controls.Add(this.ChangeLInput); - this.groupBox2.Controls.Add(this.groupBox3); - this.groupBox2.Controls.Add(this.label6); - this.groupBox2.Controls.Add(this.label5); - this.groupBox2.Controls.Add(this.AlertColorText); - this.groupBox2.Controls.Add(this.ChangeAlertColor); - this.groupBox2.Controls.Add(this.groupBox1); - this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Controls.Add(this.label3); - this.groupBox2.Controls.Add(this.ColorText); - this.groupBox2.Controls.Add(this.button1); - this.groupBox2.Controls.Add(this.MessageColorBox); - this.groupBox2.Location = new System.Drawing.Point(12, 173); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(177, 192); - this.groupBox2.TabIndex = 4; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Message Colors"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(1, 120); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(86, 13); - this.label7.TabIndex = 18; - this.label7.Text = "Last Frame Input"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(28, 142); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(18, 13); - this.label8.TabIndex = 17; - this.label8.Text = "0x"; - // - // LInputText - // - this.LInputText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; - this.LInputText.Location = new System.Drawing.Point(45, 139); - 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; - // - // ChangeLInput - // - this.ChangeLInput.Location = new System.Drawing.Point(110, 136); - this.ChangeLInput.Name = "ChangeLInput"; - this.ChangeLInput.Size = new System.Drawing.Size(52, 23); - this.ChangeLInput.TabIndex = 15; - this.ChangeLInput.Text = "Change"; - this.ChangeLInput.UseVisualStyleBackColor = true; - this.ChangeLInput.Click += new System.EventHandler(this.ChangeLInput_Click); - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.LInputColorPanel); - this.groupBox3.Location = new System.Drawing.Point(1, 131); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(28, 28); - this.groupBox3.TabIndex = 14; - this.groupBox3.TabStop = false; - // - // LInputColorPanel - // - this.LInputColorPanel.Location = new System.Drawing.Point(4, 8); - this.LInputColorPanel.Name = "LInputColorPanel"; - this.LInputColorPanel.Size = new System.Drawing.Size(20, 16); - this.LInputColorPanel.TabIndex = 7; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(1, 71); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(78, 13); - this.label6.TabIndex = 13; - this.label6.Text = "Alert messages"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(28, 93); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(18, 13); - this.label5.TabIndex = 12; - this.label5.Text = "0x"; - // - // AlertColorText - // - this.AlertColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; - this.AlertColorText.Location = new System.Drawing.Point(45, 90); - 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; - // - // ChangeAlertColor - // - this.ChangeAlertColor.Location = new System.Drawing.Point(110, 87); - this.ChangeAlertColor.Name = "ChangeAlertColor"; - this.ChangeAlertColor.Size = new System.Drawing.Size(52, 23); - this.ChangeAlertColor.TabIndex = 10; - this.ChangeAlertColor.Text = "Change"; - this.ChangeAlertColor.UseVisualStyleBackColor = true; - this.ChangeAlertColor.Click += new System.EventHandler(this.ChangeAlertColor_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.AlertColorPanel); - this.groupBox1.Location = new System.Drawing.Point(1, 82); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(28, 28); - this.groupBox1.TabIndex = 9; - this.groupBox1.TabStop = false; - // - // AlertColorPanel - // - this.AlertColorPanel.Location = new System.Drawing.Point(4, 8); - this.AlertColorPanel.Name = "AlertColorPanel"; - this.AlertColorPanel.Size = new System.Drawing.Size(20, 16); - this.AlertColorPanel.TabIndex = 7; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(1, 24); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(80, 13); - this.label4.TabIndex = 8; - this.label4.Text = "Main messages"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(28, 46); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(18, 13); - this.label3.TabIndex = 7; - this.label3.Text = "0x"; - // - // ColorText - // - this.ColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; - this.ColorText.Location = new System.Drawing.Point(45, 43); - 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; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(110, 40); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(52, 23); - this.button1.TabIndex = 1; - this.button1.Text = "Change"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // MessageColorBox - // - this.MessageColorBox.Controls.Add(this.ColorPanel); - this.MessageColorBox.Location = new System.Drawing.Point(1, 35); - this.MessageColorBox.Name = "MessageColorBox"; - this.MessageColorBox.Size = new System.Drawing.Size(28, 28); - this.MessageColorBox.TabIndex = 0; - this.MessageColorBox.TabStop = false; - // - // ColorPanel - // - this.ColorPanel.Location = new System.Drawing.Point(4, 8); - this.ColorPanel.Name = "ColorPanel"; - this.ColorPanel.Size = new System.Drawing.Size(20, 16); - this.ColorPanel.TabIndex = 7; - this.ColorPanel.DoubleClick += new System.EventHandler(this.ColorPanel_DoubleClick); - // - // 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(421, 371); - 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(12, 371); - 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(16, 18); - this.PositionPanel.Name = "PositionPanel"; - this.PositionPanel.Size = new System.Drawing.Size(264, 248); - this.PositionPanel.TabIndex = 0; - this.PositionPanel.MouseLeave += new System.EventHandler(this.PositionPanel_MouseLeave); - this.PositionPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.PositionPanel_Paint); - this.PositionPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseMove); - this.PositionPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseDown); - this.PositionPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseUp); - this.PositionPanel.MouseEnter += new System.EventHandler(this.PositionPanel_MouseEnter); - // - // 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(28, 271); - this.XNumeric.Maximum = new decimal(new int[] { + this.OK = new System.Windows.Forms.Button(); + this.MessageTypeBox = new System.Windows.Forms.GroupBox(); + this.MessLabel = new System.Windows.Forms.Label(); + this.InpLabel = new System.Windows.Forms.Label(); + this.LagLabel = new System.Windows.Forms.Label(); + this.FCLabel = new System.Windows.Forms.Label(); + this.FpsPosLabel = new System.Windows.Forms.Label(); + 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.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.LInputText = new System.Windows.Forms.TextBox(); + this.ChangeLInput = new System.Windows.Forms.Button(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.LInputColorPanel = new System.Windows.Forms.Panel(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.AlertColorText = new System.Windows.Forms.TextBox(); + this.ChangeAlertColor = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.AlertColorPanel = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.ColorText = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.MessageColorBox = new System.Windows.Forms.GroupBox(); + this.ColorPanel = new System.Windows.Forms.Panel(); + 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 System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + 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.MessageTypeBox.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.MessageColorBox.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(418, 371); + 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.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, 139); + this.MessageTypeBox.TabIndex = 2; + this.MessageTypeBox.TabStop = false; + this.MessageTypeBox.Text = "Message Type"; + // + // MessLabel + // + this.MessLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.MessLabel.AutoSize = true; + this.MessLabel.Location = new System.Drawing.Point(126, 116); + this.MessLabel.Name = "MessLabel"; + this.MessLabel.Size = new System.Drawing.Size(49, 13); + this.MessLabel.TabIndex = 9; + this.MessLabel.Text = "255, 255"; + // + // InpLabel + // + this.InpLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.InpLabel.AutoSize = true; + this.InpLabel.Location = new System.Drawing.Point(126, 92); + this.InpLabel.Name = "InpLabel"; + this.InpLabel.Size = new System.Drawing.Size(49, 13); + this.InpLabel.TabIndex = 8; + this.InpLabel.Text = "255, 255"; + // + // LagLabel + // + this.LagLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.LagLabel.AutoSize = true; + this.LagLabel.Location = new System.Drawing.Point(126, 68); + this.LagLabel.Name = "LagLabel"; + this.LagLabel.Size = new System.Drawing.Size(49, 13); + this.LagLabel.TabIndex = 7; + this.LagLabel.Text = "255, 255"; + // + // FCLabel + // + this.FCLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.FCLabel.AutoSize = true; + this.FCLabel.Location = new System.Drawing.Point(126, 44); + this.FCLabel.Name = "FCLabel"; + this.FCLabel.Size = new System.Drawing.Size(49, 13); + this.FCLabel.TabIndex = 6; + this.FCLabel.Text = "255, 255"; + // + // FpsPosLabel + // + this.FpsPosLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.FpsPosLabel.AutoSize = true; + this.FpsPosLabel.Location = new System.Drawing.Point(126, 20); + this.FpsPosLabel.Name = "FpsPosLabel"; + this.FpsPosLabel.Size = new System.Drawing.Size(49, 13); + this.FpsPosLabel.TabIndex = 5; + this.FpsPosLabel.Text = "255, 255"; + // + // MessagesRadio + // + this.MessagesRadio.AutoSize = true; + this.MessagesRadio.Enabled = false; + this.MessagesRadio.Location = new System.Drawing.Point(6, 114); + 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.MessagesRadio_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.InputDisplayRadio_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.LagCounterRadio_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.FrameCounterRadio_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.FPSRadio_CheckedChanged); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.LInputText); + this.groupBox2.Controls.Add(this.ChangeLInput); + this.groupBox2.Controls.Add(this.groupBox3); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.AlertColorText); + this.groupBox2.Controls.Add(this.ChangeAlertColor); + this.groupBox2.Controls.Add(this.groupBox1); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.ColorText); + this.groupBox2.Controls.Add(this.button1); + this.groupBox2.Controls.Add(this.MessageColorBox); + this.groupBox2.Location = new System.Drawing.Point(12, 173); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(177, 192); + this.groupBox2.TabIndex = 4; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Message Colors"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(1, 120); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(86, 13); + this.label7.TabIndex = 18; + this.label7.Text = "Last Frame Input"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(28, 142); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(18, 13); + this.label8.TabIndex = 17; + this.label8.Text = "0x"; + // + // LInputText + // + this.LInputText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; + this.LInputText.Location = new System.Drawing.Point(45, 139); + 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; + // + // ChangeLInput + // + this.ChangeLInput.Location = new System.Drawing.Point(110, 136); + this.ChangeLInput.Name = "ChangeLInput"; + this.ChangeLInput.Size = new System.Drawing.Size(52, 23); + this.ChangeLInput.TabIndex = 15; + this.ChangeLInput.Text = "Change"; + this.ChangeLInput.UseVisualStyleBackColor = true; + this.ChangeLInput.Click += new System.EventHandler(this.ChangeLInput_Click); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.LInputColorPanel); + this.groupBox3.Location = new System.Drawing.Point(1, 131); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(28, 28); + this.groupBox3.TabIndex = 14; + this.groupBox3.TabStop = false; + // + // LInputColorPanel + // + this.LInputColorPanel.Location = new System.Drawing.Point(4, 8); + this.LInputColorPanel.Name = "LInputColorPanel"; + this.LInputColorPanel.Size = new System.Drawing.Size(20, 16); + this.LInputColorPanel.TabIndex = 7; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(1, 71); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(78, 13); + this.label6.TabIndex = 13; + this.label6.Text = "Alert messages"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(28, 93); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(18, 13); + this.label5.TabIndex = 12; + this.label5.Text = "0x"; + // + // AlertColorText + // + this.AlertColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; + this.AlertColorText.Location = new System.Drawing.Point(45, 90); + 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; + // + // ChangeAlertColor + // + this.ChangeAlertColor.Location = new System.Drawing.Point(110, 87); + this.ChangeAlertColor.Name = "ChangeAlertColor"; + this.ChangeAlertColor.Size = new System.Drawing.Size(52, 23); + this.ChangeAlertColor.TabIndex = 10; + this.ChangeAlertColor.Text = "Change"; + this.ChangeAlertColor.UseVisualStyleBackColor = true; + this.ChangeAlertColor.Click += new System.EventHandler(this.ChangeAlertColor_Click); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.AlertColorPanel); + this.groupBox1.Location = new System.Drawing.Point(1, 82); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(28, 28); + this.groupBox1.TabIndex = 9; + this.groupBox1.TabStop = false; + // + // AlertColorPanel + // + this.AlertColorPanel.Location = new System.Drawing.Point(4, 8); + this.AlertColorPanel.Name = "AlertColorPanel"; + this.AlertColorPanel.Size = new System.Drawing.Size(20, 16); + this.AlertColorPanel.TabIndex = 7; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(1, 24); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(80, 13); + this.label4.TabIndex = 8; + this.label4.Text = "Main messages"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(28, 46); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(18, 13); + this.label3.TabIndex = 7; + this.label3.Text = "0x"; + // + // ColorText + // + this.ColorText.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; + this.ColorText.Location = new System.Drawing.Point(45, 43); + 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; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(110, 40); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(52, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Change"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // MessageColorBox + // + this.MessageColorBox.Controls.Add(this.ColorPanel); + this.MessageColorBox.Location = new System.Drawing.Point(1, 35); + this.MessageColorBox.Name = "MessageColorBox"; + this.MessageColorBox.Size = new System.Drawing.Size(28, 28); + this.MessageColorBox.TabIndex = 0; + this.MessageColorBox.TabStop = false; + // + // ColorPanel + // + this.ColorPanel.Location = new System.Drawing.Point(4, 8); + this.ColorPanel.Name = "ColorPanel"; + this.ColorPanel.Size = new System.Drawing.Size(20, 16); + this.ColorPanel.TabIndex = 7; + this.ColorPanel.DoubleClick += new System.EventHandler(this.ColorPanel_DoubleClick); + // + // 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(499, 371); + 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(12, 371); + 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.MouseLeave += new System.EventHandler(this.PositionPanel_MouseLeave); + this.PositionPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.PositionPanel_Paint); + this.PositionPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseMove); + this.PositionPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseDown); + this.PositionPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PositionPanel_MouseUp); + this.PositionPanel.MouseEnter += new System.EventHandler(this.PositionPanel_MouseEnter); + // + // 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[] { + 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_ValueChanged); - // - // 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(91, 271); - this.YNumeric.Maximum = new decimal(new int[] { + this.XNumeric.ValueChanged += new System.EventHandler(this.XNumeric_ValueChanged); + // + // 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[] { + 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_ValueChanged); - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 274); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(12, 13); - this.label1.TabIndex = 3; - this.label1.Text = "x"; - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(77, 273); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(12, 13); - this.label2.TabIndex = 4; - this.label2.Text = "y"; - // - // PositionGroupBox - // - 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(301, 299); - this.PositionGroupBox.TabIndex = 3; - this.PositionGroupBox.TabStop = false; - this.PositionGroupBox.Text = "Position"; - // - // 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(534, 406); - 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.Name = "MessageConfig"; - this.ShowIcon = false; - 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(); - this.groupBox3.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.MessageColorBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.XNumeric)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.YNumeric)).EndInit(); - this.PositionGroupBox.ResumeLayout(false); - this.PositionGroupBox.PerformLayout(); - this.ResumeLayout(false); + this.YNumeric.ValueChanged += new System.EventHandler(this.YNumeric_ValueChanged); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(27, 274); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(12, 13); + this.label1.TabIndex = 3; + this.label1.Text = "x"; + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(92, 273); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(12, 13); + this.label2.TabIndex = 4; + 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); + // + // 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(612, 406); + 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.Name = "MessageConfig"; + this.ShowIcon = false; + 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(); + this.groupBox3.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.MessageColorBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.XNumeric)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.YNumeric)).EndInit(); + this.PositionGroupBox.ResumeLayout(false); + this.PositionGroupBox.PerformLayout(); + this.ResumeLayout(false); } @@ -591,5 +646,9 @@ 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; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/config/MessageConfig.cs b/BizHawk.MultiClient/config/MessageConfig.cs index 09fbfbe2c2..bd310337d4 100644 --- a/BizHawk.MultiClient/config/MessageConfig.cs +++ b/BizHawk.MultiClient/config/MessageConfig.cs @@ -9,336 +9,444 @@ using System.Windows.Forms; namespace BizHawk.MultiClient { - public partial class MessageConfig : Form - { - //TODO: - //Implement message position as a variable - //Make a checkbox to enable/disable the stacking effect of message label - //Deal with typing into Numerics properly - //Have some method of binding a display object to top/bottom/left/right instead of an absolute position - //Bug: restore defaults doesn't restore the y value of whatever radio is checked + public partial class MessageConfig : Form + { + //TODO: + //Implement message position as a variable + //Make a checkbox to enable/disable the stacking effect of message label + //Deal with typing into Numerics properly + //Have some method of binding a display object to top/bottom/left/right instead of an absolute position + //Bug: restore defaults doesn't restore the y value of whatever radio is checked - int DispFPSx = Global.Config.DispFPSx; - int DispFPSy = Global.Config.DispFPSy; - int DispFrameCx = Global.Config.DispFrameCx; - int DispFrameCy = Global.Config.DispFrameCy; - int DispLagx = Global.Config.DispLagx; - int DispLagy = Global.Config.DispLagy; - int DispInpx = Global.Config.DispInpx; - int DispInpy = Global.Config.DispInpy; - int MessageColor = Global.Config.MessagesColor; - int AlertColor = Global.Config.AlertMessageColor; - int LastInputColor = Global.Config.LastInputColor; + int DispFPSx = Global.Config.DispFPSx; + int DispFPSy = Global.Config.DispFPSy; + int DispFrameCx = Global.Config.DispFrameCx; + int DispFrameCy = Global.Config.DispFrameCy; + int DispLagx = Global.Config.DispLagx; + int DispLagy = Global.Config.DispLagy; + int DispInpx = Global.Config.DispInpx; + int DispInpy = Global.Config.DispInpy; + int MessageColor = Global.Config.MessagesColor; + int AlertColor = Global.Config.AlertMessageColor; + int LastInputColor = Global.Config.LastInputColor; + int DispRecx = Global.Config.DispRecx; + int DispRecy = Global.Config.DispRecy; - public Brush brush = Brushes.Black; - int px = 0; - int py = 0; - bool mousedown = false; + int DispFPSanchor = Global.Config.DispFPSanchor; + int DispFrameanchor = Global.Config.DispFrameanchor; + int DispLaganchor = Global.Config.DispLaganchor; + int DispInputanchor = Global.Config.DispInpanchor; + int DispRecanchor = Global.Config.DispRecanchor; - public MessageConfig() - { - InitializeComponent(); - } + public Brush brush = Brushes.Black; + int px = 0; + int py = 0; + bool mousedown = false; - private void MessageConfig_Load(object sender, EventArgs e) - { - SetMaxXY(); - MessageColorDialog.Color = Color.FromArgb(MessageColor); - AlertColorDialog.Color = Color.FromArgb(AlertColor); - LInputColorDialog.Color = Color.FromArgb(LastInputColor); - SetColorBox(); - SetPositionInfo(); - } + public MessageConfig() + { + InitializeComponent(); + } - private void SetMaxXY() - { - XNumeric.Maximum = Global.Emulator.VideoProvider.BufferWidth-8; - YNumeric.Maximum = Global.Emulator.VideoProvider.BufferHeight-8; - PositionPanel.Size = new Size(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight); - - int width; - if (Global.Emulator.VideoProvider.BufferWidth > 128) - width = Global.Emulator.VideoProvider.BufferWidth + 32; - else - width = 128+32; - - PositionGroupBox.Size = new Size(width, Global.Emulator.VideoProvider.BufferHeight + 56); - } + private void MessageConfig_Load(object sender, EventArgs e) + { + SetMaxXY(); + MessageColorDialog.Color = Color.FromArgb(MessageColor); + AlertColorDialog.Color = Color.FromArgb(AlertColor); + LInputColorDialog.Color = Color.FromArgb(LastInputColor); + SetColorBox(); + SetPositionInfo(); + } - private void SetColorBox() - { - MessageColor = MessageColorDialog.Color.ToArgb(); - ColorPanel.BackColor = MessageColorDialog.Color; - ColorText.Text = String.Format("{0:X8}", MessageColor); + private void SetMaxXY() + { + XNumeric.Maximum = Global.Emulator.VideoProvider.BufferWidth - 8; + YNumeric.Maximum = Global.Emulator.VideoProvider.BufferHeight - 8; + PositionPanel.Size = new Size(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight); - AlertColor = AlertColorDialog.Color.ToArgb(); - AlertColorPanel.BackColor = AlertColorDialog.Color; - AlertColorText.Text = String.Format("{0:X8}", AlertColor); + int width; + if (Global.Emulator.VideoProvider.BufferWidth > 128) + width = Global.Emulator.VideoProvider.BufferWidth + 44; + else + width = 128 + 44; - LastInputColor = LInputColorDialog.Color.ToArgb(); - LInputColorPanel.BackColor = LInputColorDialog.Color; - LInputText.Text = String.Format("{0:X8}", LastInputColor); - } + PositionGroupBox.Size = new Size(width, Global.Emulator.VideoProvider.BufferHeight + 52); + } - private void SetPositionInfo() - { - if (FPSRadio.Checked) - { - XNumeric.Value = DispFPSx; - YNumeric.Value = DispFPSy; - px = DispFPSx; - py = DispFPSy; - } - else if (FrameCounterRadio.Checked) - { - XNumeric.Value = DispFrameCx; - YNumeric.Value = DispFrameCy; - px = DispFrameCx; - py = DispFrameCy; - } - else if (LagCounterRadio.Checked) - { - XNumeric.Value = DispLagx; - YNumeric.Value = DispLagy; - px = DispLagx; - py = DispLagy; - } - else if (InputDisplayRadio.Checked) - { - XNumeric.Value = DispInpx; - XNumeric.Value = DispInpy; - px = DispInpx; - py = DispInpy; - } - else if (MessagesRadio.Checked) - { - XNumeric.Value = 0; - YNumeric.Value = 0; - px = 0; - py = 0; - } + private void SetColorBox() + { + MessageColor = MessageColorDialog.Color.ToArgb(); + ColorPanel.BackColor = MessageColorDialog.Color; + ColorText.Text = String.Format("{0:X8}", MessageColor); - PositionPanel.Refresh(); - SetPositionLabels(); - } + AlertColor = AlertColorDialog.Color.ToArgb(); + AlertColorPanel.BackColor = AlertColorDialog.Color; + AlertColorText.Text = String.Format("{0:X8}", AlertColor); - private void SaveSettings() - { - Global.Config.DispFPSx = DispFPSx; - Global.Config.DispFPSy = DispFPSy; - Global.Config.DispFrameCx = DispFrameCx; - Global.Config.DispFrameCy = DispFrameCy; - Global.Config.DispLagx = DispLagx; - Global.Config.DispLagy = DispLagy; - Global.Config.DispInpx = DispInpx; - Global.Config.DispInpy = DispInpy; - Global.Config.MessagesColor = MessageColor; - Global.Config.AlertMessageColor = AlertColor; - Global.Config.LastInputColor = LastInputColor; - } + LastInputColor = LInputColorDialog.Color.ToArgb(); + LInputColorPanel.BackColor = LInputColorDialog.Color; + LInputText.Text = String.Format("{0:X8}", LastInputColor); + } - private void OK_Click(object sender, EventArgs e) - { - SaveSettings(); - this.Close(); - } + private void SetAnchorRadio(int anchor) + { + switch (anchor) + { + default: + case 0: + TL.Checked = true; break; + case 1: + TR.Checked = true; break; + case 2: + BL.Checked = true; break; + case 3: + BR.Checked = true; break; + } + } - private void button1_Click(object sender, EventArgs e) - { - if (MessageColorDialog.ShowDialog() == DialogResult.OK) - SetColorBox(); - } + private void SetPositionInfo() + { + if (FPSRadio.Checked) + { + XNumeric.Value = DispFPSx; + YNumeric.Value = DispFPSy; + px = DispFPSx; + py = DispFPSy; + SetAnchorRadio(DispFPSanchor); + } + else if (FrameCounterRadio.Checked) + { + XNumeric.Value = DispFrameCx; + YNumeric.Value = DispFrameCy; + px = DispFrameCx; + py = DispFrameCy; + SetAnchorRadio(DispFrameanchor); + } + else if (LagCounterRadio.Checked) + { + XNumeric.Value = DispLagx; + YNumeric.Value = DispLagy; + px = DispLagx; + py = DispLagy; + SetAnchorRadio(DispLaganchor); + } + else if (InputDisplayRadio.Checked) + { + XNumeric.Value = DispInpx; + XNumeric.Value = DispInpy; + px = DispInpx; + py = DispInpy; + SetAnchorRadio(DispInputanchor); + } + else if (MessagesRadio.Checked) + { + XNumeric.Value = 0; + YNumeric.Value = 0; + px = 0; + py = 0; + } - private void FPSRadio_CheckedChanged(object sender, EventArgs e) - { - SetPositionInfo(); - } + PositionPanel.Refresh(); + SetPositionLabels(); + } - private void FrameCounterRadio_CheckedChanged(object sender, EventArgs e) - { - SetPositionInfo(); - } + private void SaveSettings() + { + Global.Config.DispFPSx = DispFPSx; + Global.Config.DispFPSy = DispFPSy; + Global.Config.DispFrameCx = DispFrameCx; + Global.Config.DispFrameCy = DispFrameCy; + Global.Config.DispLagx = DispLagx; + Global.Config.DispLagy = DispLagy; + Global.Config.DispInpx = DispInpx; + Global.Config.DispInpy = DispInpy; + Global.Config.MessagesColor = MessageColor; + Global.Config.AlertMessageColor = AlertColor; + Global.Config.LastInputColor = LastInputColor; - private void LagCounterRadio_CheckedChanged(object sender, EventArgs e) - { - SetPositionInfo(); - } + Global.Config.DispFPSanchor = DispFPSanchor; + Global.Config.DispFPSanchor = DispFrameanchor; + Global.Config.DispLaganchor = DispLaganchor; + Global.Config.DispInpanchor = DispInputanchor; + Global.Config.DispRecanchor = DispRecanchor; + } - private void InputDisplayRadio_CheckedChanged(object sender, EventArgs e) - { - SetPositionInfo(); - } + private void OK_Click(object sender, EventArgs e) + { + SaveSettings(); + this.Close(); + } - private void MessagesRadio_CheckedChanged(object sender, EventArgs e) - { - SetPositionInfo(); - } + private void button1_Click(object sender, EventArgs e) + { + if (MessageColorDialog.ShowDialog() == DialogResult.OK) + SetColorBox(); + } - private void XNumericChange() - { - px = (int)XNumeric.Value; - SetPositionLabels(); - PositionPanel.Refresh(); - } + private void FPSRadio_CheckedChanged(object sender, EventArgs e) + { + SetPositionInfo(); + } - private void YNumericChange() - { - py = (int)YNumeric.Value; - SetPositionLabels(); - PositionPanel.Refresh(); - } + private void FrameCounterRadio_CheckedChanged(object sender, EventArgs e) + { + SetPositionInfo(); + } - private void XNumeric_ValueChanged(object sender, EventArgs e) - { - XNumericChange(); - } + private void LagCounterRadio_CheckedChanged(object sender, EventArgs e) + { + SetPositionInfo(); + } - private void YNumeric_ValueChanged(object sender, EventArgs e) - { - YNumericChange(); - } + private void InputDisplayRadio_CheckedChanged(object sender, EventArgs e) + { + SetPositionInfo(); + } - private void Cancel_Click(object sender, EventArgs e) - { - this.Close(); - } + private void MessagesRadio_CheckedChanged(object sender, EventArgs e) + { + SetPositionInfo(); + } - private void PositionPanel_MouseEnter(object sender, EventArgs e) - { - this.Cursor = Cursors.Hand; - } + private void XNumericChange() + { + px = (int)XNumeric.Value; + SetPositionLabels(); + PositionPanel.Refresh(); + } - private void PositionPanel_MouseLeave(object sender, EventArgs e) - { - this.Cursor = Cursors.Default; - } + private void YNumericChange() + { + py = (int)YNumeric.Value; + SetPositionLabels(); + PositionPanel.Refresh(); + } - private void PositionPanel_Paint(object sender, PaintEventArgs e) - { - Pen p = new Pen(brush); - e.Graphics.DrawLine(p, new Point(px - 2, py - 2), new Point(px + 2, py + 2)); - e.Graphics.DrawLine(p, new Point(px + 2, py - 2), new Point(px - 2, py + 2)); - } + private void XNumeric_ValueChanged(object sender, EventArgs e) + { + XNumericChange(); + } - private void PositionPanel_MouseDown(object sender, MouseEventArgs e) - { - this.Cursor = Cursors.Arrow; - mousedown = true; - SetNewPosition(e.X, e.Y); - } + private void YNumeric_ValueChanged(object sender, EventArgs e) + { + YNumericChange(); + } - private void PositionPanel_MouseUp(object sender, MouseEventArgs e) - { - this.Cursor = Cursors.Hand; - mousedown = false; - } + private void Cancel_Click(object sender, EventArgs e) + { + this.Close(); + } - private void SetNewPosition(int mx, int my) - { - 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; - XNumeric.Value = mx; - YNumeric.Value = my; - px = mx; - py = my; - PositionPanel.Refresh(); - SetPositionLabels(); - } + private void PositionPanel_MouseEnter(object sender, EventArgs e) + { + this.Cursor = Cursors.Hand; + } - private void PositionPanel_MouseMove(object sender, MouseEventArgs e) - { - if (mousedown) - { - SetNewPosition(e.X, e.Y); - } - } + private void PositionPanel_MouseLeave(object sender, EventArgs e) + { + this.Cursor = Cursors.Default; + } - private void SetPositionLabels() - { - if (FPSRadio.Checked) - { - DispFPSx = px; - DispFPSy = py; - } - else if (FrameCounterRadio.Checked) - { - DispFrameCx = px; - DispFrameCy = py; - } - else if (LagCounterRadio.Checked) - { - DispLagx = px; - DispLagy = py; - } - else if (InputDisplayRadio.Checked) - { - DispInpx = px; - DispInpy = py; - } - else if (MessagesRadio.Checked) - { - //TODO - } - FpsPosLabel.Text = DispFPSx.ToString() + ", " + DispFPSy.ToString(); - FCLabel.Text = DispFrameCx.ToString() + ", " + DispFrameCy.ToString(); - LagLabel.Text = DispLagx.ToString() + ", " + DispLagy.ToString(); - InpLabel.Text = DispInpx.ToString() + ", " + DispInpy.ToString(); - MessLabel.Text = "0, 0"; - } + private void PositionPanel_Paint(object sender, PaintEventArgs e) + { + Pen p = new Pen(brush); + e.Graphics.DrawLine(p, new Point(px - 2, py - 2), new Point(px + 2, py + 2)); + e.Graphics.DrawLine(p, new Point(px + 2, py - 2), new Point(px - 2, py + 2)); + } - private void ResetDefaultsButton_Click(object sender, EventArgs e) - { - Global.Config.DispFPSx = 0; - Global.Config.DispFPSy = 0; - Global.Config.DispFrameCx = 0; - Global.Config.DispFrameCy = 12; - Global.Config.DispLagx = 0; - Global.Config.DispLagy = 36; - Global.Config.DispInpx = 0; - Global.Config.DispInpy = 24; - Global.Config.MessagesColor = -1; - Global.Config.AlertMessageColor = -65536; - Global.Config.LastInputColor = -23296; + private void PositionPanel_MouseDown(object sender, MouseEventArgs e) + { + this.Cursor = Cursors.Arrow; + mousedown = true; + SetNewPosition(e.X, e.Y); + } - DispFPSx = Global.Config.DispFPSx; - DispFPSy = Global.Config.DispFPSy; - DispFrameCx = Global.Config.DispFrameCx; - DispFrameCy = Global.Config.DispFrameCy; - DispLagx = Global.Config.DispLagx; - DispLagy = Global.Config.DispLagy; - DispInpx = Global.Config.DispInpx; - DispInpy = Global.Config.DispInpy; - MessageColor = Global.Config.MessagesColor; - AlertColor = Global.Config.AlertMessageColor; - LastInputColor = Global.Config.LastInputColor; + private void PositionPanel_MouseUp(object sender, MouseEventArgs e) + { + this.Cursor = Cursors.Hand; + mousedown = false; + } + + private void SetNewPosition(int mx, int my) + { + 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; + XNumeric.Value = mx; + YNumeric.Value = my; + px = mx; + py = my; + PositionPanel.Refresh(); + SetPositionLabels(); + } + + private void PositionPanel_MouseMove(object sender, MouseEventArgs e) + { + if (mousedown) + { + SetNewPosition(e.X, e.Y); + } + } + + private void SetPositionLabels() + { + if (FPSRadio.Checked) + { + DispFPSx = px; + DispFPSy = py; + } + else if (FrameCounterRadio.Checked) + { + DispFrameCx = px; + DispFrameCy = py; + } + else if (LagCounterRadio.Checked) + { + DispLagx = px; + DispLagy = py; + } + else if (InputDisplayRadio.Checked) + { + DispInpx = px; + DispInpy = py; + } + else if (MessagesRadio.Checked) + { + //TODO + } + FpsPosLabel.Text = DispFPSx.ToString() + ", " + DispFPSy.ToString(); + FCLabel.Text = DispFrameCx.ToString() + ", " + DispFrameCy.ToString(); + LagLabel.Text = DispLagx.ToString() + ", " + DispLagy.ToString(); + InpLabel.Text = DispInpx.ToString() + ", " + DispInpy.ToString(); + MessLabel.Text = "0, 0"; + } + + private void ResetDefaultsButton_Click(object sender, EventArgs e) + { + Global.Config.DispFPSx = 0; + Global.Config.DispFPSy = 0; + Global.Config.DispFrameCx = 0; + Global.Config.DispFrameCy = 12; + Global.Config.DispLagx = 0; + Global.Config.DispLagy = 36; + Global.Config.DispInpx = 0; + Global.Config.DispInpy = 24; + Global.Config.MessagesColor = -1; + Global.Config.AlertMessageColor = -65536; + Global.Config.LastInputColor = -23296; + + Global.Config.DispFPSanchor = 0; + Global.Config.DispFrameanchor = 0; + Global.Config.DispLaganchor = 0; + Global.Config.DispInpanchor = 0; + Global.Config.DispRecanchor = 0; + + DispFPSx = Global.Config.DispFPSx; + DispFPSy = Global.Config.DispFPSy; + DispFrameCx = Global.Config.DispFrameCx; + DispFrameCy = Global.Config.DispFrameCy; + DispLagx = Global.Config.DispLagx; + DispLagy = Global.Config.DispLagy; + DispInpx = Global.Config.DispInpx; + DispInpy = Global.Config.DispInpy; + MessageColor = Global.Config.MessagesColor; + AlertColor = Global.Config.AlertMessageColor; + LastInputColor = Global.Config.LastInputColor; + + DispFPSanchor = Global.Config.DispFPSanchor; + DispFrameanchor = Global.Config.DispFrameanchor; + DispLaganchor = Global.Config.DispLaganchor; + DispInputanchor = Global.Config.DispInpanchor; + DispRecanchor = Global.Config.DispRecanchor; + + //TODO: anchors - SetMaxXY(); - MessageColorDialog.Color = Color.FromArgb(MessageColor); - AlertColorDialog.Color = Color.FromArgb(AlertColor); - LInputColorDialog.Color = Color.FromArgb(LastInputColor); - SetColorBox(); - SetPositionInfo(); - } + SetMaxXY(); + MessageColorDialog.Color = Color.FromArgb(MessageColor); + AlertColorDialog.Color = Color.FromArgb(AlertColor); + LInputColorDialog.Color = Color.FromArgb(LastInputColor); + SetColorBox(); + SetPositionInfo(); + } - private void ColorPanel_DoubleClick(object sender, EventArgs e) - { - if (MessageColorDialog.ShowDialog() == DialogResult.OK) - SetColorBox(); - } + private void ColorPanel_DoubleClick(object sender, EventArgs e) + { + if (MessageColorDialog.ShowDialog() == DialogResult.OK) + SetColorBox(); + } - private void ChangeAlertColor_Click(object sender, EventArgs e) - { - if (AlertColorDialog.ShowDialog() == DialogResult.OK) - SetColorBox(); - } + private void ChangeAlertColor_Click(object sender, EventArgs e) + { + if (AlertColorDialog.ShowDialog() == DialogResult.OK) + SetColorBox(); + } - private void ChangeLInput_Click(object sender, EventArgs e) - { - if (LInputColorDialog.ShowDialog() == DialogResult.OK) - SetColorBox(); - } - } + private void ChangeLInput_Click(object sender, EventArgs e) + { + if (LInputColorDialog.ShowDialog() == DialogResult.OK) + SetColorBox(); + } + + private void TL_CheckedChanged(object sender, EventArgs e) + { + if (TL.Checked) + { + if (FPSRadio.Checked) + DispFPSanchor = 0; + else if (FrameCounterRadio.Checked) + DispFrameanchor = 0; + else if (LagCounterRadio.Checked) + DispLaganchor = 0; + else if (InputDisplayRadio.Checked) + DispInputanchor = 0; + } + } + + private void TR_CheckedChanged(object sender, EventArgs e) + { + if (TR.Checked) + { + if (FPSRadio.Checked) + DispFPSanchor = 1; + else if (FrameCounterRadio.Checked) + DispFrameanchor = 1; + else if (LagCounterRadio.Checked) + DispLaganchor = 1; + else if (InputDisplayRadio.Checked) + DispInputanchor = 1; + } + } + + private void BL_CheckedChanged(object sender, EventArgs e) + { + if (BL.Checked) + { + if (FPSRadio.Checked) + DispFPSanchor = 2; + else if (FrameCounterRadio.Checked) + DispFrameanchor = 2; + else if (LagCounterRadio.Checked) + DispLaganchor = 2; + else if (InputDisplayRadio.Checked) + DispInputanchor = 2; + } + } + + private void BR_CheckedChanged(object sender, EventArgs e) + { + if (BR.Checked) + { + if (FPSRadio.Checked) + DispFPSanchor = 3; + else if (FrameCounterRadio.Checked) + DispFrameanchor = 3; + else if (LagCounterRadio.Checked) + DispLaganchor = 3; + else if (InputDisplayRadio.Checked) + DispInputanchor = 3; + } + } + } } diff --git a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs index de90619e7c..d58d53abeb 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs @@ -28,95 +28,95 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LuaConsole)); - this.LuaListView = new BizHawk.VirtualListView(); - this.Script = new System.Windows.Forms.ColumnHeader(); - this.PathName = new System.Windows.Forms.ColumnHeader(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.recentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.scriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toggleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.insertSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.turnOffAllScriptsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.OutputBox = new System.Windows.Forms.RichTextBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.NumberOfScripts = new System.Windows.Forms.Label(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.menuStrip1.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // LuaListView - // - this.LuaListView.CheckBoxes = true; - this.LuaListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LuaConsole)); + this.LuaListView = new BizHawk.VirtualListView(); + this.Script = new System.Windows.Forms.ColumnHeader(); + this.PathName = new System.Windows.Forms.ColumnHeader(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.recentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.scriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toggleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.insertSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.turnOffAllScriptsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.OutputBox = new System.Windows.Forms.RichTextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.NumberOfScripts = new System.Windows.Forms.Label(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.menuStrip1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // LuaListView + // + this.LuaListView.CheckBoxes = true; + this.LuaListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.Script, this.PathName}); - this.LuaListView.GridLines = true; - this.LuaListView.ItemCount = 0; - this.LuaListView.Location = new System.Drawing.Point(12, 51); - this.LuaListView.Name = "LuaListView"; - this.LuaListView.selectedItem = -1; - this.LuaListView.Size = new System.Drawing.Size(293, 278); - this.LuaListView.TabIndex = 0; - this.LuaListView.UseCompatibleStateImageBehavior = false; - this.LuaListView.View = System.Windows.Forms.View.Details; - this.LuaListView.SelectedIndexChanged += new System.EventHandler(this.LuaListView_SelectedIndexChanged); - this.LuaListView.DoubleClick += new System.EventHandler(this.LuaListView_DoubleClick); - // - // Script - // - this.Script.Text = "Script"; - this.Script.Width = 92; - // - // PathName - // - this.PathName.Text = "Path"; - this.PathName.Width = 195; - // - // menuStrip1 - // - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.LuaListView.GridLines = true; + this.LuaListView.ItemCount = 0; + this.LuaListView.Location = new System.Drawing.Point(12, 51); + this.LuaListView.Name = "LuaListView"; + this.LuaListView.selectedItem = -1; + this.LuaListView.Size = new System.Drawing.Size(293, 278); + this.LuaListView.TabIndex = 0; + this.LuaListView.UseCompatibleStateImageBehavior = false; + this.LuaListView.View = System.Windows.Forms.View.Details; + this.LuaListView.SelectedIndexChanged += new System.EventHandler(this.LuaListView_SelectedIndexChanged); + this.LuaListView.DoubleClick += new System.EventHandler(this.LuaListView_DoubleClick); + // + // Script + // + this.Script.Text = "Script"; + this.Script.Width = 92; + // + // PathName + // + this.PathName.Text = "Path"; + this.PathName.Width = 195; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1, this.fileToolStripMenuItem, this.scriptToolStripMenuItem, this.viewToolStripMenuItem, this.optionsToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(598, 24); - this.menuStrip1.TabIndex = 1; - this.menuStrip1.Text = "menuStrip1"; - // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20); - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(598, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 20); + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, this.openToolStripMenuItem, this.saveToolStripMenuItem, @@ -124,226 +124,228 @@ this.recentToolStripMenuItem, this.toolStripSeparator1, this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); - this.fileToolStripMenuItem.Text = "&File"; - // - // newToolStripMenuItem - // - this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.newToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.newToolStripMenuItem.Text = "&New"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.openToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.openToolStripMenuItem.Text = "&Open"; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // saveToolStripMenuItem - // - this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.saveToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.saveToolStripMenuItem.Text = "&Save"; - // - // saveAsToolStripMenuItem - // - this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) - | System.Windows.Forms.Keys.S))); - this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.saveAsToolStripMenuItem.Text = "&Save As..."; - // - // recentToolStripMenuItem - // - this.recentToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.newToolStripMenuItem.Text = "&New"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.openToolStripMenuItem.Text = "&Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.saveToolStripMenuItem.Text = "&Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.S))); + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.saveAsToolStripMenuItem.Text = "&Save As..."; + this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); + // + // recentToolStripMenuItem + // + this.recentToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.noneToolStripMenuItem, this.toolStripSeparator3, this.clearToolStripMenuItem}); - this.recentToolStripMenuItem.Name = "recentToolStripMenuItem"; - this.recentToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.recentToolStripMenuItem.Text = "Recent"; - // - // noneToolStripMenuItem - // - this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; - this.noneToolStripMenuItem.Size = new System.Drawing.Size(110, 22); - this.noneToolStripMenuItem.Text = "None"; - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(107, 6); - // - // clearToolStripMenuItem - // - this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(110, 22); - this.clearToolStripMenuItem.Text = "Clear"; - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(201, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.exitToolStripMenuItem.Text = "E&xit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // scriptToolStripMenuItem - // - this.scriptToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.recentToolStripMenuItem.Name = "recentToolStripMenuItem"; + this.recentToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.recentToolStripMenuItem.Text = "Recent"; + // + // noneToolStripMenuItem + // + this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; + this.noneToolStripMenuItem.Size = new System.Drawing.Size(110, 22); + this.noneToolStripMenuItem.Text = "None"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(107, 6); + // + // clearToolStripMenuItem + // + this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; + this.clearToolStripMenuItem.Size = new System.Drawing.Size(110, 22); + this.clearToolStripMenuItem.Text = "Clear"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(201, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.exitToolStripMenuItem.Text = "E&xit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // scriptToolStripMenuItem + // + this.scriptToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.editToolStripMenuItem, this.toggleToolStripMenuItem, this.insertSeparatorToolStripMenuItem, this.turnOffAllScriptsToolStripMenuItem}); - this.scriptToolStripMenuItem.Name = "scriptToolStripMenuItem"; - this.scriptToolStripMenuItem.Size = new System.Drawing.Size(46, 20); - this.scriptToolStripMenuItem.Text = "&Script"; - // - // editToolStripMenuItem - // - this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(175, 22); - this.editToolStripMenuItem.Text = "Edit"; - // - // toggleToolStripMenuItem - // - this.toggleToolStripMenuItem.Name = "toggleToolStripMenuItem"; - this.toggleToolStripMenuItem.Size = new System.Drawing.Size(175, 22); - this.toggleToolStripMenuItem.Text = "Toggle"; - // - // insertSeparatorToolStripMenuItem - // - this.insertSeparatorToolStripMenuItem.Name = "insertSeparatorToolStripMenuItem"; - this.insertSeparatorToolStripMenuItem.Size = new System.Drawing.Size(175, 22); - this.insertSeparatorToolStripMenuItem.Text = "Insert Separator"; - // - // turnOffAllScriptsToolStripMenuItem - // - this.turnOffAllScriptsToolStripMenuItem.Name = "turnOffAllScriptsToolStripMenuItem"; - this.turnOffAllScriptsToolStripMenuItem.Size = new System.Drawing.Size(175, 22); - this.turnOffAllScriptsToolStripMenuItem.Text = "Turn Off All Scripts"; - // - // viewToolStripMenuItem - // - this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.scriptToolStripMenuItem.Name = "scriptToolStripMenuItem"; + this.scriptToolStripMenuItem.Size = new System.Drawing.Size(46, 20); + this.scriptToolStripMenuItem.Text = "&Script"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(175, 22); + this.editToolStripMenuItem.Text = "Edit"; + // + // toggleToolStripMenuItem + // + this.toggleToolStripMenuItem.Name = "toggleToolStripMenuItem"; + this.toggleToolStripMenuItem.Size = new System.Drawing.Size(175, 22); + this.toggleToolStripMenuItem.Text = "Toggle"; + // + // insertSeparatorToolStripMenuItem + // + this.insertSeparatorToolStripMenuItem.Name = "insertSeparatorToolStripMenuItem"; + this.insertSeparatorToolStripMenuItem.Size = new System.Drawing.Size(175, 22); + this.insertSeparatorToolStripMenuItem.Text = "Insert Separator"; + // + // turnOffAllScriptsToolStripMenuItem + // + this.turnOffAllScriptsToolStripMenuItem.Name = "turnOffAllScriptsToolStripMenuItem"; + this.turnOffAllScriptsToolStripMenuItem.Size = new System.Drawing.Size(175, 22); + this.turnOffAllScriptsToolStripMenuItem.Text = "Turn Off All Scripts"; + // + // viewToolStripMenuItem + // + this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.removeToolStripMenuItem, this.toolStripSeparator2, this.moveUpToolStripMenuItem, this.moveDownToolStripMenuItem}); - this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; - this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); - this.viewToolStripMenuItem.Text = "&View"; - // - // removeToolStripMenuItem - // - this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.removeToolStripMenuItem.Text = "Remove"; - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); - // - // moveUpToolStripMenuItem - // - this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; - this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.moveUpToolStripMenuItem.Text = "Move Up"; - this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click); - // - // moveDownToolStripMenuItem - // - this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; - this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.moveDownToolStripMenuItem.Text = "Move Down"; - this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); - // - // optionsToolStripMenuItem - // - this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; + this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); + this.viewToolStripMenuItem.Text = "&View"; + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.removeToolStripMenuItem.Text = "Remove"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + // + // moveUpToolStripMenuItem + // + this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; + this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.moveUpToolStripMenuItem.Text = "Move Up"; + this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click); + // + // moveDownToolStripMenuItem + // + this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; + this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.moveDownToolStripMenuItem.Text = "Move Down"; + this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); + // + // optionsToolStripMenuItem + // + this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveWindowPositionToolStripMenuItem, this.restoreWindowSizeToolStripMenuItem}); - this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); - this.optionsToolStripMenuItem.Text = "&Options"; - this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened); - // - // saveWindowPositionToolStripMenuItem - // - this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; - this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(190, 22); - this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; - this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); - // - // restoreWindowSizeToolStripMenuItem - // - this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; - this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(190, 22); - this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; - this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); - // - // OutputBox - // - this.OutputBox.Location = new System.Drawing.Point(6, 19); - this.OutputBox.Name = "OutputBox"; - this.OutputBox.ReadOnly = true; - this.OutputBox.Size = new System.Drawing.Size(246, 253); - this.OutputBox.TabIndex = 2; - this.OutputBox.Text = ""; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.OutputBox); - this.groupBox1.Location = new System.Drawing.Point(311, 51); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(258, 278); - this.groupBox1.TabIndex = 3; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Output"; - // - // NumberOfScripts - // - this.NumberOfScripts.AutoSize = true; - this.NumberOfScripts.Location = new System.Drawing.Point(12, 29); - this.NumberOfScripts.Name = "NumberOfScripts"; - this.NumberOfScripts.Size = new System.Drawing.Size(66, 13); - this.NumberOfScripts.TabIndex = 4; - this.NumberOfScripts.Text = " 0 Scripts "; - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); - // - // LuaConsole - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(598, 359); - this.Controls.Add(this.NumberOfScripts); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.LuaListView); - this.Controls.Add(this.menuStrip1); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.menuStrip1; - this.Name = "LuaConsole"; - this.Text = "Lua Console"; - this.Load += new System.EventHandler(this.LuaConsole_Load); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); + this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); + this.optionsToolStripMenuItem.Text = "&Options"; + this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened); + // + // saveWindowPositionToolStripMenuItem + // + this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; + this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; + this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); + // + // restoreWindowSizeToolStripMenuItem + // + this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; + this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; + this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); + // + // OutputBox + // + this.OutputBox.Location = new System.Drawing.Point(6, 19); + this.OutputBox.Name = "OutputBox"; + this.OutputBox.ReadOnly = true; + this.OutputBox.Size = new System.Drawing.Size(246, 253); + this.OutputBox.TabIndex = 2; + this.OutputBox.Text = ""; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.OutputBox); + this.groupBox1.Location = new System.Drawing.Point(311, 51); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(258, 278); + this.groupBox1.TabIndex = 3; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Output"; + // + // NumberOfScripts + // + this.NumberOfScripts.AutoSize = true; + this.NumberOfScripts.Location = new System.Drawing.Point(12, 29); + this.NumberOfScripts.Name = "NumberOfScripts"; + this.NumberOfScripts.Size = new System.Drawing.Size(66, 13); + this.NumberOfScripts.TabIndex = 4; + this.NumberOfScripts.Text = " 0 Scripts "; + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); + // + // LuaConsole + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(598, 359); + this.Controls.Add(this.NumberOfScripts); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.LuaListView); + this.Controls.Add(this.menuStrip1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip1; + this.Name = "LuaConsole"; + this.Text = "Lua Console"; + this.Load += new System.EventHandler(this.LuaConsole_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index 8c0c704430..60a7f97222 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -11,221 +11,231 @@ using LuaInterface; namespace BizHawk.MultiClient { - public partial class LuaConsole : Form - { - //TODO: remember column widths - //TODO: recent menu - //TODO: drag & drop for .lua files + public partial class LuaConsole : Form + { + //TODO: remember column widths + //TODO: recent menu + //TODO: drag & drop for .lua files - int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired - int defaultHeight; + int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired + int defaultHeight; - List luaList = new List(); - LuaImplementation LuaImp; - string lastLuaFile = ""; + List luaList = new List(); + LuaImplementation LuaImp; + string lastLuaFile = ""; - private List GetLuaFileList() - { - List l = new List(); - for (int x = 0; x < luaList.Count; x++) - l.Add(new LuaFiles(luaList[x])); + private List GetLuaFileList() + { + List l = new List(); + for (int x = 0; x < luaList.Count; x++) + l.Add(new LuaFiles(luaList[x])); - return l; - } + return l; + } - public LuaConsole get() - { - return this; - } + public LuaConsole get() + { + return this; + } - public void AddText(string s) - { - OutputBox.Text += s; - } + public void AddText(string s) + { + OutputBox.Text += s; + } - public LuaConsole() - { - InitializeComponent(); - LuaImp = new LuaImplementation(this); - Closing += (o, e) => SaveConfigSettings(); - LuaListView.QueryItemText += new QueryItemTextHandler(LuaListView_QueryItemText); - LuaListView.QueryItemBkColor += new QueryItemBkColorHandler(LuaListView_QueryItemBkColor); - LuaListView.VirtualMode = true; - } + public LuaConsole() + { + InitializeComponent(); + LuaImp = new LuaImplementation(this); + Closing += (o, e) => SaveConfigSettings(); + LuaListView.QueryItemText += new QueryItemTextHandler(LuaListView_QueryItemText); + LuaListView.QueryItemBkColor += new QueryItemBkColorHandler(LuaListView_QueryItemBkColor); + LuaListView.VirtualMode = true; + } - private void LuaListView_QueryItemBkColor(int index, int column, ref Color color) - { - if (luaList[index].IsSeparator) - color = Color.DarkGray; - else if (!luaList[index].Enabled) - color = this.BackColor; - } + private void LuaListView_QueryItemBkColor(int index, int column, ref Color color) + { + if (luaList[index].IsSeparator) + color = Color.DarkGray; + else if (!luaList[index].Enabled) + color = this.BackColor; + } - private void LuaListView_QueryItemText(int index, int column, out string text) - { - text = ""; - if (column == 0) - text = Path.GetFileNameWithoutExtension(luaList[index].Path); //TODO: how about a list of Names and allow the user to name them? - if (column == 1) - text = luaList[index].Path; + private void LuaListView_QueryItemText(int index, int column, out string text) + { + text = ""; + if (column == 0) + text = Path.GetFileNameWithoutExtension(luaList[index].Path); //TODO: how about a list of Names and allow the user to name them? + if (column == 1) + text = luaList[index].Path; - } + } - private void LuaConsole_Load(object sender, EventArgs e) - { - LoadConfigSettings(); - } + private void LuaConsole_Load(object sender, EventArgs e) + { + LoadConfigSettings(); + } - public void Restart() - { - //Stop all Lua scripts - for (int x = 0; x < luaList.Count; x++) - luaList[x].Enabled = false; - } + public void Restart() + { + //Stop all Lua scripts + for (int x = 0; x < luaList.Count; x++) + luaList[x].Enabled = false; + } - private void SaveConfigSettings() - { - Global.Config.LuaConsoleWndx = this.Location.X; - Global.Config.LuaConsoleWndy = this.Location.Y; - Global.Config.LuaConsoleWidth = this.Right - this.Left; - Global.Config.LuaConsoleHeight = this.Bottom - this.Top; - } + private void SaveConfigSettings() + { + Global.Config.LuaConsoleWndx = this.Location.X; + Global.Config.LuaConsoleWndy = this.Location.Y; + Global.Config.LuaConsoleWidth = this.Right - this.Left; + Global.Config.LuaConsoleHeight = this.Bottom - this.Top; + } - private void LoadConfigSettings() - { - defaultWidth = Size.Width; //Save these first so that the user can restore to its original size - defaultHeight = Size.Height; + private void LoadConfigSettings() + { + defaultWidth = Size.Width; //Save these first so that the user can restore to its original size + defaultHeight = Size.Height; - if (Global.Config.LuaConsoleSaveWindowPosition && Global.Config.LuaConsoleWndx >= 0 && Global.Config.LuaConsoleWndy >= 0) - Location = new Point(Global.Config.LuaConsoleWndx, Global.Config.LuaConsoleWndy); + if (Global.Config.LuaConsoleSaveWindowPosition && Global.Config.LuaConsoleWndx >= 0 && Global.Config.LuaConsoleWndy >= 0) + Location = new Point(Global.Config.LuaConsoleWndx, Global.Config.LuaConsoleWndy); - if (Global.Config.LuaConsoleWidth >= 0 && Global.Config.LuaConsoleHeight >= 0) - { - Size = new System.Drawing.Size(Global.Config.LuaConsoleWidth, Global.Config.LuaConsoleHeight); - } + if (Global.Config.LuaConsoleWidth >= 0 && Global.Config.LuaConsoleHeight >= 0) + { + Size = new System.Drawing.Size(Global.Config.LuaConsoleWidth, Global.Config.LuaConsoleHeight); + } - } + } - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - this.Close(); - } + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Close(); + } - private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) - { - this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); - } + private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); + } - private FileInfo GetFileFromUser() - { - var ofd = new OpenFileDialog(); - if (lastLuaFile.Length > 0) - ofd.FileName = Path.GetFileNameWithoutExtension(lastLuaFile); - ofd.InitialDirectory = Global.Config.LuaPath; - ofd.Filter = "Lua Scripts (*.lua)|*.lua|All Files|*.*"; - ofd.RestoreDirectory = true; + private FileInfo GetFileFromUser() + { + var ofd = new OpenFileDialog(); + if (lastLuaFile.Length > 0) + ofd.FileName = Path.GetFileNameWithoutExtension(lastLuaFile); + ofd.InitialDirectory = Global.Config.LuaPath; + ofd.Filter = "Lua Scripts (*.lua)|*.lua|All Files|*.*"; + ofd.RestoreDirectory = true; - Global.Sound.StopSound(); - var result = ofd.ShowDialog(); - Global.Sound.StartSound(); - if (result != DialogResult.OK) - return null; - var file = new FileInfo(ofd.FileName); - return file; - } + Global.Sound.StopSound(); + var result = ofd.ShowDialog(); + Global.Sound.StartSound(); + if (result != DialogResult.OK) + return null; + var file = new FileInfo(ofd.FileName); + return file; + } - private void LoadLuaFile(string path) - { - LuaFiles l = new LuaFiles("", path, true); - luaList.Add(l); - LuaListView.ItemCount = luaList.Count; - LuaListView.Refresh(); + private void LoadLuaFile(string path) + { + LuaFiles l = new LuaFiles("", path, true); + luaList.Add(l); + LuaListView.ItemCount = luaList.Count; + LuaListView.Refresh(); - LuaImp.DoLuaFile(path); - } + LuaImp.DoLuaFile(path); + } - private void OpenLuaFile() - { - var file = GetFileFromUser(); - if (file != null) - { - LoadLuaFile(file.FullName); - //DisplayLuaList(); - } - } + private void OpenLuaFile() + { + var file = GetFileFromUser(); + if (file != null) + { + LoadLuaFile(file.FullName); + //DisplayLuaList(); + } + } - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - OpenLuaFile(); - } + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenLuaFile(); + } - private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - saveWindowPositionToolStripMenuItem.Checked = Global.Config.LuaConsoleSaveWindowPosition; - } + private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + saveWindowPositionToolStripMenuItem.Checked = Global.Config.LuaConsoleSaveWindowPosition; + } - private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) - { - Global.Config.LuaConsoleSaveWindowPosition ^= true; - } + private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.LuaConsoleSaveWindowPosition ^= true; + } - private void Toggle() - { - ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices; - if (indexes.Count > 0) - { - for (int x = 0; x < indexes.Count; x++) - { - if (luaList[indexes[x]].Enabled) - luaList[indexes[x]].Enabled = false; - else - luaList[indexes[x]].Enabled = true; - } - LuaListView.Refresh(); - } - UpdateNumberOfScripts(); - } + private void Toggle() + { + ListView.SelectedIndexCollection indexes = LuaListView.SelectedIndices; + if (indexes.Count > 0) + { + for (int x = 0; x < indexes.Count; x++) + { + if (luaList[indexes[x]].Enabled) + luaList[indexes[x]].Enabled = false; + else + luaList[indexes[x]].Enabled = true; + } + LuaListView.Refresh(); + } + UpdateNumberOfScripts(); + } - private void UpdateNumberOfScripts() - { - string message = ""; - int active = 0; - for (int x = 0; x < luaList.Count; x++) - { - if (luaList[x].Enabled) - active++; - } + private void UpdateNumberOfScripts() + { + string message = ""; + int active = 0; + for (int x = 0; x < luaList.Count; x++) + { + if (luaList[x].Enabled) + active++; + } - int L = luaList.Count; - if (L == 1) - message += L.ToString() + " cheat (" + active.ToString() + " active)"; - else if (L == 0) - message += L.ToString() + " cheats"; - else - message += L.ToString() + " cheats (" + active.ToString() + " active)"; + int L = luaList.Count; + if (L == 1) + message += L.ToString() + " cheat (" + active.ToString() + " active)"; + else if (L == 0) + message += L.ToString() + " cheats"; + else + message += L.ToString() + " cheats (" + active.ToString() + " active)"; - NumberOfScripts.Text = message; - } + NumberOfScripts.Text = message; + } - private void LuaListView_DoubleClick(object sender, EventArgs e) - { - Toggle(); - } + private void LuaListView_DoubleClick(object sender, EventArgs e) + { + Toggle(); + } - private void LuaListView_SelectedIndexChanged(object sender, EventArgs e) - { + private void LuaListView_SelectedIndexChanged(object sender, EventArgs e) + { - } + } - private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) - { + private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) + { - } + } - private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) - { + private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) + { - } - } + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + } } diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index f1f6e2cb62..2a6a9e591c 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -11,1370 +11,1370 @@ using System.Globalization; namespace BizHawk.MultiClient { - /// - /// A winform designed to display ram address values of the user's choice - /// - public partial class RamWatch : Form - { - //TODO: - //Restore window size should restore column order as well - //When receiving a watch from a different domain, should something be done? - - int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired - int defaultHeight; - int defaultAddressWidth; - int defaultValueWidth; - int defaultPrevWidth; - int defaultChangeWidth; - int NotesWidth; - - string systemID = "NULL"; - MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { }); - List watchList = new List(); - string currentWatchFile = ""; - bool changes = false; - List domainMenuItems = new List(); - - public void Restart() - { - if (!this.IsHandleCreated || this.IsDisposed) return; - NewWatchList(true); - } - - public List GetRamWatchList() - { - List w = new List(); - for (int x = 0; x < watchList.Count; x++) - w.Add(new Watch(watchList[x])); - - return w; - } - - public void DisplayWatchList() - { - WatchListView.ItemCount = watchList.Count; - } - - public void UpdateValues() - { - if (!this.IsHandleCreated || this.IsDisposed) return; - for (int x = 0; x < watchList.Count; x++) - { - watchList[x].prev = watchList[x].value; - watchList[x].PeekAddress(Domain); - if (watchList[x].value != watchList[x].prev) - watchList[x].changecount++; - } - WatchListView.Refresh(); - } - - public void AddWatch(Watch w) - { - watchList.Add(w); - DisplayWatchList(); - } - - private void LoadConfigSettings() - { - ColumnPositionSet(); - - defaultWidth = Size.Width; //Save these first so that the user can restore to its original size - defaultHeight = Size.Height; - defaultAddressWidth = WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width; - defaultValueWidth = WatchListView.Columns[Global.Config.RamWatchValueIndex].Width; - defaultPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; - defaultChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; - NotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; - - - if (Global.Config.RamWatchSaveWindowPosition && Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0) - Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy); - - if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0) - { - Size = new System.Drawing.Size(Global.Config.RamWatchWidth, Global.Config.RamWatchHeight); - } - SetPrevColumn(Global.Config.RamWatchShowPrevColumn); - SetChangesColumn(Global.Config.RamWatchShowChangeColumn); - if (Global.Config.RamWatchAddressWidth > 0) - WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width = Global.Config.RamWatchAddressWidth; - if (Global.Config.RamWatchValueWidth > 0) - WatchListView.Columns[Global.Config.RamWatchValueIndex].Width = Global.Config.RamWatchValueWidth; - if (Global.Config.RamWatchPrevWidth > 0) - WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = Global.Config.RamWatchPrevWidth; - if (Global.Config.RamWatchChangeWidth > 0) - WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = Global.Config.RamWatchChangeWidth; - if (Global.Config.RamWatchNotesWidth > 0) - WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width = Global.Config.RamWatchNotesWidth; - - - } - - public void SaveConfigSettings() - { - ColumnPositionSet(); - Global.Config.RamWatchAddressWidth = WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width; - Global.Config.RamWatchValueWidth = WatchListView.Columns[Global.Config.RamWatchValueIndex].Width; - Global.Config.RamWatchPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; - Global.Config.RamWatchChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; - Global.Config.RamWatchNotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; - - Global.Config.RamWatchWndx = this.Location.X; - Global.Config.RamWatchWndy = this.Location.Y; - Global.Config.RamWatchWidth = this.Right - this.Left; - Global.Config.RamWatchHeight = this.Bottom - this.Top; - } - - public RamWatch() - { - InitializeComponent(); - WatchListView.QueryItemText += new QueryItemTextHandler(WatchListView_QueryItemText); - WatchListView.QueryItemBkColor += new QueryItemBkColorHandler(WatchListView_QueryItemBkColor); - WatchListView.VirtualMode = true; - Closing += (o, e) => SaveConfigSettings(); - } - - protected override void OnClosing(CancelEventArgs e) - { - if (!AskSave()) - e.Cancel = true; - base.OnClosing(e); - } - - private void WatchListView_QueryItemBkColor(int index, int column, ref Color color) - { - if (watchList[index].type == atype.SEPARATOR) - color = this.BackColor; - if (Global.MainForm.Cheats1.IsActiveCheat(Domain, watchList[index].address)) - color = Color.LightCyan; - } - - void WatchListView_QueryItemText(int index, int column, out string text) - { - text = ""; - if (column == 0) //Address - { - if (watchList[index].type == atype.SEPARATOR) - text = ""; - else - text = String.Format("{0:X" + GetNumDigits((Domain.Size - 1)).ToString() + "}", watchList[index].address); - } - if (column == 1) //Value - { - if (watchList[index].type == atype.SEPARATOR) - text = ""; - else - { - switch (watchList[index].signed) - { - case asigned.HEX: - switch (watchList[index].type) - { - case atype.BYTE: - text = String.Format("{0:X2}", watchList[index].value); - break; - case atype.WORD: - text = String.Format("{0:X4}", watchList[index].value); - break; - case atype.DWORD: - text = String.Format("{0:X8}", watchList[index].value); - break; - } - break; - case asigned.SIGNED: - text = ((sbyte)watchList[index].value).ToString(); - break; - case asigned.UNSIGNED: - text = watchList[index].value.ToString(); - break; - } - } - } - if (column == 2) //Prev - { - if (watchList[index].type == atype.SEPARATOR) - text = ""; - else - { - if (Global.Config.RamWatchShowChangeFromPrev) - { - int x = watchList[index].value - watchList[index].prev; - if (x < 0) - text = x.ToString(); - else - text = "+" + x.ToString(); - } - else - { - switch (watchList[index].signed) - { - case asigned.HEX: - switch (watchList[index].type) - { - case atype.BYTE: - text = String.Format("{0:X2}", watchList[index].prev); - break; - case atype.WORD: - text = String.Format("{0:X4}", watchList[index].prev); - break; - case atype.DWORD: - text = String.Format("{0:X8}", watchList[index].prev); - break; - } - break; - case asigned.SIGNED: - text = ((sbyte)watchList[index].prev).ToString(); - break; - case asigned.UNSIGNED: - text = watchList[index].prev.ToString(); - break; - } - } - } - } - if (column == 3) //Change Counts - { - text = watchList[index].changecount.ToString(); - } - if (column == 4) //Notes - { - if (watchList[index].type == atype.SEPARATOR) - text = ""; - else - text = watchList[index].notes; - } - } - - public int HowMany(string str, char c) - { - int count = 0; - for (int x = 0; x < str.Length; x++) - { - if (str[x] == c) - count++; - } - return count; - } - - public bool AskSave() - { - if (changes) - { - DialogResult result = MessageBox.Show("Save Changes?", "Ram Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); - - if (result == DialogResult.Yes) - { - //TOOD: Do quicksave if filename, else save as - if (string.Compare(currentWatchFile, "") == 0) - { - SaveAs(); - } - else - SaveWatchFile(currentWatchFile); - return true; - } - else if (result == DialogResult.No) - return true; - else if (result == DialogResult.Cancel) - return false; - } - return true; - } - - public void LoadWatchFromRecent(string file) - { - bool z = true; - if (changes) z = AskSave(); - - if (z) - { - bool r = LoadWatchFile(file, false); - if (!r) - { - DialogResult result = MessageBox.Show("Could not open " + file + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); - if (result == DialogResult.Yes) - Global.Config.RecentWatches.Remove(file); - } - DisplayWatchList(); - changes = false; - } - } - - private void NewWatchList(bool suppressAsk) - { - bool result = true; - if (changes) result = AskSave(); - - if (result == true || suppressAsk) - { - watchList.Clear(); - DisplayWatchList(); - currentWatchFile = ""; - changes = false; - MessageLabel.Text = ""; - } - } - - private bool SaveWatchFile(string path) - { - var file = new FileInfo(path); - - using (StreamWriter sw = new StreamWriter(path)) - { - string str = "Domain " + Domain.Name + "\n"; - - for (int x = 0; x < watchList.Count; x++) - { - str += string.Format("{0:X4}", watchList[x].address) + "\t"; - str += watchList[x].GetTypeByChar().ToString() + "\t"; - str += watchList[x].GetSignedByChar().ToString() + "\t"; - - if (watchList[x].bigendian == true) - str += "1\t"; - else - str += "0\t"; - - str += watchList[x].notes + "\n"; - } - - sw.WriteLine(str); - } - changes = false; - return true; - } - - private int GetDomainPos(string name) - { - //Attempts to find the memory domain by name, if it fails, it defaults to index 0 - for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) - { - if (Global.Emulator.MemoryDomains[x].Name == name) - return x; - } - return 0; - } - - public bool LoadWatchFile(string path, bool append) - { - int y, z; - var file = new FileInfo(path); - if (file.Exists == false) return false; - - using (StreamReader sr = file.OpenText()) - { - if (!append) - currentWatchFile = path; - - int count = 0; - string s = ""; - string temp = ""; - - if (append == false) - watchList.Clear(); //Wipe existing list and read from file - - while ((s = sr.ReadLine()) != null) - { - //parse each line and add to watchList - - //.wch files from other emulators start with a number representing the number of watch, that line can be discarded here - //Any properly formatted line couldn't possibly be this short anyway, this also takes care of any garbage lines that might be in a file - if (s.Length < 5) continue; - - if (s.Substring(0, 6) == "Domain") - SetMemoryDomain(GetDomainPos(s.Substring(7, s.Length - 7))); - - z = HowMany(s, '\t'); - if (z == 5) - { - //If 5, then this is a .wch file format made from another emulator, the first column (watch position) is not needed here - y = s.IndexOf('\t') + 1; - s = s.Substring(y, s.Length - y); //5 digit value representing the watch position number - } - else if (z != 4) - continue; //If not 4, something is wrong with this line, ignore it - count++; - Watch w = new Watch(); - - temp = s.Substring(0, s.IndexOf('\t')); - w.address = int.Parse(temp, NumberStyles.HexNumber); - - y = s.IndexOf('\t') + 1; - s = s.Substring(y, s.Length - y); //Type - w.SetTypeByChar(s[0]); - - y = s.IndexOf('\t') + 1; - s = s.Substring(y, s.Length - y); //Signed - w.SetSignedByChar(s[0]); - - y = s.IndexOf('\t') + 1; - s = s.Substring(y, s.Length - y); //Endian - y = Int16.Parse(s[0].ToString()); - if (y == 0) - w.bigendian = false; - else - w.bigendian = true; - - w.notes = s.Substring(2, s.Length - 2); //User notes - - watchList.Add(w); - } - - Global.Config.RecentWatches.Add(file.FullName); - changes = false; - MessageLabel.Text = Path.GetFileName(file.FullName); - //Update the number of watches - WatchCountLabel.Text = count.ToString() + " watches"; - } - - return true; - } - - private Point GetPromptPoint() - { - - Point p = new Point(WatchListView.Location.X, WatchListView.Location.Y); - Point q = new Point(); - q = PointToScreen(p); - return q; - } - - void AddNewWatch() - { - - RamWatchNewWatch r = new RamWatchNewWatch(); - r.location = GetPromptPoint(); - - r.ShowDialog(); - if (r.userSelected == true) - { - watchList.Add(r.watch); - DisplayWatchList(); //TODO: Do I need these calls? - } - } - - void Changes() - { - changes = true; - MessageLabel.Text = Path.GetFileName(currentWatchFile) + " *"; - } - - void EditWatchObject(int pos) - { - RamWatchNewWatch r = new RamWatchNewWatch(); - r.location = GetPromptPoint(); - r.SetToEditWatch(watchList[pos], "Edit Watch"); - r.ShowDialog(); - - if (r.userSelected == true) - { - Changes(); - watchList[pos] = r.watch; - DisplayWatchList(); - } - } - - void EditWatch() - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - EditWatchObject(indexes[0]); - } - - void RemoveWatch() - { - Changes(); - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - foreach (int index in indexes) - { - watchList.Remove(watchList[indexes[0]]); //index[0] used since each iteration will make this the correct list index - } - DisplayWatchList(); - } - } - - void DuplicateWatch() - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - RamWatchNewWatch r = new RamWatchNewWatch(); - r.location = GetPromptPoint(); - int x = indexes[0]; - r.SetToEditWatch(watchList[x], "Duplicate Watch"); - r.ShowDialog(); - - if (r.userSelected == true) - { - Changes(); - watchList.Add(r.watch); - DisplayWatchList(); - } - } - } - - void MoveUp() - { - if (WatchListView.SelectedIndices.Count == 0) - return; - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - Watch temp = new Watch(); - if (indexes.Count == 0) return; - foreach (int index in indexes) - { - temp = watchList[index]; - watchList.Remove(watchList[index]); - watchList.Insert(index - 1, temp); - - //Note: here it will get flagged many times redundantly potentially, - //but this avoids it being flagged falsely when the user did not select an index - Changes(); - } - List i = new List(); - for (int z = 0; z < indexes.Count; z++) - i.Add(indexes[z]-1); - - WatchListView.SelectedIndices.Clear(); - for (int z = 0; z < i.Count; z++) - WatchListView.SelectItem(i[z], true); - - - DisplayWatchList(); - } - - void MoveDown() - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - Watch temp = new Watch(); - if (indexes.Count == 0) return; - foreach (int index in indexes) - { - temp = watchList[index]; - - if (index < watchList.Count - 1) - { - - watchList.Remove(watchList[index]); - watchList.Insert(index + 1, temp); - - } - - //Note: here it will get flagged many times redundantly potnetially, - //but this avoids it being flagged falsely when the user did not select an index - Changes(); - } - - List i = new List(); - for (int z = 0; z < indexes.Count; z++) - i.Add(indexes[z] + 1); - - WatchListView.SelectedIndices.Clear(); - for (int z = 0; z < i.Count; z++) - WatchListView.SelectItem(i[z], true); - - DisplayWatchList(); - } - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!AskSave()) - return; - - this.Close(); - } - - private void newListToolStripMenuItem_Click(object sender, EventArgs e) - { - NewWatchList(false); - } - - private FileInfo GetFileFromUser() - { - var ofd = new OpenFileDialog(); - if (currentWatchFile.Length > 0) - ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); - ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; - ofd.RestoreDirectory = true; - - Global.Sound.StopSound(); - var result = ofd.ShowDialog(); - Global.Sound.StartSound(); - if (result != DialogResult.OK) - return null; - var file = new FileInfo(ofd.FileName); - return file; - } - - private void OpenWatchFile() - { - var file = GetFileFromUser(); - if (file != null) - { - bool r = true; - if (changes) r = AskSave(); - if (r) - { - LoadWatchFile(file.FullName, false); - DisplayWatchList(); - } - } - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - OpenWatchFile(); - } - - private void saveToolStripMenuItem_Click(object sender, EventArgs e) - { - if (string.Compare(currentWatchFile, "") == 0) return; - - if (changes) - SaveWatchFile(currentWatchFile); - } - - private FileInfo GetSaveFileFromUser() - { - var sfd = new SaveFileDialog(); - if (currentWatchFile.Length > 0) - { - sfd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); - sfd.InitialDirectory = Path.GetDirectoryName(currentWatchFile); - } - else if (!(Global.Emulator is NullEmulator)) - { - sfd.FileName = Global.Game.Name; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); - } - else - { - sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); - } - sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; - sfd.RestoreDirectory = true; - Global.Sound.StopSound(); - var result = sfd.ShowDialog(); - Global.Sound.StartSound(); - if (result != DialogResult.OK) - return null; - var file = new FileInfo(sfd.FileName); - return file; - } - - private void SaveAs() - { - var file = GetSaveFileFromUser(); - if (file != null) - { - SaveWatchFile(file.FullName); - currentWatchFile = file.FullName; - MessageLabel.Text = Path.GetFileName(currentWatchFile) + " saved."; - } - } - - private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) - { - SaveAs(); - } - - private void appendFileToolStripMenuItem_Click(object sender, EventArgs e) - { - var file = GetFileFromUser(); - if (file != null) - LoadWatchFile(file.FullName, true); - DisplayWatchList(); - Changes(); - } - - private void autoLoadToolStripMenuItem_Click(object sender, EventArgs e) - { - UpdateAutoLoadRamWatch(); - } - - private void newWatchToolStripMenuItem_Click(object sender, EventArgs e) - { - AddNewWatch(); - } - - private void editWatchToolStripMenuItem_Click(object sender, EventArgs e) - { - EditWatch(); - } - - private void removeWatchToolStripMenuItem_Click(object sender, EventArgs e) - { - RemoveWatch(); - } - - private void duplicateWatchToolStripMenuItem_Click(object sender, EventArgs e) - { - DuplicateWatch(); - } - - private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) - { - MoveUp(); - } - - private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) - { - MoveDown(); - } - - private void RamWatch_Load(object sender, EventArgs e) - { - LoadConfigSettings(); - SetMemoryDomainMenu(); - } - - private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - if (Global.Config.AutoLoadRamWatch == true) - autoLoadToolStripMenuItem.Checked = true; - else - autoLoadToolStripMenuItem.Checked = false; - - if (string.Compare(currentWatchFile, "") == 0 || !changes) - { - saveToolStripMenuItem.Enabled = false; - } - else - { - saveToolStripMenuItem.Enabled = true; - } - } - - private void UpdateAutoLoadRamWatch() - { - autoLoadToolStripMenuItem.Checked = Global.Config.AutoLoadRamWatch ^= true; - } - private void recentToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - //Clear out recent Roms list - //repopulate it with an up to date list - recentToolStripMenuItem.DropDownItems.Clear(); - - if (Global.Config.RecentWatches.IsEmpty()) - { - var none = new ToolStripMenuItem(); - none.Enabled = false; - none.Text = "None"; - recentToolStripMenuItem.DropDownItems.Add(none); - } - else - { - for (int x = 0; x < Global.Config.RecentWatches.Length(); x++) - { - string path = Global.Config.RecentWatches.GetRecentFileByPosition(x); - var item = new ToolStripMenuItem(); - item.Text = path; - item.Click += (o, ev) => LoadWatchFromRecent(path); - recentToolStripMenuItem.DropDownItems.Add(item); - } - } - - recentToolStripMenuItem.DropDownItems.Add("-"); - - var clearitem = new ToolStripMenuItem(); - clearitem.Text = "&Clear"; - clearitem.Click += (o, ev) => Global.Config.RecentWatches.Clear(); - recentToolStripMenuItem.DropDownItems.Add(clearitem); - - var auto = new ToolStripMenuItem(); - auto.Text = "&Auto-Load"; - auto.Click += (o, ev) => UpdateAutoLoadRamWatch(); - if (Global.Config.AutoLoadRamWatch == true) - auto.Checked = true; - else - auto.Checked = false; - recentToolStripMenuItem.DropDownItems.Add(auto); - } - - private void WatchListView_AfterLabelEdit(object sender, LabelEditEventArgs e) - { - if (e.Label == null) //If no change - return; - string Str = e.Label.ToUpper().Trim(); - int index = e.Item; - - if (InputValidate.IsValidHexNumber(Str)) - { - watchList[e.Item].address = int.Parse(Str, NumberStyles.HexNumber); - EditWatchObject(index); - } - else - { - MessageBox.Show("Invalid number!"); //TODO: More parameters and better message - WatchListView.Items[index].Text = watchList[index].address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes - } - } - - private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) - { - this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); - - Global.Config.RamWatchAddressIndex = 0; - Global.Config.RamWatchValueIndex = 1; - Global.Config.RamWatchPrevIndex = 2; - Global.Config.RamWatchChangeIndex = 3; - Global.Config.RamWatchNotesIndex = 4; - ColumnPositionSet(); - - showPreviousValueToolStripMenuItem.Checked = false; - Global.Config.RamWatchShowPrevColumn = false; - showChangeCountsToolStripMenuItem.Checked = true; - Global.Config.RamWatchShowChangeColumn = true; - WatchListView.Columns[0].Width = defaultAddressWidth; - WatchListView.Columns[1].Width = defaultValueWidth; - WatchListView.Columns[2].Width = 0; - WatchListView.Columns[3].Width = defaultChangeWidth; - WatchListView.Columns[4].Width = NotesWidth; - } - - private void newToolStripButton_Click(object sender, EventArgs e) - { - NewWatchList(false); - } - - private void openToolStripButton_Click(object sender, EventArgs e) - { - OpenWatchFile(); - } - - private void saveToolStripButton_Click(object sender, EventArgs e) - { - if (changes) - { - SaveWatchFile(currentWatchFile); - } - else - { - SaveAs(); - } - } - - private void InsertSeparator() - { - Watch w = new Watch(); - w.type = atype.SEPARATOR; - - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - int x; - if (indexes.Count > 0) - { - x = indexes[0]; - if (indexes[0] > 0) - watchList.Insert(indexes[0], w); - } - else - watchList.Add(w); - DisplayWatchList(); - } - - private void cutToolStripButton_Click(object sender, EventArgs e) - { - RemoveWatch(); - } - - private void NewWatchStripButton1_Click(object sender, EventArgs e) - { - AddNewWatch(); - } - - private void MoveUpStripButton1_Click(object sender, EventArgs e) - { - MoveUp(); - } - - private void MoveDownStripButton1_Click(object sender, EventArgs e) - { - MoveDown(); - } - - private void EditWatchToolStripButton1_Click(object sender, EventArgs e) - { - EditWatch(); - } - - private void DuplicateWatchToolStripButton_Click(object sender, EventArgs e) - { - DuplicateWatch(); - } - - private void toolStripButton1_Click(object sender, EventArgs e) - { - InsertSeparator(); - } - - private void insertSeparatorToolStripMenuItem_Click(object sender, EventArgs e) - { - InsertSeparator(); - } - - private void PoketoolStripButton2_Click(object sender, EventArgs e) - { - PokeAddress(); - } - - private void PokeAddress() - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - RamPoke p = new RamPoke(); - - if (indexes.Count > 0) - p.SetWatchObject(watchList[indexes[0]]); - p.location = GetPromptPoint(); - p.ShowDialog(); - } - - private void pokeAddressToolStripMenuItem_Click(object sender, EventArgs e) - { - PokeAddress(); - } - - private void watchesToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - editWatchToolStripMenuItem.Enabled = true; - duplicateWatchToolStripMenuItem.Enabled = true; - removeWatchToolStripMenuItem.Enabled = true; - moveUpToolStripMenuItem.Enabled = true; - moveDownToolStripMenuItem.Enabled = true; - pokeAddressToolStripMenuItem.Enabled = true; - freezeAddressToolStripMenuItem.Enabled = true; - } - else - { - editWatchToolStripMenuItem.Enabled = false; - duplicateWatchToolStripMenuItem.Enabled = false; - removeWatchToolStripMenuItem.Enabled = false; - moveUpToolStripMenuItem.Enabled = false; - moveDownToolStripMenuItem.Enabled = false; - pokeAddressToolStripMenuItem.Enabled = false; - freezeAddressToolStripMenuItem.Enabled = false; - } - } - - private void editToolStripMenuItem_Click(object sender, EventArgs e) - { - EditWatch(); - } - - private void removeToolStripMenuItem_Click(object sender, EventArgs e) - { - RemoveWatch(); - } - - private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) - { - DuplicateWatch(); - } - - private void pokeToolStripMenuItem_Click(object sender, EventArgs e) - { - PokeAddress(); - } - - private void insertSeperatorToolStripMenuItem_Click(object sender, EventArgs e) - { - InsertSeparator(); - } - - private void moveUpToolStripMenuItem1_Click(object sender, EventArgs e) - { - MoveUp(); - } - - private void moveDownToolStripMenuItem1_Click(object sender, EventArgs e) - { - MoveDown(); - } - - private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count == 0) - { - contextMenuStrip1.Items[0].Visible = false; - contextMenuStrip1.Items[1].Visible = false; - contextMenuStrip1.Items[2].Visible = false; - contextMenuStrip1.Items[3].Visible = false; - contextMenuStrip1.Items[4].Visible = false; - contextMenuStrip1.Items[5].Visible = false; - contextMenuStrip1.Items[6].Visible = false; - contextMenuStrip1.Items[8].Visible = false; - contextMenuStrip1.Items[9].Visible = false; - - } - else - { - for (int x = 0; x < contextMenuStrip1.Items.Count; x++) - contextMenuStrip1.Items[x].Visible = true; - } - - if (Global.Config.RamWatchShowChangeColumn) - contextMenuStrip1.Items[11].Text = "Hide change counts"; - else - contextMenuStrip1.Items[11].Text = "Show change counts"; - - if (Global.Config.RamWatchShowPrevColumn) - contextMenuStrip1.Items[12].Text = "Hide previous value"; - else - contextMenuStrip1.Items[12].Text = "Show previous value"; - - if (Global.Config.RamWatchShowChangeFromPrev) - contextMenuStrip1.Items[13].Text = "Display Previous value as previous"; - else - contextMenuStrip1.Items[13].Text = "Display Previosu value as change amount"; - } - - private void WatchListView_MouseDoubleClick(object sender, MouseEventArgs e) - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - EditWatch(); - } - } - - private void RamWatch_DragDrop(object sender, DragEventArgs e) - { - string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); - if (Path.GetExtension(filePaths[0]) == (".wch")) - { - LoadWatchFile(filePaths[0], false); - DisplayWatchList(); - } - } - - private void RamWatch_DragEnter(object sender, DragEventArgs e) - { - e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;string[] filePaths = (string[]) e.Data.GetData(DataFormats.FileDrop); - } - - private void ClearChangeCounts() - { - for (int x = 0; x < watchList.Count; x++) - watchList[x].changecount = 0; - DisplayWatchList(); - MessageLabel.Text = "Change counts cleared"; - } - - private void ClearChangeCountstoolStripButton_Click(object sender, EventArgs e) - { - ClearChangeCounts(); - } - - private void clearChangeCountsToolStripMenuItem_Click(object sender, EventArgs e) - { - ClearChangeCounts(); - } - - - - private void showChangeCountsToolStripMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowChangeColumn ^= true; - SetChangesColumn(Global.Config.RamWatchShowChangeColumn); - } - - private void SetChangesColumn(bool show) - { - Global.Config.RamWatchShowChangeColumn = show; - showChangeCountsToolStripMenuItem.Checked = show; - if (show) - WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = 54; - else - WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = 0; - } - - private void SetPrevColumn(bool show) - { - Global.Config.RamWatchShowPrevColumn = show; - showPreviousValueToolStripMenuItem.Checked = show; - if (show) - WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = 59; - else - WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = 0; - } - - private void showPreviousValueToolStripMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowPrevColumn ^= true; - SetPrevColumn(Global.Config.RamWatchShowPrevColumn); - } - - private void prevValueShowsChangeAmountToolStripMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowChangeFromPrev ^= true; - DisplayWatchList(); - } - - private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev; - } - - private void viewInHexEditorToolStripMenuItem_Click(object sender, EventArgs e) - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - Global.MainForm.LoadHexEditor(); - Global.MainForm.HexEditor1.GoToAddress(watchList[indexes[0]].address); - } - } - - private int GetNumDigits(Int32 i) - { - //if (i == 0) return 0; - //if (i < 0x10) return 1; - //if (i < 0x100) return 2; - //if (i < 0x1000) return 3; //adelikat: commenting these out because I decided that regardless of domain, 4 digits should be the minimum - if (i < 0x10000) return 4; - if (i < 0x1000000) return 6; - else return 8; - } - - private void freezeToolStripMenuItem_Click(object sender, EventArgs e) - { - FreezeAddress(); - } - - private int WORDGetLowerByte(int value) - { - return value / 256; - } - - private int WORDGetUpperByte(int value) - { - return value >> 2; - } - - private void FreezeAddress() - { - ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; - if (indexes.Count > 0) - { - switch (watchList[indexes[0]].type) - { - case atype.BYTE: - Cheat c = new Cheat("", watchList[indexes[0]].address, (byte)watchList[indexes[0]].value, - true, Domain); - Global.MainForm.Cheats1.AddCheat(c); - break; - case atype.WORD: - { - byte low = (byte)(watchList[indexes[0]].value / 256); - byte high = (byte)(watchList[indexes[0]].value); - int a1 = watchList[indexes[0]].address; - int a2 = watchList[indexes[0]].address + 1; - if (watchList[indexes[0]].bigendian) - { - Cheat c1 = new Cheat("", a1, low, true, Domain); - Cheat c2 = new Cheat("", a2, high, true, Domain); - Global.MainForm.Cheats1.AddCheat(c1); - Global.MainForm.Cheats1.AddCheat(c2); - } - else - { - Cheat c1 = new Cheat("", a1, high, true, Domain); - Cheat c2 = new Cheat("", a2, low, true, Domain); - Global.MainForm.Cheats1.AddCheat(c1); - Global.MainForm.Cheats1.AddCheat(c2); - } - } - break; - case atype.DWORD: - { - byte HIWORDhigh = (byte)(watchList[indexes[0]].value / 0x1000000); - byte HIWORDlow = (byte)(watchList[indexes[0]].value / 0x10000); - byte LOWORDhigh = (byte)(watchList[indexes[0]].value / 0x100); - byte LOWORDlow = (byte)(watchList[indexes[0]].value); - int a1 = watchList[indexes[0]].address; - int a2 = watchList[indexes[0]].address + 1; - int a3 = watchList[indexes[0]].address + 2; - int a4 = watchList[indexes[0]].address + 3; - if (watchList[indexes[0]].bigendian) - { - Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain); - Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain); - Cheat c3 = new Cheat("", a3, LOWORDhigh, true, Domain); - Cheat c4 = new Cheat("", a4, LOWORDlow, true, Domain); - Global.MainForm.Cheats1.AddCheat(c1); - Global.MainForm.Cheats1.AddCheat(c2); - Global.MainForm.Cheats1.AddCheat(c3); - Global.MainForm.Cheats1.AddCheat(c4); - } - else - { - Cheat c1 = new Cheat("", a1, LOWORDlow, true, Domain); - Cheat c2 = new Cheat("", a2, LOWORDhigh, true, Domain); - Cheat c3 = new Cheat("", a3, HIWORDlow, true, Domain); - Cheat c4 = new Cheat("", a4, HIWORDhigh, true, Domain); - Global.MainForm.Cheats1.AddCheat(c1); - Global.MainForm.Cheats1.AddCheat(c2); - Global.MainForm.Cheats1.AddCheat(c3); - Global.MainForm.Cheats1.AddCheat(c4); - } - } - break; - } - } - } - - private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e) - { - FreezeAddress(); - } - - private void FreezetoolStripButton2_Click(object sender, EventArgs e) - { - FreezeAddress(); - } - - private void SetPlatformAndMemoryDomainLabel() - { - string memoryDomain = Domain.ToString(); - systemID = Global.Emulator.SystemId; - MemDomainLabel.Text = systemID + " " + memoryDomain; - } - - private void SetMemoryDomain(int pos) - { - if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check - { - Domain = Global.Emulator.MemoryDomains[pos]; - } - SetPlatformAndMemoryDomainLabel(); - Update(); - } - - private void SetMemoryDomainMenu() - { - memoryDomainsToolStripMenuItem.DropDownItems.Clear(); - if (Global.Emulator.MemoryDomains.Count > 0) - { - for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) - { - string str = Global.Emulator.MemoryDomains[x].ToString(); - var item = new ToolStripMenuItem(); - item.Text = str; - { - int z = x; - item.Click += (o, ev) => SetMemoryDomain(z); - } - if (x == 0) - { - SetMemoryDomain(x); - } - memoryDomainsToolStripMenuItem.DropDownItems.Add(item); - domainMenuItems.Add(item); - } - } - else - memoryDomainsToolStripMenuItem.Enabled = false; - } - - private void CheckDomainMenuItems() - { - for (int x = 0; x < domainMenuItems.Count; x++) - { - if (Domain.Name == domainMenuItems[x].Text) - domainMenuItems[x].Checked = true; - else - domainMenuItems[x].Checked = false; - } - } - - private void memoryDomainsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) - { - CheckDomainMenuItems(); - } - - private void ColumnReorder(object sender, ColumnReorderedEventArgs e) - { - ColumnHeader header = e.Header; - - int lowIndex = 0; - int highIndex = 0; - int changeIndex = 0; - if (e.NewDisplayIndex > e.OldDisplayIndex) - { - changeIndex = -1; - highIndex = e.NewDisplayIndex; - lowIndex = e.OldDisplayIndex; - } - else - { - changeIndex = 1; - highIndex = e.OldDisplayIndex; - lowIndex = e.NewDisplayIndex; - } - - if (Global.Config.RamWatchAddressIndex >= lowIndex && Global.Config.RamWatchAddressIndex <= highIndex) - Global.Config.RamWatchAddressIndex += changeIndex; - if (Global.Config.RamWatchValueIndex >= lowIndex && Global.Config.RamWatchValueIndex <= highIndex) - Global.Config.RamWatchValueIndex += changeIndex; - if (Global.Config.RamWatchPrevIndex >= lowIndex && Global.Config.RamWatchPrevIndex <= highIndex) - Global.Config.RamWatchPrevIndex += changeIndex; - if (Global.Config.RamWatchChangeIndex >= lowIndex && Global.Config.RamWatchChangeIndex <= highIndex) - Global.Config.RamWatchChangeIndex += changeIndex; - if (Global.Config.RamWatchNotesIndex >= lowIndex && Global.Config.RamWatchNotesIndex <= highIndex) - Global.Config.RamWatchNotesIndex += changeIndex; - - if(header.Text == "Address") - Global.Config.RamWatchAddressIndex = e.NewDisplayIndex; - else if (header.Text == "Value") - Global.Config.RamWatchValueIndex = e.NewDisplayIndex; - else if (header.Text == "Prev") - Global.Config.RamWatchPrevIndex = e.NewDisplayIndex; - else if (header.Text == "Changes") - Global.Config.RamWatchChangeIndex = e.NewDisplayIndex; - else if (header.Text == "Notes") - Global.Config.RamWatchNotesIndex = e.NewDisplayIndex; - } - - private void ColumnPositionSet() - { - List columnHeaders = new List(); - int i = 0; - for (i = 0; i < WatchListView.Columns.Count; i++) - columnHeaders.Add(WatchListView.Columns[i]); - - WatchListView.Columns.Clear(); - - i = 0; - do - { - string column = ""; - if (Global.Config.RamWatchAddressIndex == i) - column = "Address"; - else if (Global.Config.RamWatchValueIndex == i) - column = "Value"; - else if (Global.Config.RamWatchPrevIndex == i) - column = "Prev"; - else if (Global.Config.RamWatchChangeIndex == i) - column = "Changes"; - else if (Global.Config.RamWatchNotesIndex == i) - column = "Notes"; - - for (int k = 0; k < columnHeaders.Count(); k++) - { - if (columnHeaders[k].Text == column) - { - WatchListView.Columns.Add(columnHeaders[k]); - columnHeaders.Remove(columnHeaders[k]); - break; - } - } - i++; - } while (columnHeaders.Count() > 0); - } - } + /// + /// A winform designed to display ram address values of the user's choice + /// + public partial class RamWatch : Form + { + //TODO: + //Restore window size should restore column order as well + //When receiving a watch from a different domain, should something be done? + + int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired + int defaultHeight; + int defaultAddressWidth; + int defaultValueWidth; + int defaultPrevWidth; + int defaultChangeWidth; + int NotesWidth; + + string systemID = "NULL"; + MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { }); + List watchList = new List(); + string currentWatchFile = ""; + bool changes = false; + List domainMenuItems = new List(); + + public void Restart() + { + if (!this.IsHandleCreated || this.IsDisposed) return; + NewWatchList(true); + } + + public List GetRamWatchList() + { + List w = new List(); + for (int x = 0; x < watchList.Count; x++) + w.Add(new Watch(watchList[x])); + + return w; + } + + public void DisplayWatchList() + { + WatchListView.ItemCount = watchList.Count; + } + + public void UpdateValues() + { + if (!this.IsHandleCreated || this.IsDisposed) return; + for (int x = 0; x < watchList.Count; x++) + { + watchList[x].prev = watchList[x].value; + watchList[x].PeekAddress(Domain); + if (watchList[x].value != watchList[x].prev) + watchList[x].changecount++; + } + WatchListView.Refresh(); + } + + public void AddWatch(Watch w) + { + watchList.Add(w); + DisplayWatchList(); + } + + private void LoadConfigSettings() + { + ColumnPositionSet(); + + defaultWidth = Size.Width; //Save these first so that the user can restore to its original size + defaultHeight = Size.Height; + defaultAddressWidth = WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width; + defaultValueWidth = WatchListView.Columns[Global.Config.RamWatchValueIndex].Width; + defaultPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; + defaultChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; + NotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; + + + if (Global.Config.RamWatchSaveWindowPosition && Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0) + Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy); + + if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0) + { + Size = new System.Drawing.Size(Global.Config.RamWatchWidth, Global.Config.RamWatchHeight); + } + SetPrevColumn(Global.Config.RamWatchShowPrevColumn); + SetChangesColumn(Global.Config.RamWatchShowChangeColumn); + if (Global.Config.RamWatchAddressWidth > 0) + WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width = Global.Config.RamWatchAddressWidth; + if (Global.Config.RamWatchValueWidth > 0) + WatchListView.Columns[Global.Config.RamWatchValueIndex].Width = Global.Config.RamWatchValueWidth; + if (Global.Config.RamWatchPrevWidth > 0) + WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = Global.Config.RamWatchPrevWidth; + if (Global.Config.RamWatchChangeWidth > 0) + WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = Global.Config.RamWatchChangeWidth; + if (Global.Config.RamWatchNotesWidth > 0) + WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width = Global.Config.RamWatchNotesWidth; + + + } + + public void SaveConfigSettings() + { + ColumnPositionSet(); + Global.Config.RamWatchAddressWidth = WatchListView.Columns[Global.Config.RamWatchAddressIndex].Width; + Global.Config.RamWatchValueWidth = WatchListView.Columns[Global.Config.RamWatchValueIndex].Width; + Global.Config.RamWatchPrevWidth = WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width; + Global.Config.RamWatchChangeWidth = WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width; + Global.Config.RamWatchNotesWidth = WatchListView.Columns[Global.Config.RamWatchNotesIndex].Width; + + Global.Config.RamWatchWndx = this.Location.X; + Global.Config.RamWatchWndy = this.Location.Y; + Global.Config.RamWatchWidth = this.Right - this.Left; + Global.Config.RamWatchHeight = this.Bottom - this.Top; + } + + public RamWatch() + { + InitializeComponent(); + WatchListView.QueryItemText += new QueryItemTextHandler(WatchListView_QueryItemText); + WatchListView.QueryItemBkColor += new QueryItemBkColorHandler(WatchListView_QueryItemBkColor); + WatchListView.VirtualMode = true; + Closing += (o, e) => SaveConfigSettings(); + } + + protected override void OnClosing(CancelEventArgs e) + { + if (!AskSave()) + e.Cancel = true; + base.OnClosing(e); + } + + private void WatchListView_QueryItemBkColor(int index, int column, ref Color color) + { + if (watchList[index].type == atype.SEPARATOR) + color = this.BackColor; + if (Global.MainForm.Cheats1.IsActiveCheat(Domain, watchList[index].address)) + color = Color.LightCyan; + } + + void WatchListView_QueryItemText(int index, int column, out string text) + { + text = ""; + if (column == 0) //Address + { + if (watchList[index].type == atype.SEPARATOR) + text = ""; + else + text = String.Format("{0:X" + GetNumDigits((Domain.Size - 1)).ToString() + "}", watchList[index].address); + } + if (column == 1) //Value + { + if (watchList[index].type == atype.SEPARATOR) + text = ""; + else + { + switch (watchList[index].signed) + { + case asigned.HEX: + switch (watchList[index].type) + { + case atype.BYTE: + text = String.Format("{0:X2}", watchList[index].value); + break; + case atype.WORD: + text = String.Format("{0:X4}", watchList[index].value); + break; + case atype.DWORD: + text = String.Format("{0:X8}", watchList[index].value); + break; + } + break; + case asigned.SIGNED: + text = ((sbyte)watchList[index].value).ToString(); + break; + case asigned.UNSIGNED: + text = watchList[index].value.ToString(); + break; + } + } + } + if (column == 2) //Prev + { + if (watchList[index].type == atype.SEPARATOR) + text = ""; + else + { + if (Global.Config.RamWatchShowChangeFromPrev) + { + int x = watchList[index].value - watchList[index].prev; + if (x < 0) + text = x.ToString(); + else + text = "+" + x.ToString(); + } + else + { + switch (watchList[index].signed) + { + case asigned.HEX: + switch (watchList[index].type) + { + case atype.BYTE: + text = String.Format("{0:X2}", watchList[index].prev); + break; + case atype.WORD: + text = String.Format("{0:X4}", watchList[index].prev); + break; + case atype.DWORD: + text = String.Format("{0:X8}", watchList[index].prev); + break; + } + break; + case asigned.SIGNED: + text = ((sbyte)watchList[index].prev).ToString(); + break; + case asigned.UNSIGNED: + text = watchList[index].prev.ToString(); + break; + } + } + } + } + if (column == 3) //Change Counts + { + text = watchList[index].changecount.ToString(); + } + if (column == 4) //Notes + { + if (watchList[index].type == atype.SEPARATOR) + text = ""; + else + text = watchList[index].notes; + } + } + + public int HowMany(string str, char c) + { + int count = 0; + for (int x = 0; x < str.Length; x++) + { + if (str[x] == c) + count++; + } + return count; + } + + public bool AskSave() + { + if (changes) + { + DialogResult result = MessageBox.Show("Save Changes?", "Ram Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); + + if (result == DialogResult.Yes) + { + //TOOD: Do quicksave if filename, else save as + if (string.Compare(currentWatchFile, "") == 0) + { + SaveAs(); + } + else + SaveWatchFile(currentWatchFile); + return true; + } + else if (result == DialogResult.No) + return true; + else if (result == DialogResult.Cancel) + return false; + } + return true; + } + + public void LoadWatchFromRecent(string file) + { + bool z = true; + if (changes) z = AskSave(); + + if (z) + { + bool r = LoadWatchFile(file, false); + if (!r) + { + DialogResult result = MessageBox.Show("Could not open " + file + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); + if (result == DialogResult.Yes) + Global.Config.RecentWatches.Remove(file); + } + DisplayWatchList(); + changes = false; + } + } + + private void NewWatchList(bool suppressAsk) + { + bool result = true; + if (changes) result = AskSave(); + + if (result == true || suppressAsk) + { + watchList.Clear(); + DisplayWatchList(); + currentWatchFile = ""; + changes = false; + MessageLabel.Text = ""; + } + } + + private bool SaveWatchFile(string path) + { + var file = new FileInfo(path); + + using (StreamWriter sw = new StreamWriter(path)) + { + string str = "Domain " + Domain.Name + "\n"; + + for (int x = 0; x < watchList.Count; x++) + { + str += string.Format("{0:X4}", watchList[x].address) + "\t"; + str += watchList[x].GetTypeByChar().ToString() + "\t"; + str += watchList[x].GetSignedByChar().ToString() + "\t"; + + if (watchList[x].bigendian == true) + str += "1\t"; + else + str += "0\t"; + + str += watchList[x].notes + "\n"; + } + + sw.WriteLine(str); + } + changes = false; + return true; + } + + private int GetDomainPos(string name) + { + //Attempts to find the memory domain by name, if it fails, it defaults to index 0 + for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) + { + if (Global.Emulator.MemoryDomains[x].Name == name) + return x; + } + return 0; + } + + public bool LoadWatchFile(string path, bool append) + { + int y, z; + var file = new FileInfo(path); + if (file.Exists == false) return false; + + using (StreamReader sr = file.OpenText()) + { + if (!append) + currentWatchFile = path; + + int count = 0; + string s = ""; + string temp = ""; + + if (append == false) + watchList.Clear(); //Wipe existing list and read from file + + while ((s = sr.ReadLine()) != null) + { + //parse each line and add to watchList + + //.wch files from other emulators start with a number representing the number of watch, that line can be discarded here + //Any properly formatted line couldn't possibly be this short anyway, this also takes care of any garbage lines that might be in a file + if (s.Length < 5) continue; + + if (s.Substring(0, 6) == "Domain") + SetMemoryDomain(GetDomainPos(s.Substring(7, s.Length - 7))); + + z = HowMany(s, '\t'); + if (z == 5) + { + //If 5, then this is a .wch file format made from another emulator, the first column (watch position) is not needed here + y = s.IndexOf('\t') + 1; + s = s.Substring(y, s.Length - y); //5 digit value representing the watch position number + } + else if (z != 4) + continue; //If not 4, something is wrong with this line, ignore it + count++; + Watch w = new Watch(); + + temp = s.Substring(0, s.IndexOf('\t')); + w.address = int.Parse(temp, NumberStyles.HexNumber); + + y = s.IndexOf('\t') + 1; + s = s.Substring(y, s.Length - y); //Type + w.SetTypeByChar(s[0]); + + y = s.IndexOf('\t') + 1; + s = s.Substring(y, s.Length - y); //Signed + w.SetSignedByChar(s[0]); + + y = s.IndexOf('\t') + 1; + s = s.Substring(y, s.Length - y); //Endian + y = Int16.Parse(s[0].ToString()); + if (y == 0) + w.bigendian = false; + else + w.bigendian = true; + + w.notes = s.Substring(2, s.Length - 2); //User notes + + watchList.Add(w); + } + + Global.Config.RecentWatches.Add(file.FullName); + changes = false; + MessageLabel.Text = Path.GetFileName(file.FullName); + //Update the number of watches + WatchCountLabel.Text = count.ToString() + " watches"; + } + + return true; + } + + private Point GetPromptPoint() + { + + Point p = new Point(WatchListView.Location.X, WatchListView.Location.Y); + Point q = new Point(); + q = PointToScreen(p); + return q; + } + + void AddNewWatch() + { + + RamWatchNewWatch r = new RamWatchNewWatch(); + r.location = GetPromptPoint(); + + r.ShowDialog(); + if (r.userSelected == true) + { + watchList.Add(r.watch); + DisplayWatchList(); //TODO: Do I need these calls? + } + } + + void Changes() + { + changes = true; + MessageLabel.Text = Path.GetFileName(currentWatchFile) + " *"; + } + + void EditWatchObject(int pos) + { + RamWatchNewWatch r = new RamWatchNewWatch(); + r.location = GetPromptPoint(); + r.SetToEditWatch(watchList[pos], "Edit Watch"); + r.ShowDialog(); + + if (r.userSelected == true) + { + Changes(); + watchList[pos] = r.watch; + DisplayWatchList(); + } + } + + void EditWatch() + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + EditWatchObject(indexes[0]); + } + + void RemoveWatch() + { + Changes(); + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + foreach (int index in indexes) + { + watchList.Remove(watchList[indexes[0]]); //index[0] used since each iteration will make this the correct list index + } + DisplayWatchList(); + } + } + + void DuplicateWatch() + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + RamWatchNewWatch r = new RamWatchNewWatch(); + r.location = GetPromptPoint(); + int x = indexes[0]; + r.SetToEditWatch(watchList[x], "Duplicate Watch"); + r.ShowDialog(); + + if (r.userSelected == true) + { + Changes(); + watchList.Add(r.watch); + DisplayWatchList(); + } + } + } + + void MoveUp() + { + if (WatchListView.SelectedIndices.Count == 0) + return; + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + Watch temp = new Watch(); + if (indexes.Count == 0) return; + foreach (int index in indexes) + { + temp = watchList[index]; + watchList.Remove(watchList[index]); + watchList.Insert(index - 1, temp); + + //Note: here it will get flagged many times redundantly potentially, + //but this avoids it being flagged falsely when the user did not select an index + Changes(); + } + List i = new List(); + for (int z = 0; z < indexes.Count; z++) + i.Add(indexes[z] - 1); + + WatchListView.SelectedIndices.Clear(); + for (int z = 0; z < i.Count; z++) + WatchListView.SelectItem(i[z], true); + + + DisplayWatchList(); + } + + void MoveDown() + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + Watch temp = new Watch(); + if (indexes.Count == 0) return; + foreach (int index in indexes) + { + temp = watchList[index]; + + if (index < watchList.Count - 1) + { + + watchList.Remove(watchList[index]); + watchList.Insert(index + 1, temp); + + } + + //Note: here it will get flagged many times redundantly potnetially, + //but this avoids it being flagged falsely when the user did not select an index + Changes(); + } + + List i = new List(); + for (int z = 0; z < indexes.Count; z++) + i.Add(indexes[z] + 1); + + WatchListView.SelectedIndices.Clear(); + for (int z = 0; z < i.Count; z++) + WatchListView.SelectItem(i[z], true); + + DisplayWatchList(); + } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!AskSave()) + return; + + this.Close(); + } + + private void newListToolStripMenuItem_Click(object sender, EventArgs e) + { + NewWatchList(false); + } + + private FileInfo GetFileFromUser() + { + var ofd = new OpenFileDialog(); + if (currentWatchFile.Length > 0) + ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); + ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; + ofd.RestoreDirectory = true; + + Global.Sound.StopSound(); + var result = ofd.ShowDialog(); + Global.Sound.StartSound(); + if (result != DialogResult.OK) + return null; + var file = new FileInfo(ofd.FileName); + return file; + } + + private void OpenWatchFile() + { + var file = GetFileFromUser(); + if (file != null) + { + bool r = true; + if (changes) r = AskSave(); + if (r) + { + LoadWatchFile(file.FullName, false); + DisplayWatchList(); + } + } + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenWatchFile(); + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (string.Compare(currentWatchFile, "") == 0) return; + + if (changes) + SaveWatchFile(currentWatchFile); + } + + private FileInfo GetSaveFileFromUser() + { + var sfd = new SaveFileDialog(); + if (currentWatchFile.Length > 0) + { + sfd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); + sfd.InitialDirectory = Path.GetDirectoryName(currentWatchFile); + } + else if (!(Global.Emulator is NullEmulator)) + { + sfd.FileName = Global.Game.Name; + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); + } + else + { + sfd.FileName = "NULL"; + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); + } + sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; + sfd.RestoreDirectory = true; + Global.Sound.StopSound(); + var result = sfd.ShowDialog(); + Global.Sound.StartSound(); + if (result != DialogResult.OK) + return null; + var file = new FileInfo(sfd.FileName); + return file; + } + + private void SaveAs() + { + var file = GetSaveFileFromUser(); + if (file != null) + { + SaveWatchFile(file.FullName); + currentWatchFile = file.FullName; + MessageLabel.Text = Path.GetFileName(currentWatchFile) + " saved."; + } + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveAs(); + } + + private void appendFileToolStripMenuItem_Click(object sender, EventArgs e) + { + var file = GetFileFromUser(); + if (file != null) + LoadWatchFile(file.FullName, true); + DisplayWatchList(); + Changes(); + } + + private void autoLoadToolStripMenuItem_Click(object sender, EventArgs e) + { + UpdateAutoLoadRamWatch(); + } + + private void newWatchToolStripMenuItem_Click(object sender, EventArgs e) + { + AddNewWatch(); + } + + private void editWatchToolStripMenuItem_Click(object sender, EventArgs e) + { + EditWatch(); + } + + private void removeWatchToolStripMenuItem_Click(object sender, EventArgs e) + { + RemoveWatch(); + } + + private void duplicateWatchToolStripMenuItem_Click(object sender, EventArgs e) + { + DuplicateWatch(); + } + + private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveUp(); + } + + private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveDown(); + } + + private void RamWatch_Load(object sender, EventArgs e) + { + LoadConfigSettings(); + SetMemoryDomainMenu(); + } + + private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + if (Global.Config.AutoLoadRamWatch == true) + autoLoadToolStripMenuItem.Checked = true; + else + autoLoadToolStripMenuItem.Checked = false; + + if (string.Compare(currentWatchFile, "") == 0 || !changes) + { + saveToolStripMenuItem.Enabled = false; + } + else + { + saveToolStripMenuItem.Enabled = true; + } + } + + private void UpdateAutoLoadRamWatch() + { + autoLoadToolStripMenuItem.Checked = Global.Config.AutoLoadRamWatch ^= true; + } + private void recentToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + //Clear out recent Roms list + //repopulate it with an up to date list + recentToolStripMenuItem.DropDownItems.Clear(); + + if (Global.Config.RecentWatches.IsEmpty()) + { + var none = new ToolStripMenuItem(); + none.Enabled = false; + none.Text = "None"; + recentToolStripMenuItem.DropDownItems.Add(none); + } + else + { + for (int x = 0; x < Global.Config.RecentWatches.Length(); x++) + { + string path = Global.Config.RecentWatches.GetRecentFileByPosition(x); + var item = new ToolStripMenuItem(); + item.Text = path; + item.Click += (o, ev) => LoadWatchFromRecent(path); + recentToolStripMenuItem.DropDownItems.Add(item); + } + } + + recentToolStripMenuItem.DropDownItems.Add("-"); + + var clearitem = new ToolStripMenuItem(); + clearitem.Text = "&Clear"; + clearitem.Click += (o, ev) => Global.Config.RecentWatches.Clear(); + recentToolStripMenuItem.DropDownItems.Add(clearitem); + + var auto = new ToolStripMenuItem(); + auto.Text = "&Auto-Load"; + auto.Click += (o, ev) => UpdateAutoLoadRamWatch(); + if (Global.Config.AutoLoadRamWatch == true) + auto.Checked = true; + else + auto.Checked = false; + recentToolStripMenuItem.DropDownItems.Add(auto); + } + + private void WatchListView_AfterLabelEdit(object sender, LabelEditEventArgs e) + { + if (e.Label == null) //If no change + return; + string Str = e.Label.ToUpper().Trim(); + int index = e.Item; + + if (InputValidate.IsValidHexNumber(Str)) + { + watchList[e.Item].address = int.Parse(Str, NumberStyles.HexNumber); + EditWatchObject(index); + } + else + { + MessageBox.Show("Invalid number!"); //TODO: More parameters and better message + WatchListView.Items[index].Text = watchList[index].address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes + } + } + + private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); + + Global.Config.RamWatchAddressIndex = 0; + Global.Config.RamWatchValueIndex = 1; + Global.Config.RamWatchPrevIndex = 2; + Global.Config.RamWatchChangeIndex = 3; + Global.Config.RamWatchNotesIndex = 4; + ColumnPositionSet(); + + showPreviousValueToolStripMenuItem.Checked = false; + Global.Config.RamWatchShowPrevColumn = false; + showChangeCountsToolStripMenuItem.Checked = true; + Global.Config.RamWatchShowChangeColumn = true; + WatchListView.Columns[0].Width = defaultAddressWidth; + WatchListView.Columns[1].Width = defaultValueWidth; + WatchListView.Columns[2].Width = 0; + WatchListView.Columns[3].Width = defaultChangeWidth; + WatchListView.Columns[4].Width = NotesWidth; + } + + private void newToolStripButton_Click(object sender, EventArgs e) + { + NewWatchList(false); + } + + private void openToolStripButton_Click(object sender, EventArgs e) + { + OpenWatchFile(); + } + + private void saveToolStripButton_Click(object sender, EventArgs e) + { + if (changes) + { + SaveWatchFile(currentWatchFile); + } + else + { + SaveAs(); + } + } + + private void InsertSeparator() + { + Watch w = new Watch(); + w.type = atype.SEPARATOR; + + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + int x; + if (indexes.Count > 0) + { + x = indexes[0]; + if (indexes[0] > 0) + watchList.Insert(indexes[0], w); + } + else + watchList.Add(w); + DisplayWatchList(); + } + + private void cutToolStripButton_Click(object sender, EventArgs e) + { + RemoveWatch(); + } + + private void NewWatchStripButton1_Click(object sender, EventArgs e) + { + AddNewWatch(); + } + + private void MoveUpStripButton1_Click(object sender, EventArgs e) + { + MoveUp(); + } + + private void MoveDownStripButton1_Click(object sender, EventArgs e) + { + MoveDown(); + } + + private void EditWatchToolStripButton1_Click(object sender, EventArgs e) + { + EditWatch(); + } + + private void DuplicateWatchToolStripButton_Click(object sender, EventArgs e) + { + DuplicateWatch(); + } + + private void toolStripButton1_Click(object sender, EventArgs e) + { + InsertSeparator(); + } + + private void insertSeparatorToolStripMenuItem_Click(object sender, EventArgs e) + { + InsertSeparator(); + } + + private void PoketoolStripButton2_Click(object sender, EventArgs e) + { + PokeAddress(); + } + + private void PokeAddress() + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + RamPoke p = new RamPoke(); + + if (indexes.Count > 0) + p.SetWatchObject(watchList[indexes[0]]); + p.location = GetPromptPoint(); + p.ShowDialog(); + } + + private void pokeAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + PokeAddress(); + } + + private void watchesToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + editWatchToolStripMenuItem.Enabled = true; + duplicateWatchToolStripMenuItem.Enabled = true; + removeWatchToolStripMenuItem.Enabled = true; + moveUpToolStripMenuItem.Enabled = true; + moveDownToolStripMenuItem.Enabled = true; + pokeAddressToolStripMenuItem.Enabled = true; + freezeAddressToolStripMenuItem.Enabled = true; + } + else + { + editWatchToolStripMenuItem.Enabled = false; + duplicateWatchToolStripMenuItem.Enabled = false; + removeWatchToolStripMenuItem.Enabled = false; + moveUpToolStripMenuItem.Enabled = false; + moveDownToolStripMenuItem.Enabled = false; + pokeAddressToolStripMenuItem.Enabled = false; + freezeAddressToolStripMenuItem.Enabled = false; + } + } + + private void editToolStripMenuItem_Click(object sender, EventArgs e) + { + EditWatch(); + } + + private void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + RemoveWatch(); + } + + private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) + { + DuplicateWatch(); + } + + private void pokeToolStripMenuItem_Click(object sender, EventArgs e) + { + PokeAddress(); + } + + private void insertSeperatorToolStripMenuItem_Click(object sender, EventArgs e) + { + InsertSeparator(); + } + + private void moveUpToolStripMenuItem1_Click(object sender, EventArgs e) + { + MoveUp(); + } + + private void moveDownToolStripMenuItem1_Click(object sender, EventArgs e) + { + MoveDown(); + } + + private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count == 0) + { + contextMenuStrip1.Items[0].Visible = false; + contextMenuStrip1.Items[1].Visible = false; + contextMenuStrip1.Items[2].Visible = false; + contextMenuStrip1.Items[3].Visible = false; + contextMenuStrip1.Items[4].Visible = false; + contextMenuStrip1.Items[5].Visible = false; + contextMenuStrip1.Items[6].Visible = false; + contextMenuStrip1.Items[8].Visible = false; + contextMenuStrip1.Items[9].Visible = false; + + } + else + { + for (int x = 0; x < contextMenuStrip1.Items.Count; x++) + contextMenuStrip1.Items[x].Visible = true; + } + + if (Global.Config.RamWatchShowChangeColumn) + contextMenuStrip1.Items[11].Text = "Hide change counts"; + else + contextMenuStrip1.Items[11].Text = "Show change counts"; + + if (Global.Config.RamWatchShowPrevColumn) + contextMenuStrip1.Items[12].Text = "Hide previous value"; + else + contextMenuStrip1.Items[12].Text = "Show previous value"; + + if (Global.Config.RamWatchShowChangeFromPrev) + contextMenuStrip1.Items[13].Text = "Display Previous value as previous"; + else + contextMenuStrip1.Items[13].Text = "Display Previosu value as change amount"; + } + + private void WatchListView_MouseDoubleClick(object sender, MouseEventArgs e) + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + EditWatch(); + } + } + + private void RamWatch_DragDrop(object sender, DragEventArgs e) + { + string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); + if (Path.GetExtension(filePaths[0]) == (".wch")) + { + LoadWatchFile(filePaths[0], false); + DisplayWatchList(); + } + } + + private void RamWatch_DragEnter(object sender, DragEventArgs e) + { + e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None; string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop); + } + + private void ClearChangeCounts() + { + for (int x = 0; x < watchList.Count; x++) + watchList[x].changecount = 0; + DisplayWatchList(); + MessageLabel.Text = "Change counts cleared"; + } + + private void ClearChangeCountstoolStripButton_Click(object sender, EventArgs e) + { + ClearChangeCounts(); + } + + private void clearChangeCountsToolStripMenuItem_Click(object sender, EventArgs e) + { + ClearChangeCounts(); + } + + + + private void showChangeCountsToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchShowChangeColumn ^= true; + SetChangesColumn(Global.Config.RamWatchShowChangeColumn); + } + + private void SetChangesColumn(bool show) + { + Global.Config.RamWatchShowChangeColumn = show; + showChangeCountsToolStripMenuItem.Checked = show; + if (show) + WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = 54; + else + WatchListView.Columns[Global.Config.RamWatchChangeIndex].Width = 0; + } + + private void SetPrevColumn(bool show) + { + Global.Config.RamWatchShowPrevColumn = show; + showPreviousValueToolStripMenuItem.Checked = show; + if (show) + WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = 59; + else + WatchListView.Columns[Global.Config.RamWatchPrevIndex].Width = 0; + } + + private void showPreviousValueToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchShowPrevColumn ^= true; + SetPrevColumn(Global.Config.RamWatchShowPrevColumn); + } + + private void prevValueShowsChangeAmountToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchShowChangeFromPrev ^= true; + DisplayWatchList(); + } + + private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev; + } + + private void viewInHexEditorToolStripMenuItem_Click(object sender, EventArgs e) + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + Global.MainForm.LoadHexEditor(); + Global.MainForm.HexEditor1.GoToAddress(watchList[indexes[0]].address); + } + } + + private int GetNumDigits(Int32 i) + { + //if (i == 0) return 0; + //if (i < 0x10) return 1; + //if (i < 0x100) return 2; + //if (i < 0x1000) return 3; //adelikat: commenting these out because I decided that regardless of domain, 4 digits should be the minimum + if (i < 0x10000) return 4; + if (i < 0x1000000) return 6; + else return 8; + } + + private void freezeToolStripMenuItem_Click(object sender, EventArgs e) + { + FreezeAddress(); + } + + private int WORDGetLowerByte(int value) + { + return value / 256; + } + + private int WORDGetUpperByte(int value) + { + return value >> 2; + } + + private void FreezeAddress() + { + ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; + if (indexes.Count > 0) + { + switch (watchList[indexes[0]].type) + { + case atype.BYTE: + Cheat c = new Cheat("", watchList[indexes[0]].address, (byte)watchList[indexes[0]].value, + true, Domain); + Global.MainForm.Cheats1.AddCheat(c); + break; + case atype.WORD: + { + byte low = (byte)(watchList[indexes[0]].value / 256); + byte high = (byte)(watchList[indexes[0]].value); + int a1 = watchList[indexes[0]].address; + int a2 = watchList[indexes[0]].address + 1; + if (watchList[indexes[0]].bigendian) + { + Cheat c1 = new Cheat("", a1, low, true, Domain); + Cheat c2 = new Cheat("", a2, high, true, Domain); + Global.MainForm.Cheats1.AddCheat(c1); + Global.MainForm.Cheats1.AddCheat(c2); + } + else + { + Cheat c1 = new Cheat("", a1, high, true, Domain); + Cheat c2 = new Cheat("", a2, low, true, Domain); + Global.MainForm.Cheats1.AddCheat(c1); + Global.MainForm.Cheats1.AddCheat(c2); + } + } + break; + case atype.DWORD: + { + byte HIWORDhigh = (byte)(watchList[indexes[0]].value / 0x1000000); + byte HIWORDlow = (byte)(watchList[indexes[0]].value / 0x10000); + byte LOWORDhigh = (byte)(watchList[indexes[0]].value / 0x100); + byte LOWORDlow = (byte)(watchList[indexes[0]].value); + int a1 = watchList[indexes[0]].address; + int a2 = watchList[indexes[0]].address + 1; + int a3 = watchList[indexes[0]].address + 2; + int a4 = watchList[indexes[0]].address + 3; + if (watchList[indexes[0]].bigendian) + { + Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain); + Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain); + Cheat c3 = new Cheat("", a3, LOWORDhigh, true, Domain); + Cheat c4 = new Cheat("", a4, LOWORDlow, true, Domain); + Global.MainForm.Cheats1.AddCheat(c1); + Global.MainForm.Cheats1.AddCheat(c2); + Global.MainForm.Cheats1.AddCheat(c3); + Global.MainForm.Cheats1.AddCheat(c4); + } + else + { + Cheat c1 = new Cheat("", a1, LOWORDlow, true, Domain); + Cheat c2 = new Cheat("", a2, LOWORDhigh, true, Domain); + Cheat c3 = new Cheat("", a3, HIWORDlow, true, Domain); + Cheat c4 = new Cheat("", a4, HIWORDhigh, true, Domain); + Global.MainForm.Cheats1.AddCheat(c1); + Global.MainForm.Cheats1.AddCheat(c2); + Global.MainForm.Cheats1.AddCheat(c3); + Global.MainForm.Cheats1.AddCheat(c4); + } + } + break; + } + } + } + + private void freezeAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + FreezeAddress(); + } + + private void FreezetoolStripButton2_Click(object sender, EventArgs e) + { + FreezeAddress(); + } + + private void SetPlatformAndMemoryDomainLabel() + { + string memoryDomain = Domain.ToString(); + systemID = Global.Emulator.SystemId; + MemDomainLabel.Text = systemID + " " + memoryDomain; + } + + private void SetMemoryDomain(int pos) + { + if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check + { + Domain = Global.Emulator.MemoryDomains[pos]; + } + SetPlatformAndMemoryDomainLabel(); + Update(); + } + + private void SetMemoryDomainMenu() + { + memoryDomainsToolStripMenuItem.DropDownItems.Clear(); + if (Global.Emulator.MemoryDomains.Count > 0) + { + for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) + { + string str = Global.Emulator.MemoryDomains[x].ToString(); + var item = new ToolStripMenuItem(); + item.Text = str; + { + int z = x; + item.Click += (o, ev) => SetMemoryDomain(z); + } + if (x == 0) + { + SetMemoryDomain(x); + } + memoryDomainsToolStripMenuItem.DropDownItems.Add(item); + domainMenuItems.Add(item); + } + } + else + memoryDomainsToolStripMenuItem.Enabled = false; + } + + private void CheckDomainMenuItems() + { + for (int x = 0; x < domainMenuItems.Count; x++) + { + if (Domain.Name == domainMenuItems[x].Text) + domainMenuItems[x].Checked = true; + else + domainMenuItems[x].Checked = false; + } + } + + private void memoryDomainsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + CheckDomainMenuItems(); + } + + private void ColumnReorder(object sender, ColumnReorderedEventArgs e) + { + ColumnHeader header = e.Header; + + int lowIndex = 0; + int highIndex = 0; + int changeIndex = 0; + if (e.NewDisplayIndex > e.OldDisplayIndex) + { + changeIndex = -1; + highIndex = e.NewDisplayIndex; + lowIndex = e.OldDisplayIndex; + } + else + { + changeIndex = 1; + highIndex = e.OldDisplayIndex; + lowIndex = e.NewDisplayIndex; + } + + if (Global.Config.RamWatchAddressIndex >= lowIndex && Global.Config.RamWatchAddressIndex <= highIndex) + Global.Config.RamWatchAddressIndex += changeIndex; + if (Global.Config.RamWatchValueIndex >= lowIndex && Global.Config.RamWatchValueIndex <= highIndex) + Global.Config.RamWatchValueIndex += changeIndex; + if (Global.Config.RamWatchPrevIndex >= lowIndex && Global.Config.RamWatchPrevIndex <= highIndex) + Global.Config.RamWatchPrevIndex += changeIndex; + if (Global.Config.RamWatchChangeIndex >= lowIndex && Global.Config.RamWatchChangeIndex <= highIndex) + Global.Config.RamWatchChangeIndex += changeIndex; + if (Global.Config.RamWatchNotesIndex >= lowIndex && Global.Config.RamWatchNotesIndex <= highIndex) + Global.Config.RamWatchNotesIndex += changeIndex; + + if (header.Text == "Address") + Global.Config.RamWatchAddressIndex = e.NewDisplayIndex; + else if (header.Text == "Value") + Global.Config.RamWatchValueIndex = e.NewDisplayIndex; + else if (header.Text == "Prev") + Global.Config.RamWatchPrevIndex = e.NewDisplayIndex; + else if (header.Text == "Changes") + Global.Config.RamWatchChangeIndex = e.NewDisplayIndex; + else if (header.Text == "Notes") + Global.Config.RamWatchNotesIndex = e.NewDisplayIndex; + } + + private void ColumnPositionSet() + { + List columnHeaders = new List(); + int i = 0; + for (i = 0; i < WatchListView.Columns.Count; i++) + columnHeaders.Add(WatchListView.Columns[i]); + + WatchListView.Columns.Clear(); + + i = 0; + do + { + string column = ""; + if (Global.Config.RamWatchAddressIndex == i) + column = "Address"; + else if (Global.Config.RamWatchValueIndex == i) + column = "Value"; + else if (Global.Config.RamWatchPrevIndex == i) + column = "Prev"; + else if (Global.Config.RamWatchChangeIndex == i) + column = "Changes"; + else if (Global.Config.RamWatchNotesIndex == i) + column = "Notes"; + + for (int k = 0; k < columnHeaders.Count(); k++) + { + if (columnHeaders[k].Text == column) + { + WatchListView.Columns.Add(columnHeaders[k]); + columnHeaders.Remove(columnHeaders[k]); + break; + } + } + i++; + } while (columnHeaders.Count() > 0); + } + } } \ No newline at end of file