VirtualPads - progres on ReadOnly for AnalogStick
This commit is contained in:
parent
c21ab3e22d
commit
39e7039341
|
@ -28,9 +28,9 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.XLabel = new System.Windows.Forms.Label();
|
||||
this.ManualX = new System.Windows.Forms.NumericUpDown();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.YLabel = new System.Windows.Forms.Label();
|
||||
this.ManualY = new System.Windows.Forms.NumericUpDown();
|
||||
this.MaxLabel = new System.Windows.Forms.Label();
|
||||
this.MaxXNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
|
@ -42,14 +42,14 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.MaxYNumeric)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
// XLabel
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(138, 7);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(14, 13);
|
||||
this.label1.TabIndex = 23;
|
||||
this.label1.Text = "X";
|
||||
this.XLabel.AutoSize = true;
|
||||
this.XLabel.Location = new System.Drawing.Point(138, 7);
|
||||
this.XLabel.Name = "XLabel";
|
||||
this.XLabel.Size = new System.Drawing.Size(14, 13);
|
||||
this.XLabel.TabIndex = 23;
|
||||
this.XLabel.Text = "X";
|
||||
//
|
||||
// ManualX
|
||||
//
|
||||
|
@ -70,14 +70,14 @@
|
|||
this.ManualX.ValueChanged += new System.EventHandler(this.ManualX_ValueChanged);
|
||||
this.ManualX.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ManualX_KeyUp);
|
||||
//
|
||||
// label2
|
||||
// YLabel
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(138, 33);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(14, 13);
|
||||
this.label2.TabIndex = 26;
|
||||
this.label2.Text = "Y";
|
||||
this.YLabel.AutoSize = true;
|
||||
this.YLabel.Location = new System.Drawing.Point(138, 33);
|
||||
this.YLabel.Name = "YLabel";
|
||||
this.YLabel.Size = new System.Drawing.Size(14, 13);
|
||||
this.YLabel.TabIndex = 26;
|
||||
this.YLabel.Text = "Y";
|
||||
//
|
||||
// ManualY
|
||||
//
|
||||
|
@ -152,6 +152,8 @@
|
|||
this.AnalogStick.BackColor = System.Drawing.Color.Gray;
|
||||
this.AnalogStick.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.AnalogStick.Location = new System.Drawing.Point(3, 3);
|
||||
this.AnalogStick.MaxX = 127;
|
||||
this.AnalogStick.MaxY = 127;
|
||||
this.AnalogStick.Name = "AnalogStick";
|
||||
this.AnalogStick.Size = new System.Drawing.Size(129, 129);
|
||||
this.AnalogStick.TabIndex = 0;
|
||||
|
@ -165,10 +167,10 @@
|
|||
this.Controls.Add(this.MaxYNumeric);
|
||||
this.Controls.Add(this.MaxXNumeric);
|
||||
this.Controls.Add(this.MaxLabel);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.YLabel);
|
||||
this.Controls.Add(this.ManualY);
|
||||
this.Controls.Add(this.ManualX);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.XLabel);
|
||||
this.Controls.Add(this.AnalogStick);
|
||||
this.Name = "VirtualPadAnalogStick";
|
||||
this.Size = new System.Drawing.Size(204, 136);
|
||||
|
@ -185,9 +187,9 @@
|
|||
#endregion
|
||||
|
||||
private AnalogStickPanel AnalogStick;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label XLabel;
|
||||
private System.Windows.Forms.NumericUpDown ManualX;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label YLabel;
|
||||
private System.Windows.Forms.NumericUpDown ManualY;
|
||||
private System.Windows.Forms.Label MaxLabel;
|
||||
private System.Windows.Forms.NumericUpDown MaxXNumeric;
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class VirtualPadAnalogStick : UserControl, IVirtualPadControl
|
||||
{
|
||||
private bool _programmaticallyUpdatingNumerics = false;
|
||||
private bool _readonly = false;
|
||||
|
||||
public VirtualPadAnalogStick()
|
||||
{
|
||||
|
@ -46,8 +47,33 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public bool ReadOnly
|
||||
{
|
||||
get;
|
||||
set; // TODO
|
||||
get
|
||||
{
|
||||
return _readonly;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
var changed = _readonly != value;
|
||||
|
||||
XLabel.Enabled =
|
||||
ManualX.Enabled =
|
||||
YLabel.Enabled =
|
||||
ManualY.Enabled =
|
||||
MaxLabel.Enabled =
|
||||
MaxXNumeric.Enabled =
|
||||
MaxYNumeric.Enabled =
|
||||
!value;
|
||||
|
||||
AnalogStick.Readonly =
|
||||
_readonly =
|
||||
value;
|
||||
|
||||
if (changed)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -94,17 +120,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void AnalogStick_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
_programmaticallyUpdatingNumerics = true;
|
||||
SetNumericsFromAnalog();
|
||||
_programmaticallyUpdatingNumerics = false;
|
||||
}
|
||||
|
||||
private void AnalogStick_MouseMove(object sender, MouseEventArgs e)
|
||||
if (!ReadOnly)
|
||||
{
|
||||
_programmaticallyUpdatingNumerics = true;
|
||||
SetNumericsFromAnalog();
|
||||
_programmaticallyUpdatingNumerics = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void AnalogStick_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!ReadOnly)
|
||||
{
|
||||
_programmaticallyUpdatingNumerics = true;
|
||||
SetNumericsFromAnalog();
|
||||
_programmaticallyUpdatingNumerics = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MaxXNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public int X = 0;
|
||||
public int Y = 0;
|
||||
public bool HasValue = false;
|
||||
public bool Readonly { get; set; }
|
||||
|
||||
public string XName = string.Empty;
|
||||
public string YName = string.Empty;
|
||||
|
@ -152,6 +153,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
if (!Readonly)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
|
@ -168,6 +171,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Refresh();
|
||||
base.OnMouseMove(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
|
@ -187,6 +191,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
if (!Readonly)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
|
@ -201,6 +207,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Clear()
|
||||
|
|
Loading…
Reference in New Issue