Controller Config - Rip out conflicts display for now since it doesn't work right, and looks confusing, and slows things down
This commit is contained in:
parent
0c2851e34f
commit
35e19a3bc5
|
@ -42,43 +42,9 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoConflicts()
|
|
||||||
{
|
|
||||||
var BindingList = new List<KeyValuePair<int, string>>();
|
|
||||||
var uniqueBindings = new HashSet<string>();
|
|
||||||
|
|
||||||
for (int i = 0; i < Inputs.Count; i++)
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrWhiteSpace(Inputs[i].Text))
|
|
||||||
{
|
|
||||||
string[] bindings = Inputs[i].Text.Split(',');
|
|
||||||
foreach (string binding in bindings)
|
|
||||||
{
|
|
||||||
BindingList.Add(new KeyValuePair<int, string>(i, binding));
|
|
||||||
uniqueBindings.Add(binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string binding in uniqueBindings)
|
|
||||||
{
|
|
||||||
List<KeyValuePair<int, string>> kvps = BindingList.Where(x => x.Value == binding).ToList();
|
|
||||||
if (kvps.Count > 1)
|
|
||||||
{
|
|
||||||
foreach(KeyValuePair<int, string> kvp in kvps)
|
|
||||||
{
|
|
||||||
Inputs[kvp.Key].Conflicted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
foreach (InputWidget i in Inputs)
|
Inputs.ForEach(x => x.Clear());
|
||||||
{
|
|
||||||
i.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -143,34 +109,31 @@ namespace BizHawk.MultiClient
|
||||||
y = MarginTop;
|
y = MarginTop;
|
||||||
x += ColumnWidth;
|
x += ColumnWidth;
|
||||||
}
|
}
|
||||||
InputWidget iw = new InputWidget {Location = new Point(x, y), Size = new Size(InputSize, 23), TabIndex = i};
|
|
||||||
iw.AutoTab = Autotab;
|
InputWidget iw = new InputWidget
|
||||||
|
{
|
||||||
|
Location = new Point(x, y),
|
||||||
|
Size = new Size(InputSize, 23),
|
||||||
|
TabIndex = i,
|
||||||
|
AutoTab = this.Autotab
|
||||||
|
};
|
||||||
|
|
||||||
iw.BringToFront();
|
iw.BringToFront();
|
||||||
iw.Leave += InputWidget_Leave;
|
|
||||||
Controls.Add(iw);
|
Controls.Add(iw);
|
||||||
Inputs.Add(iw);
|
Inputs.Add(iw);
|
||||||
Label l = new Label
|
Label label = new Label
|
||||||
{
|
{
|
||||||
Location = new Point(x + InputSize + LabelPadding, y + 3),
|
Location = new Point(x + InputSize + LabelPadding, y + 3),
|
||||||
Text = buttons[i].Replace('_', ' ').Trim(),
|
Text = buttons[i].Replace('_', ' ').Trim(),
|
||||||
//Width = LabelWidth
|
|
||||||
};
|
};
|
||||||
Controls.Add(l);
|
Controls.Add(label);
|
||||||
Labels.Add(l);
|
Labels.Add(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InputWidget_Leave(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DoConflicts();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetAutoTab(bool value)
|
public void SetAutoTab(bool value)
|
||||||
{
|
{
|
||||||
foreach (InputWidget i in Inputs)
|
Inputs.ForEach(x => x.AutoTab = value);
|
||||||
{
|
|
||||||
i.AutoTab = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
|
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -18,54 +18,10 @@ namespace BizHawk.MultiClient
|
||||||
private string[] _bindings = new string[4];
|
private string[] _bindings = new string[4];
|
||||||
private string wasPressed = String.Empty;
|
private string wasPressed = String.Empty;
|
||||||
private ToolTip tooltip1 = new ToolTip();
|
private ToolTip tooltip1 = new ToolTip();
|
||||||
private Color _highlight_color = Color.LightCyan;
|
|
||||||
private Color _no_highlight_color = SystemColors.Window;
|
|
||||||
private bool conflicted = false;
|
|
||||||
|
|
||||||
public bool AutoTab = true;
|
public bool AutoTab = true;
|
||||||
public string WidgetName;
|
public string WidgetName;
|
||||||
|
|
||||||
public bool Conflicted
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return conflicted;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
conflicted = value;
|
|
||||||
if (conflicted)
|
|
||||||
{
|
|
||||||
_no_highlight_color = Color.LightCoral;
|
|
||||||
_highlight_color = Color.Violet;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_highlight_color = Color.LightCyan;
|
|
||||||
_no_highlight_color = SystemColors.Window;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Focused)
|
|
||||||
{
|
|
||||||
Highlight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UnHighlight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Highlight()
|
|
||||||
{
|
|
||||||
BackColor = _highlight_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UnHighlight()
|
|
||||||
{
|
|
||||||
BackColor = _no_highlight_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("user32")]
|
[DllImport("user32")]
|
||||||
private static extern bool HideCaret(IntPtr hWnd);
|
private static extern bool HideCaret(IntPtr hWnd);
|
||||||
|
|
||||||
|
@ -96,7 +52,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void ClearBindings()
|
private void ClearBindings()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MaxBind; i++)
|
for (int i = 0; i < MaxBind; i++)
|
||||||
{
|
{
|
||||||
_bindings[i] = String.Empty;
|
_bindings[i] = String.Empty;
|
||||||
}
|
}
|
||||||
|
@ -106,9 +62,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
pos = 0;
|
pos = 0;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
//Input.Update();
|
|
||||||
|
|
||||||
//zero: ??? what is this all about ???
|
|
||||||
wasPressed = Input.Instance.GetNextBindEvent();
|
wasPressed = Input.Instance.GetNextBindEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +81,6 @@ namespace BizHawk.MultiClient
|
||||||
public void EraseMappings()
|
public void EraseMappings()
|
||||||
{
|
{
|
||||||
ClearBindings();
|
ClearBindings();
|
||||||
Conflicted = false;
|
|
||||||
Text = String.Empty;
|
Text = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +97,6 @@ namespace BizHawk.MultiClient
|
||||||
if (TempBindingStr == "Escape")
|
if (TempBindingStr == "Escape")
|
||||||
{
|
{
|
||||||
ClearBindings();
|
ClearBindings();
|
||||||
Conflicted = false;
|
|
||||||
Increment();
|
Increment();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +116,6 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Checks if the key is already mapped to this widget
|
|
||||||
private bool IsDuplicate(string binding)
|
private bool IsDuplicate(string binding)
|
||||||
{
|
{
|
||||||
return _bindings.FirstOrDefault(x => x == binding) != null;
|
return _bindings.FirstOrDefault(x => x == binding) != null;
|
||||||
|
@ -243,7 +194,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Text = "";
|
Text = String.Empty;
|
||||||
ClearBindings();
|
ClearBindings();
|
||||||
string str = value.Trim();
|
string str = value.Trim();
|
||||||
int x;
|
int x;
|
||||||
|
@ -254,7 +205,7 @@ namespace BizHawk.MultiClient
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
{
|
{
|
||||||
_bindings[i] = str;
|
_bindings[i] = str;
|
||||||
str = "";
|
str = String.Empty;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -277,30 +228,30 @@ namespace BizHawk.MultiClient
|
||||||
switch (m.Msg)
|
switch (m.Msg)
|
||||||
{
|
{
|
||||||
case 0x0201: //WM_LBUTTONDOWN
|
case 0x0201: //WM_LBUTTONDOWN
|
||||||
{
|
{
|
||||||
this.Focus();
|
this.Focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//case 0x0202://WM_LBUTTONUP
|
//case 0x0202://WM_LBUTTONUP
|
||||||
//{
|
//{
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
case 0x0203://WM_LBUTTONDBLCLK
|
case 0x0203://WM_LBUTTONDBLCLK
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 0x0204://WM_RBUTTONDOWN
|
case 0x0204://WM_RBUTTONDOWN
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 0x0205://WM_RBUTTONUP
|
case 0x0205://WM_RBUTTONUP
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 0x0206://WM_RBUTTONDBLCLK
|
case 0x0206://WM_RBUTTONDBLCLK
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base.WndProc(ref m);
|
base.WndProc(ref m);
|
||||||
|
@ -321,14 +272,11 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
protected override void OnGotFocus(EventArgs e)
|
protected override void OnGotFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
//base.OnGotFocus(e);
|
|
||||||
HideCaret(this.Handle);
|
HideCaret(this.Handle);
|
||||||
Highlight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLostFocus(EventArgs e)
|
protected override void OnLostFocus(EventArgs e)
|
||||||
{
|
{
|
||||||
UnHighlight();
|
|
||||||
base.OnLostFocus(e);
|
base.OnLostFocus(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue