Merge remote-tracking branch 'origin/bugfix/ecs-535' into bugfix/ecs-541

This commit is contained in:
Neil Dorin
2017-10-19 15:12:55 -06:00
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>

View File

@@ -908,6 +908,7 @@ namespace PepperDash.Essentials
HeaderGearButton.SetIcon(HeaderListButton.Gear);
HeaderGearButton.OutputSig.SetSigHeldAction(2000,
ShowTech,
null,
() =>
{
if (CurrentRoom.OnFeedback.BoolValue)

View File

@@ -22,11 +22,13 @@ namespace PepperDash.Essentials
}
/// <summary>
/// Hides CurrentJoin and shows join. Does nothing when resending CurrentJoin
/// Hides CurrentJoin and shows join. Will check and re-set signal if join
/// equals CurrentJoin
/// </summary>
public void ShowInterlocked(uint join)
{
if (CurrentJoin == join)
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue)
return;
SetButDontShow(join);
TriList.SetBool(CurrentJoin, true);
@@ -38,7 +40,8 @@ namespace PepperDash.Essentials
/// <param name="join"></param>
public void ShowInterlockedWithToggle(uint join)
{
if (CurrentJoin == join)
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
if (CurrentJoin == join)
HideAndClear();
else
{
@@ -53,6 +56,7 @@ namespace PepperDash.Essentials
/// </summary>
public void HideAndClear()
{
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
Hide();
CurrentJoin = 0;
}
@@ -63,7 +67,8 @@ namespace PepperDash.Essentials
/// </summary>
public void Hide()
{
if (CurrentJoin > 0)
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0)
TriList.BooleanInput[CurrentJoin].BoolValue = false;
}
@@ -72,7 +77,8 @@ namespace PepperDash.Essentials
/// </summary>
public void Show()
{
if (CurrentJoin > 0)
Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin);
if (CurrentJoin > 0)
TriList.BooleanInput[CurrentJoin].BoolValue = true;
}

View File

@@ -88,6 +88,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
bool CodecHasFavorites;
CTimer BackspaceTimer;
/// <summary>
///
/// </summary>
@@ -176,7 +178,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetSigFalseAction(UIBoolJoin.VCDirectorySearchTextPress, RevealKeyboard);
TriList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackspacePress, SearchKeypadBackspacePress);
//TriList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackspacePress, SearchKeypadBackspacePress);
TriList.SetSigHeldAction(UIBoolJoin.VCDirectoryBackspacePress, 500,
StartSearchBackspaceRepeat, StopSearchBackspaceRepeat, SearchKeypadBackspacePress);
CallSharingInfoVisibleFeedback = new BoolFeedback(() => !string.IsNullOrEmpty(Codec.SharingSourceFeedback.StringValue));
CallSharingInfoVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.CallSharedSourceInfoEnable]);
@@ -253,7 +257,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
KeypadMode = eKeypadMode.DTMF;
DialStringBuilder.Remove(0, DialStringBuilder.Length);
DialStringFeedback.FireUpdate();
TriList.SetBool(UIBoolJoin.VCKeypadVisible, false);
DialStringTextCheckEnables();
Parent.ShowNotificationRibbon("Connected", 2000);
StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress);
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible);
@@ -432,7 +436,9 @@ namespace PepperDash.Essentials.UIDrivers.VC
DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*"));
DialKeypad.Misc2SigName = "#";
DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#"));
TriList.SetSigFalseAction(UIBoolJoin.VCKeypadBackspacePress, DialKeypadBackspacePress);
//TriList.SetSigFalseAction(UIBoolJoin.VCKeypadBackspacePress, DialKeypadBackspacePress);
TriList.SetSigHeldAction(UIBoolJoin.VCKeypadBackspacePress, 500,
StartBackspaceRepeat, StopBackspaceRepeat, DialKeypadBackspacePress);
}
else
Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP",
@@ -769,17 +775,19 @@ namespace PepperDash.Essentials.UIDrivers.VC
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial)
{
var kb = Parent.Keyboard;
kb.KeyPress += new EventHandler<PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs>(Keyboard_KeyPress);
kb.KeyPress -= Keyboard_DialKeyPress;
kb.KeyPress += Keyboard_DialKeyPress;
kb.HideAction = this.DetachDialKeyboard;
kb.GoButtonText = "Connect";
kb.GoButtonVisible = true;
DialStringKeypadCheckEnables();
DialStringTextCheckEnables();
kb.Show();
}
else if(VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible)
{
var kb = Parent.Keyboard;
kb.KeyPress += new EventHandler<KeyboardControllerPressEventArgs>(Search_KeyPress);
kb.KeyPress -= Keyboard_SearchKeyPress;
kb.KeyPress += Keyboard_SearchKeyPress;
kb.HideAction = this.DetachSearchKeyboard;
kb.GoButtonText = "Search";
kb.GoButtonVisible = true;
@@ -789,33 +797,37 @@ namespace PepperDash.Essentials.UIDrivers.VC
}
/// <summary>
///
/// Event handler for keyboard dialing
/// </summary>
void Keyboard_KeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e)
void Keyboard_DialKeyPress(object sender, PepperDash.Essentials.Core.Touchpanels.Keyboards.KeyboardControllerPressEventArgs e)
{
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadVisible)
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCKeypadWithFavoritesVisible && KeypadMode == eKeypadMode.Dial)
{
if (KeypadMode == eKeypadMode.Dial)
if (e.Text != null)
DialStringBuilder.Append(e.Text);
else
{
if (e.SpecialKey == KeyboardSpecialKey.Backspace)
DialKeypadBackspacePress();
else if (e.SpecialKey == KeyboardSpecialKey.Clear)
DialKeypadClear();
else if (e.SpecialKey == KeyboardSpecialKey.GoButton)
{
ConnectPress();
Parent.Keyboard.Hide();
}
}
if (e.Text != null)
DialStringBuilder.Append(e.Text);
else
{
if (e.SpecialKey == KeyboardSpecialKey.Backspace)
DialKeypadBackspacePress();
else if (e.SpecialKey == KeyboardSpecialKey.Clear)
DialKeypadClear();
else if (e.SpecialKey == KeyboardSpecialKey.GoButton)
{
ConnectPress();
Parent.Keyboard.Hide();
}
}
DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables();
DialStringTextCheckEnables();
}
}
void Search_KeyPress(object sender, KeyboardControllerPressEventArgs e)
/// <summary>
/// Event handler for keyboard directory searches
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Keyboard_SearchKeyPress(object sender, KeyboardControllerPressEventArgs e)
{
if (VCControlsInterlock.CurrentJoin == UIBoolJoin.VCDirectoryVisible)
{
@@ -838,14 +850,17 @@ namespace PepperDash.Essentials.UIDrivers.VC
}
}
/// <summary>
/// Call
/// </summary>
void DetachDialKeyboard()
{
Parent.Keyboard.KeyPress -= Keyboard_KeyPress;
Parent.Keyboard.KeyPress -= Keyboard_DialKeyPress;
}
void DetachSearchKeyboard()
{
Parent.Keyboard.KeyPress -= Search_KeyPress;
Parent.Keyboard.KeyPress -= Keyboard_SearchKeyPress;
}
/// <summary>
@@ -917,7 +932,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
{
DialStringBuilder.Append(i);
DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables();
DialStringTextCheckEnables();
}
else
{
@@ -926,16 +941,44 @@ namespace PepperDash.Essentials.UIDrivers.VC
DialStringFeedback.FireUpdate();
// no delete key in this mode!
}
}
}
/// <summary>
/// Does what it says
/// </summary>
void StartBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => DialKeypadBackspacePress(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
/// <summary>
///
/// </summary>
void DialKeypadBackspacePress()
{
DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1);
DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables();
if (KeypadMode == eKeypadMode.Dial)
{
DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1);
DialStringFeedback.FireUpdate();
DialStringTextCheckEnables();
}
else
DialKeypadClear();
}
/// <summary>
@@ -945,13 +988,13 @@ namespace PepperDash.Essentials.UIDrivers.VC
{
DialStringBuilder.Remove(0, DialStringBuilder.Length);
DialStringFeedback.FireUpdate();
DialStringKeypadCheckEnables();
DialStringTextCheckEnables();
}
/// <summary>
/// Checks the enabled states of various elements around the keypad
/// </summary>
void DialStringKeypadCheckEnables()
void DialStringTextCheckEnables()
{
var textIsEntered = DialStringBuilder.Length > 0;
TriList.SetBool(UIBoolJoin.VCKeypadBackspaceVisible, textIsEntered);
@@ -962,19 +1005,48 @@ namespace PepperDash.Essentials.UIDrivers.VC
Parent.Keyboard.DisableGoButton();
}
/// <summary>
///
/// </summary>
void SearchPress()
{
(Codec as IHasDirectory).SearchDirectory(SearchStringBuilder.ToString());
}
void SearchKeypadPress(string i)
/// <summary>
///
/// </summary>
/// <param name="i"></param>
void SearchKeyboardPress(string i)
{
SearchStringBuilder.Append(i);
SearchStringFeedback.FireUpdate();
SearchStringKeypadCheckEnables();
}
/// <summary>
/// Does what it says
/// </summary>
void StartSearchBackspaceRepeat()
{
if (BackspaceTimer == null)
{
BackspaceTimer = new CTimer(o => SearchKeypadBackspacePress(), null, 0, 175);
}
}
/// <summary>
/// Does what it says
/// </summary>
void StopSearchBackspaceRepeat()
{
if (BackspaceTimer != null)
{
BackspaceTimer.Stop();
BackspaceTimer = null;
}
}
/// <summary>
///
/// </summary>