Skip to content

Commit

Permalink
Expose the Button Click type for Clickable Rotaries
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueFinBima committed Sep 17, 2024
1 parent 5ea0789 commit 83ab26e
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 19 deletions.
5 changes: 2 additions & 3 deletions Helios/Controls/PotentiometerBehaviorEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="80"/>
Expand All @@ -31,7 +31,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="4,10,2,2" Style="{StaticResource Heading2}">Value</TextBlock>
<Label Grid.Column="0" Grid.Row="1" FontSize="10" HorizontalAlignment="Right">
Expand All @@ -56,7 +56,6 @@
<Label.ToolTip>When set, this control wraps around after traveling 360 degrees and has no end point.</Label.ToolTip> Continuous
</Label>
<CheckBox Grid.Column="1" Grid.Row="5" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.IsContinuous}" Style="{StaticResource ShowIfContinuousConfigurable}" />

<HeliosBase:RotaryInteractionEditor Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="6"></HeliosBase:RotaryInteractionEditor>
</Grid>
</HeliosSdk:HeliosPropertyEditor>
9 changes: 8 additions & 1 deletion Helios/Controls/PotentiometerClickable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public PotentiometerClickable() : base("Clickable Potentiometer")
_value = new HeliosValue(this, new BindingValue(false), "", "circuit state", "Current open/closed state of this buttons circuit.", "True if the button is currently closed (on), otherwise false.", BindingValueUnits.Boolean);
Values.Add(_value);
}
public PushButtonType ButtonType
#region Properties
public override PushButtonType ButtonType
{
get
{
Expand Down Expand Up @@ -180,6 +181,12 @@ public bool IsClosed
}
}
}
public override bool ClickConfigurable
{
get => true;
}

#endregion
void PushedValue_Execute(object action, HeliosActionEventArgs e)
{
BeginTriggerBypass(e.BypassCascadingTriggers);
Expand Down
4 changes: 3 additions & 1 deletion Helios/Controls/PotentiometerKnob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ public double RotationTravel
}

internal double MaxRotation => InitialRotation + RotationTravel;


public virtual PushButtonType ButtonType { get; set; }
public virtual bool ClickConfigurable { get => false; }
#endregion

#region Actions
Expand Down
2 changes: 2 additions & 0 deletions Helios/Controls/RotaryEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public double InitialRotation
}
}
}
public virtual PushButtonType ButtonType { get; set; }
public virtual bool ClickConfigurable { get => false; }

#endregion
#region Actions
Expand Down
4 changes: 3 additions & 1 deletion Helios/Controls/RotaryEncoderBehaviorEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="4,10,2,2" Style="{StaticResource Heading2}">Value</TextBlock>
<Label Grid.Column="0" Grid.Row="1" FontSize="10" HorizontalAlignment="Right"><Label.ToolTip>Value passed through to increment and decrement triggers.</Label.ToolTip>Step Value</Label>
<Label Grid.Column="0" Grid.Row="1" FontSize="10" HorizontalAlignment="Right">
<Label.ToolTip>Value passed through to increment and decrement triggers.</Label.ToolTip>Step Value
</Label>
<HeliosSdk:HeliosTextBox Grid.Column="1" Grid.Row="1" FontSize="10" Margin="2" Text="{Binding Control.StepValue}" />
<HeliosBase:RotaryInteractionEditor Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"/>
</Grid>
Expand Down
8 changes: 7 additions & 1 deletion Helios/Controls/RotaryEncoderClickable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public RotaryEncoderClickable() : base("Clickable Rotary Encoder")
_value = new HeliosValue(this, new BindingValue(false), "", "circuit state", "Current open/closed state of this buttons circuit.", "True if the button is currently closed (on), otherwise false.", BindingValueUnits.Boolean);
Values.Add(_value);
}
public PushButtonType ButtonType
#region properties
public override PushButtonType ButtonType
{
get
{
Expand Down Expand Up @@ -176,6 +177,11 @@ public bool IsClosed
}
}
}
public override bool ClickConfigurable
{
get => true;
}
#endregion
void PushedValue_Execute(object action, HeliosActionEventArgs e)
{
BeginTriggerBypass(e.BypassCascadingTriggers);
Expand Down
38 changes: 27 additions & 11 deletions Helios/Controls/RotaryInteractionEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Height="Auto" d:DesignWidth="180">
<Grid.Resources>
<Helios:EnumConverter Type="{x:Type HeliosBase:RotaryClickType}" x:Key="ClickTypes" />
<Helios:EnumConverter Type="{x:Type HeliosBase:PushButtonType}" x:Key="ButtonTypes" />

<Style x:Key="SwipeLabelStyle" TargetType="Label">
<Style.Triggers>
Expand All @@ -26,13 +27,24 @@
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>

<Style x:Key="ShowIfClickConfigurable" TargetType="FrameworkElement">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Control.ClickConfigurable}" Value="true">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>

