ecs-567, 595

This commit is contained in:
Heath Volmer
2017-10-19 14:59:18 -06:00
parent b301df6910
commit 1d9490c46f
7 changed files with 166 additions and 46 deletions

View File

@@ -36,6 +36,8 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
public Action HideAction { get; set; }
CTimer BackspaceTimer;
/// <summary>
///
/// </summary>
@@ -88,7 +90,8 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
TriList.SetSigTrueAction(2947, () => Press('.'));
TriList.SetSigTrueAction(2948, () => Press('@'));
TriList.SetSigTrueAction(2949, () => Press(' '));
TriList.SetSigTrueAction(2950, Backspace);
TriList.SetSigHeldAction(2950, 500, StartBackspaceRepeat, StopBackspaceRepeat, Backspace);
//TriList.SetSigTrueAction(2950, Backspace);
TriList.SetSigTrueAction(2951, Shift);
TriList.SetSigTrueAction(2952, NumShift);
TriList.SetSigTrueAction(2953, Clear);
@@ -204,6 +207,28 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; }
char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; }
/// <summary>
/// Does what it says
/// </summary>
void StartBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => Backspace(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
void Backspace()
{

View File

@@ -77,7 +77,7 @@ namespace PepperDash.Essentials.Core
/// Sets an action to a held sig as well as a released-without-hold action
/// </summary>
/// <returns></returns>
public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action releaseAction)
public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action holdReleasedAction, Action releaseAction)
{
CTimer heldTimer = null;
bool wasHeld = false;
@@ -98,12 +98,18 @@ namespace PepperDash.Essentials.Core
}
}, heldMs);
}
else if (!wasHeld) // released
else if (!press && !wasHeld) // released, no hold
{
heldTimer.Stop();
if (releaseAction != null)
releaseAction();
}
else // !press && wasHeld // released after held
{
heldTimer.Stop();
if (holdReleasedAction != null)
holdReleasedAction();
}
});
}
@@ -114,9 +120,19 @@ namespace PepperDash.Essentials.Core
/// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
{
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, releaseAction);
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, null, releaseAction);
}
/// <summary>
/// Sets an action to a held sig, an action for the release of hold, as well as a released-without-hold action
/// </summary>
/// <returns></returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction,
Action holdReleasedAction, Action releaseAction)
{
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, holdReleasedAction, releaseAction);
}
/// <summary>
///
/// </summary>