diff --git a/Helios/Controls/ClickType.cs b/Helios/Controls/ClickType.cs index d8ed5cdf1..33f39c1fd 100644 --- a/Helios/Controls/ClickType.cs +++ b/Helios/Controls/ClickType.cs @@ -47,5 +47,22 @@ public enum LinearClickType [Description("Swipe over the control in the direction it should move")] Swipe, + + [Description("Touch the control anywhere to switch it")] + OneTouch, + } + + /// + /// interaction styles for linear controls that require a direction to work + /// + /// WARNING: these value names must never be changed, as they are serialized to Profile XML + /// + public enum LinearClickTypeDirectional + { + [Description("Touch the location towards which the control should move")] + Touch, + + [Description("Swipe over the control in the direction it should move")] + Swipe, } } diff --git a/Helios/Controls/GuardedSwitch.cs b/Helios/Controls/GuardedSwitch.cs index aaef99d81..93ca6a404 100644 --- a/Helios/Controls/GuardedSwitch.cs +++ b/Helios/Controls/GuardedSwitch.cs @@ -285,7 +285,7 @@ public override void MouseDown(Point location) _mouseDownLocation = location; _mouseAction = false; } - else if (ClickType == LinearClickType.Touch) + else if (ClickType == LinearClickType.Touch || ClickType == LinearClickType.OneTouch) { switch (GuardPosition) { diff --git a/Helios/Controls/GuardedThreeWayToggle.cs b/Helios/Controls/GuardedThreeWayToggle.cs index 6de773762..0c7198725 100644 --- a/Helios/Controls/GuardedThreeWayToggle.cs +++ b/Helios/Controls/GuardedThreeWayToggle.cs @@ -493,6 +493,37 @@ public override void MouseDown(Point location) break; } } + + else if (ClickType == LinearClickType.OneTouch) + { + switch (GuardPosition) + { + case GuardPosition.Up: + if (_guardUpRegion.Contains(location)) + { + GuardPosition = Controls.GuardPosition.Down; + } + else if (_switchRegion.Contains(location)) + { + switch (SwitchPosition) + { + case ThreeWayToggleSwitchPosition.Three: + SwitchPosition = ThreeWayToggleSwitchPosition.One; + break; + default: + ++SwitchPosition; + break; + } + } + break; + case GuardPosition.Down: + if (_guardDownRegion.Contains(location)) + { + GuardPosition = Controls.GuardPosition.Up; + } + break; + } + } } public override void MouseDrag(Point location) diff --git a/Helios/Controls/GuardedToggleSwitch.cs b/Helios/Controls/GuardedToggleSwitch.cs index 97caf0ab3..92f7d0d05 100644 --- a/Helios/Controls/GuardedToggleSwitch.cs +++ b/Helios/Controls/GuardedToggleSwitch.cs @@ -426,6 +426,37 @@ public override void MouseDown(Point location) break; } } + + else if (ClickType == LinearClickType.OneTouch) + { + switch (GuardPosition) + { + case GuardPosition.Up: + if (_guardUpRegion.Contains(location)) + { + GuardPosition = Controls.GuardPosition.Down; + } + else if (_switchRegion.Contains(location)) + { + switch (SwitchPosition) + { + case ToggleSwitchPosition.Two: + SwitchPosition = ToggleSwitchPosition.One; + break; + default: + ++SwitchPosition; + break; + } + } + break; + case GuardPosition.Down: + if (_guardDownRegion.Contains(location)) + { + GuardPosition = Controls.GuardPosition.Up; + } + break; + } + } } public override void MouseDrag(Point location) diff --git a/Helios/Controls/KneeboardSwitch.cs b/Helios/Controls/KneeboardSwitch.cs index ce8a4f686..f29c16d01 100644 --- a/Helios/Controls/KneeboardSwitch.cs +++ b/Helios/Controls/KneeboardSwitch.cs @@ -302,6 +302,9 @@ protected override void ThrowSwitch(ToggleSwitchBase.SwitchAction action) case KneeboardSwitchPosition.Two: SwitchPosition = KneeboardSwitchPosition.Three; break; + default: + SwitchPosition = KneeboardSwitchPosition.One; + break; } } else if (action == SwitchAction.Decrement) @@ -314,6 +317,9 @@ protected override void ThrowSwitch(ToggleSwitchBase.SwitchAction action) case KneeboardSwitchPosition.Three: SwitchPosition = KneeboardSwitchPosition.Two; break; + default: + SwitchPosition = KneeboardSwitchPosition.One; + break; } } } diff --git a/Helios/Controls/Metric.cs b/Helios/Controls/Metric.cs index ee09605f5..dce35b4bd 100644 --- a/Helios/Controls/Metric.cs +++ b/Helios/Controls/Metric.cs @@ -25,7 +25,7 @@ public abstract class Metric : HeliosVisual private bool _mouseDown = false; private Point _mouseDownLocation; - protected LinearClickType _clickType = LinearClickType.Swipe; + protected LinearClickTypeDirectional _clickType = LinearClickTypeDirectional.Swipe; private CalibrationPointCollectionDouble _swipeCalibration; private double _swipeThreshold = 10; private double _sensitivity = 0d; @@ -44,7 +44,7 @@ protected Metric ( string name, Size defaultSize ) #region Properties - public LinearClickType ClickType + public LinearClickTypeDirectional ClickType { get { @@ -54,7 +54,7 @@ public LinearClickType ClickType { if ( !_clickType.Equals( value ) ) { - LinearClickType oldValue = _clickType; + LinearClickTypeDirectional oldValue = _clickType; _clickType = value; OnPropertyChanged( "ClickType", oldValue, value, true ); } @@ -242,7 +242,7 @@ private double GetAngle ( Point startPoint, Point endPoint ) public override void MouseDown ( Point location ) { - if ( _clickType == LinearClickType.Touch ) + if ( _clickType == LinearClickTypeDirectional.Touch ) { if ( _clickableVertical ) { @@ -268,7 +268,7 @@ public override void MouseDown ( Point location ) // Parent.Profile.ProfileTick += new EventHandler( Profile_ProfileTick ); //} } - else if ( _clickType == LinearClickType.Swipe ) + else if ( _clickType == LinearClickTypeDirectional.Swipe ) { _mouseDown = true; _mouseDownLocation = location; @@ -301,7 +301,7 @@ void Profile_ProfileTick ( object sender, EventArgs e ) public override void MouseDrag ( Point location ) { - if ( _mouseDown && _clickType == LinearClickType.Swipe ) + if ( _mouseDown && _clickType == LinearClickTypeDirectional.Swipe ) { if ( DragOneForOne ) { diff --git a/Helios/Controls/PotentiometerWithTranslate.cs b/Helios/Controls/PotentiometerWithTranslate.cs index f984c7403..f7aeff219 100644 --- a/Helios/Controls/PotentiometerWithTranslate.cs +++ b/Helios/Controls/PotentiometerWithTranslate.cs @@ -679,7 +679,7 @@ public override void WriteXml ( XmlWriter writer ) writer.WriteStartElement( "ClickType" ); writer.WriteElementString( "Type", ClickType.ToString( ) ); - if ( ClickType == LinearClickType.Swipe ) + if ( ClickType == LinearClickTypeDirectional.Swipe ) { writer.WriteElementString( "Sensitivity", Sensitivity.ToString( CultureInfo.InvariantCulture ) ); } @@ -723,7 +723,7 @@ public override void ReadXml ( XmlReader reader ) if ( reader.Name.Equals( "ClickType" ) ) { reader.ReadStartElement( "ClickType" ); - ClickType = (LinearClickType)Enum.Parse( typeof( LinearClickType ), reader.ReadElementString( "Type" ) ); + ClickType = (LinearClickTypeDirectional)Enum.Parse( typeof( LinearClickTypeDirectional ), reader.ReadElementString( "Type" ) ); if (reader.Name == "Sensitivity") { Sensitivity = double.Parse( reader.ReadElementString( "Sensitivity" ), CultureInfo.InvariantCulture ); @@ -732,7 +732,7 @@ public override void ReadXml ( XmlReader reader ) } else { - ClickType = LinearClickType.Swipe; + ClickType = LinearClickTypeDirectional.Swipe; Sensitivity = 0d; } diff --git a/Helios/Controls/PotentiometerWithTranslateBehaviorEditor.xaml b/Helios/Controls/PotentiometerWithTranslateBehaviorEditor.xaml index 2e0ee57ca..c5a938e7a 100644 --- a/Helios/Controls/PotentiometerWithTranslateBehaviorEditor.xaml +++ b/Helios/Controls/PotentiometerWithTranslateBehaviorEditor.xaml @@ -10,7 +10,7 @@ DataContext="{Binding RelativeSource={RelativeSource Self}}" Height="609.143" Width="176.5"> - +