</Grid.Resources>
<Grid Background="Transparent" Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="80"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
Expand All @@ -41,27 +53,31 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="4,10,2,2" Style="{StaticResource Heading2}">Interaction / Touch</TextBlock>
<Label Grid.Column="0" Grid.Row="1" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Label Grid.Column="0" Grid.Row="1" FontSize="10" HorizontalAlignment="Right" Content="Center Click Type" Style="{StaticResource ShowIfClickConfigurable}">
<Label.ToolTip>Type of button which will be eumlated by pressing center of control.</Label.ToolTip>
</Label>
<ComboBox Grid.Column="1" Grid.Row="1" Margin="0,2,0,2" HorizontalAlignment="Stretch" ItemsSource="{Binding Source={StaticResource ButtonTypes}, Path=DisplayNames}" Style="{StaticResource ShowIfClickConfigurable}" SelectedItem="{Binding Path=Control.ButtonType, Converter={StaticResource ButtonTypes}}" />
<Label Grid.Column="0" Grid.Row="2" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Label.ToolTip>When set to touch this switch will respond to control regions (left/right) and switch the switch appropriatly.
Swipe will switch the switch in the direction you swipe your finger or mouse using a circular motion.
Radial precision mode involves dragging a handle out of the control and then rotating that around the control.</Label.ToolTip> Click Type
</Label>
<ComboBox Grid.Column="1" Grid.Row="1" FontSize="10" Margin="0,2,0,2" HorizontalAlignment="Stretch" ItemsSource="{Binding Source={StaticResource ClickTypes}, Path=DisplayNames}" SelectedItem="{Binding Path=Control.ClickType, Converter={StaticResource ClickTypes}}" />
<Label Grid.Column="0" Grid.Row="2" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0" Style="{StaticResource SwipeLabelStyle}">
<ComboBox Grid.Column="1" Grid.Row="2" FontSize="10" Margin="0,2,0,2" HorizontalAlignment="Stretch" ItemsSource="{Binding Source={StaticResource ClickTypes}, Path=DisplayNames}" SelectedItem="{Binding Path=Control.ClickType, Converter={StaticResource ClickTypes}}" />
<Label Grid.Column="0" Grid.Row="3" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0" Style="{StaticResource SwipeLabelStyle}">
<Label.ToolTip>When set left it will take more rotation to switch a position to the right postions will move rapidly.</Label.ToolTip> Sensitivity
</Label>
<Slider Grid.Column="1" Grid.Row="2" Margin="0,6,0,0" Minimum="-1" Maximum="1" TickFrequency="0.1" TickPlacement="BottomRight" Value="{Binding Control.Sensitivity}" Style="{StaticResource SwipeSliderStyle}" />
<Label Grid.Column="0" Grid.Row="3" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Slider Grid.Column="1" Grid.Row="3" Margin="0,6,0,0" Minimum="-1" Maximum="1" TickFrequency="0.1" TickPlacement="BottomRight" Value="{Binding Control.Sensitivity}" Style="{StaticResource SwipeSliderStyle}" />
<Label Grid.Column="0" Grid.Row="4" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Label.ToolTip>When set, mousewheel will move the rotary.</Label.ToolTip> Mouse Wheel
</Label>
<CheckBox Grid.Column="1" Grid.Row="3" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.MouseWheelAction}" />
<Label Grid.Column="0" Grid.Row="4" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<CheckBox Grid.Column="1" Grid.Row="4" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.MouseWheelAction}" />
<Label Grid.Column="0" Grid.Row="5" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Label.ToolTip>When set, control may draw additional visualization for interaction that is not physically realistic.</Label.ToolTip> Visualizations
</Label>
<CheckBox Grid.Column="1" Grid.Row="4" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.VisualizeInteraction}" />
<Label Grid.Column="0" Grid.Row="5" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<CheckBox Grid.Column="1" Grid.Row="5" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.VisualizeInteraction}" />
<Label Grid.Column="0" Grid.Row="6" FontSize="10" HorizontalAlignment="Right" Margin="0,1,0,0">
<Label.ToolTip>When set, this control can be connected to a control router by clicking on it.</Label.ToolTip> Routable
</Label>
<CheckBox Grid.Column="1" Grid.Row="5" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.Routable}" />
<CheckBox Grid.Column="1" Grid.Row="6" VerticalAlignment="Top" Margin="0,6,6,6" IsChecked="{Binding Path=Control.Routable}" />
</Grid>
</Grid>
3 changes: 2 additions & 1 deletion Helios/Controls/RotarySwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ public int DefaultPosition
OnPropertyChanged("DefaultPosition", oldValue, value, true);
}
}

public virtual PushButtonType ButtonType { get; set; }
public virtual bool ClickConfigurable { get => false; }
#endregion

void LabelFormat_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
Expand Down

0 comments on commit 83ab26e

Please sign in to comment.