mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-07 16:55:04 +00:00
ecs-567, 595
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user