aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs52
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml79
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs5
5 files changed, 128 insertions, 17 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs
new file mode 100644
index 000000000..d8ac744a9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/BrushStopToOffsetValueConverter.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using Tango.Integration.Observables;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class BrushStopToOffsetValueConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ BrushStop stop = values[0] as BrushStop;
+ Segment segment = values[1] as Segment;
+
+ if (stop != null && segment != null)
+ {
+ if (segment.BrushStops.IndexOf(stop) == segment.BrushStops.Count - 1)
+ {
+ return 100d;
+ }
+ else if (segment.BrushStops.IndexOf(stop) == 0)
+ {
+ return 0d;
+ }
+ else
+ {
+ return stop.OffsetPercent;
+ }
+ }
+ else
+ {
+ return 0d;
+ }
+ }
+ catch
+ {
+ return 0d;
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index 7a3e838cf..ee3295d45 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
@@ -94,6 +94,7 @@
<Compile Include="Converters\BrushStopCMYKToColorConverter.cs" />
<Compile Include="Converters\BrushStopToColorConverter.cs" />
<Compile Include="Converters\BrushStopToOffsetLimitConverter.cs" />
+ <Compile Include="Converters\BrushStopToOffsetValueConverter.cs" />
<Compile Include="Converters\DbRmlViewToEntityConverter.cs" />
<Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" />
<Compile Include="Converters\JobProgressToPositionConverter.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index 4cf14a216..4e7c5ec12 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -1015,11 +1015,17 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// <param name="droppedStop">The dropped stop.</param>
public void OnDropBrushStop(BrushStop draggedStop, BrushStop droppedStop)
{
+ SelectedSegment.BrushStops.Swap(draggedStop, droppedStop);
+
int tmpIndex = draggedStop.StopIndex;
draggedStop.StopIndex = droppedStop.StopIndex;
droppedStop.StopIndex = tmpIndex;
- SelectedSegment.BrushStops.Swap(draggedStop, droppedStop);
+ if (SelectedSegment.BrushStops.Count > 1)
+ {
+ SelectedSegment.BrushStops.First().OffsetPercent = 0;
+ SelectedSegment.BrushStops.Last().OffsetPercent = 100;
+ }
}
/// <summary>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index ae57c2d25..f716b6228 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -53,6 +53,7 @@
<localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" />
<localConverters:ObjectsNotEqualToBooleanConveter x:Key="ObjectsNotEqualToBooleanConveter" />
<localConverters:JobProgressToPositionConverter x:Key="JobProgressToPositionConverter" />
+ <localConverters:BrushStopToOffsetValueConverter x:Key="BrushStopToOffsetValueConverter" />
<SolidColorBrush x:Key="SideBarBackground" Color="White">
@@ -806,21 +807,43 @@
</Button>
</StackPanel>
</Border>
- <ListBox ItemsSource="{Binding SelectedMachine.Jobs}" SelectedItem="{Binding SelectedJob}" Margin="0 10 0 0">
+ <ListBox ItemsSource="{Binding SelectedMachine.Jobs}" SelectedItem="{Binding SelectedJob}" Margin="0 10 0 0" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
- <Grid>
- <StackPanel Orientation="Horizontal">
+ <DockPanel>
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
<Image Source="../Images/rgb.png" Width="32"></Image>
<StackPanel VerticalAlignment="Center" Margin="10 0 0 0">
<TextBlock FontWeight="Bold" Text="{Binding Name}"></TextBlock>
<TextBlock Foreground="Gray" FontStyle="Italic" FontSize="10" Text="{Binding CreationDate}"></TextBlock>
</StackPanel>
-
-
</StackPanel>
- </Grid>
+
+ <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+
+ </StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3">
+ <Border.Background>
+ <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}">
+ <Binding Path="."></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob.Length"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding>
+ </MultiBinding>
+ </Border.Background>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
@@ -956,13 +979,32 @@
</StackPanel>
</Border>
- <ListBox SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SelectedJob.Segments}" SelectedItem="{Binding SelectedSegment}">
+ <ListBox SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SelectedJob.Segments}" SelectedItem="{Binding SelectedSegment}" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
- <StackPanel Orientation="Horizontal" Margin="0 5 0 0">
+ <DockPanel>
+ <StackPanel Orientation="Horizontal" Margin="0 5 0 0" DockPanel.Dock="Left">
<Image Source="../Images/segment-single.png" Width="24"></Image>
<TextBlock Margin="5 0 0 0" Text="{Binding Name}" FontSize="12" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock>
</StackPanel>
+
+ <ItemsControl ItemsSource="{Binding BrushStops}" HorizontalAlignment="Right" Margin="0 5 0 0">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center"></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Ellipse Width="8" Height="8" Stroke="DimGray" Margin="5 0 0 0">
+ <Ellipse.Fill>
+ <SolidColorBrush Color="{Binding Color}" />
+ </Ellipse.Fill>
+ </Ellipse>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
@@ -1232,8 +1274,22 @@
</Grid>
<Grid>
<StackPanel VerticalAlignment="Center">
- <TextBlock Width="150" TextAlignment="Center" HorizontalAlignment="Center"><Run FontWeight="Bold" FontStyle="Italic" Text="OFFSET:"></Run> <Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run></TextBlock>
- <Slider ValueChanged="Offset_Slider_ValueChanged" IsSnapToTickEnabled="True" TickFrequency="1" Margin="0 5 0 0" HorizontalAlignment="Center" Width="150" Value="{Binding OffsetPercent}">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedSegment.BrushStops.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=1}" Value="True">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <TextBlock Width="150" TextAlignment="Center" HorizontalAlignment="Center">
+ <Run FontWeight="Bold" FontStyle="Italic" Text="OFFSET:"></Run>
+ <Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run>
+ <Run Foreground="Gray" FontSize="9" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run>
+ </TextBlock>
+ <Slider ValueChanged="Offset_Slider_ValueChanged" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 5 0 0" HorizontalAlignment="Center" Width="150" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}">
<Slider.Minimum>
<MultiBinding Converter="{StaticResource BrushStopToOffsetLimitConverter}" ConverterParameter="min">
<Binding Path="."></Binding>
@@ -1243,8 +1299,9 @@
</Slider.Minimum>
<Slider.Maximum>
<MultiBinding Converter="{StaticResource BrushStopToOffsetLimitConverter}" ConverterParameter="max">
- <Binding Path="."></Binding>
+ <Binding Path="." Delay="500"></Binding>
<Binding RelativeSource="{RelativeSource AncestorType=UserControl,Mode=FindAncestor}" Path="DataContext.SelectedSegment"></Binding>
+ <Binding Path="StopIndex"></Binding>
</MultiBinding>
</Slider.Maximum>
</Slider>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
index be24711c1..c8d37d9aa 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
@@ -110,11 +110,6 @@ namespace Tango.MachineStudio.Developer.Views
}
}
- private void ColorPickerCombo_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color?> e)
- {
-
- }
-
private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
UpdateGradientBrushDisplay();