diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-03-03 00:52:22 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-03-03 00:52:22 +0200 |
| commit | 79ffa1774217400bd750f6a85df9f969429580c3 (patch) | |
| tree | 1d093fcaa82c2f1940a330a6a5852d879ffe5409 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls | |
| parent | 65d7f918b273a572d2d9a1d08a2797ea76b10850 (diff) | |
| download | Tango-79ffa1774217400bd750f6a85df9f969429580c3.tar.gz Tango-79ffa1774217400bd750f6a85df9f969429580c3.zip | |
Added Delta Resolution for Hive Color Picker.
Implemented Embroidery PMR.
Implemented Embroidery Native Adapter.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls')
2 files changed, 60 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml index 6a9bf9cc9..2aa11c63c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml @@ -4,14 +4,17 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" mc:Ignorable="d" - d:DesignHeight="250" d:DesignWidth="500" > + d:DesignHeight="250" d:DesignWidth="550" Background="White"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="235"/> - <ColumnDefinition Width="43*"/> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="50"/> </Grid.ColumnDefinitions> <colorPicker:ColorCanvas SelectedColor="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedColor,Mode=TwoWay}" Background="Transparent" BorderThickness="0" UsingAlphaChannel="False" /> @@ -19,5 +22,30 @@ <Viewbox Stretch="Uniform" Grid.Column="1" Margin="5"> <controls:HiveControl x:Name="hive" Height="250" HexagonSelected="hive_HexagonSelected" MaxSelections="1" Width="250" BorderThickness="1" /> </Viewbox> + + <Grid Grid.Column="2"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="45"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Button ToolTip="Increase Delta Resolution" Click="OnResolutionUpClicked" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Bottom"> + <materialDesign:PackIcon Kind="ArrowUp" Width="24" Height="24" /> + </Button> + + <Grid Grid.Row="1"> + <shapes:Hexagon Stroke="#202020" StrokeThickness="1" Margin="5" /> + <TextBlock TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontStyle="Italic" FontSize="10"> + <Run Text="Δ"></Run> + <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Resolution,FallbackValue=1}"></Run> + </TextBlock> + </Grid> + + <Button ToolTip="Decrease Delta Resolution" Click="OnResolutionDownClicked" Grid.Row="2" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Top"> + <materialDesign:PackIcon Kind="ArrowDown" Width="24" Height="24" /> + </Button> + </Grid> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs index 9432ae9ef..7d1a1dc81 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs @@ -31,6 +31,14 @@ namespace Tango.MachineStudio.Common.Controls public static readonly DependencyProperty DemoModeProperty = DependencyProperty.Register("DemoMode", typeof(bool), typeof(HiveColorPickerControl), new PropertyMetadata(false)); + public int Resolution + { + get { return (int)GetValue(ResolutionProperty); } + set { SetValue(ResolutionProperty, value); } + } + public static readonly DependencyProperty ResolutionProperty = + DependencyProperty.Register("Resolution", typeof(int), typeof(HiveColorPickerControl), new PropertyMetadata(1, (d, e) => (d as HiveColorPickerControl).OnResolutionChanged())); + public Color SelectedColor { get { return (Color)GetValue(SelectedColorProperty); } @@ -80,6 +88,11 @@ namespace Tango.MachineStudio.Common.Controls _preventHiveSelectedColorChange = false; } + private void OnResolutionChanged() + { + GenerateDemoModeHiveColors(); + } + private void GenerateDemoModeHiveColors() { if (hive.CenterHexagon != null) @@ -94,9 +107,25 @@ namespace Tango.MachineStudio.Common.Controls { (hexagon.Fill as SolidColorBrush).Color = Color.FromRgb((byte)Math.Min(SelectedColor.R + counter++, 255), (byte)Math.Min((SelectedColor.G + counter++), 255), (byte)Math.Min((SelectedColor.B + counter++), 255)); - counter += 4; + counter += (int)(4d * ((double)Resolution / 4d)); } } } + + private void OnResolutionUpClicked(object sender, RoutedEventArgs e) + { + if (Resolution < 10) + { + Resolution++; + } + } + + private void OnResolutionDownClicked(object sender, RoutedEventArgs e) + { + if (Resolution > 1) + { + Resolution--; + } + } } } |
