diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-28 17:27:49 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-28 17:27:49 +0200 |
| commit | 10eec8df1dfce197b31d51cfa49746b0ce07a5e5 (patch) | |
| tree | c00545560db4168a2f87f7347f97090445672c0a /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 20f0dc40cdbe85ab7cfedd78a9bc883e4469e4ab (diff) | |
| download | Tango-10eec8df1dfce197b31d51cfa49746b0ce07a5e5.tar.gz Tango-10eec8df1dfce197b31d51cfa49746b0ce07a5e5.zip | |
Added Segment Brush Stops and Dynamic Ink Volumes!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
5 files changed, 169 insertions, 7 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png Binary files differnew file mode 100644 index 000000000..b1c58876f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png Binary files differnew file mode 100644 index 000000000..fca9f226e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png 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 71527d1dc..dc3f9947a 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 @@ -197,5 +197,11 @@ <ItemGroup> <Resource Include="Images\ruler.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\color-palette.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\colorspace.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file 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 e77093eee..4e3b4ec13 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 @@ -121,7 +121,17 @@ namespace Tango.MachineStudio.Developer.ViewModels public Segment SelectedSegment { get { return _selectedSegment; } - set { _selectedSegment = value; RaisePropertyChangedAuto(); } + set { _selectedSegment = value; RaisePropertyChangedAuto(); OnSelectedSegmentChanged(); } + } + + private BrushStop _selectedBrushStop; + /// <summary> + /// Gets or sets the selected segment selected brush stop. + /// </summary> + public BrushStop SelectedBrushStop + { + get { return _selectedBrushStop; } + set { _selectedBrushStop = value; RaisePropertyChangedAuto(); } } private Rml _selectedRML; @@ -219,6 +229,16 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand RemoveJobCommand { get; set; } + /// <summary> + /// Gets or sets the add brush stop command. + /// </summary> + public RelayCommand AddBrushStopCommand { get; set; } + + /// <summary> + /// Gets or sets the remove brush stop command. + /// </summary> + public RelayCommand RemoveBrushStopCommand { get; set; } + #endregion #region Constructors @@ -258,6 +278,8 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveSegmentCommand = new RelayCommand(RemoveSegment); AddJobCommand = new RelayCommand(AddJob); RemoveJobCommand = new RelayCommand(RemoveJob); + AddBrushStopCommand = new RelayCommand(AddBrushStop); + RemoveBrushStopCommand = new RelayCommand(RemoveBrushStop); } #endregion @@ -279,9 +301,21 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods /// <summary> + /// Called when the selected segment has been changed + /// </summary> + protected virtual void OnSelectedSegmentChanged() + { + if (SelectedSegment != null) + { + SetSegmentBrushStopsInkVolumes(SelectedSegment); + SelectedBrushStop = SelectedSegment.BrushStops.FirstOrDefault(); + } + } + + /// <summary> /// Called when the selected job has been changed. /// </summary> - private void OnSelectedJobChanged() + protected virtual void OnSelectedJobChanged() { if (SelectedJob != null) { @@ -312,6 +346,14 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void SetSegmentBrushStopsInkVolumes(Segment segment) + { + foreach (var stop in segment.BrushStops) + { + stop.SetInkVolumes(SelectedMachine.Configuration); + } + } + /// <summary> /// Saves the liquid factors. /// </summary> @@ -460,6 +502,31 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + /// <summary> + /// Removes the selected brush stop. + /// </summary> + private void RemoveBrushStop() + { + if (SelectedBrushStop != null && SelectedSegment != null) + { + SelectedSegment.BrushStops.Remove(SelectedBrushStop); + } + } + + /// <summary> + /// Adds a new brush stop to the selected segment. + /// </summary> + private void AddBrushStop() + { + if (SelectedSegment != null) + { + var stop = new BrushStop(); + stop.ColorSpace = Adapter.ColorSpaces.FirstOrDefault(); + stop.SetInkVolumes(SelectedMachine.Configuration); + SelectedSegment.BrushStops.Add(stop); + } + } + #endregion #region Public Events 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 572ebc785..e7aa85fb8 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 @@ -312,10 +312,10 @@ </StackPanel> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> <Button Command="{Binding RemoveJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment"> - <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="MinusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> </Button> <Button Command="{Binding AddJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment"> - <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="PlusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> </Button> </StackPanel> <ListBox ItemsSource="{Binding SelectedMachine.Jobs}" SelectedItem="{Binding SelectedJob}" Margin="0 10 0 0"> @@ -437,10 +437,10 @@ <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> <Button Command="{Binding RemoveSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment"> - <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="MinusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> </Button> <Button Command="{Binding AddSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment"> - <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + <materialDesign:PackIcon Kind="PlusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> </Button> </StackPanel> @@ -486,8 +486,97 @@ </Border> </StackPanel> - <Grid> + <Grid DockPanel.Dock="Bottom"> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> + <Button Command="{Binding RemoveBrushStopCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment"> + <materialDesign:PackIcon Kind="MinusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + <Button Command="{Binding AddBrushStopCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment"> + <materialDesign:PackIcon Kind="PlusCircleOutline" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + </StackPanel> + </Grid> + + <Grid Margin="0 20 0 0"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <Image Source="../Images/color-palette.png" Width="42"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">SEGMENT BRUSH</TextBlock> + </StackPanel> + <Grid Margin="0 10 0 0"> + <ListBox Style="{x:Null}" ScrollViewer.CanContentScroll="False" BorderThickness="0" ItemsSource="{Binding SelectedSegment.BrushStops}" SelectedItem="{Binding SelectedBrushStop}" HorizontalContentAlignment="Stretch"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}"> + + </Style> + </ListBox.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:BrushStop}"> + <Border BorderThickness="1" CornerRadius="5" Margin="0 0 0 5" Padding="10"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="BorderBrush" Value="{StaticResource SideBarBackground}"></Setter> + <Setter Property="Background" Value="White"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="BorderBrush" Value="Gainsboro"></Setter> + <Setter Property="Background" Value="{StaticResource SideBarBackground}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <DockPanel> + <StackPanel DockPanel.Dock="Left" VerticalAlignment="Center"> + <ItemsControl ItemsSource="{Binding InkVolumes}" VerticalAlignment="Center"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border BorderThickness="1" Width="50" Height="50" CornerRadius="50" Margin="10 0 0 0"> + <Border.BorderBrush> + <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Border.BorderBrush> + <mahapps:NumericUpDown FontSize="14" FontFamily="digital-7" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"> + </Style> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + <Grid DockPanel.Dock="Right"> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/colorspace.png" Width="24"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Color Space</TextBlock> + </StackPanel> + <ComboBox ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Adapter.ColorSpaces}" SelectedItem="{Binding ColorSpace}" DisplayMemberPath="Name"></ComboBox> + </StackPanel> + </Border> + </Grid> + <Grid> + <StackPanel VerticalAlignment="Center"> + <TextBlock Width="150" TextAlignment="Center" HorizontalAlignment="Center"><Run FontWeight="Bold" FontStyle="Italic" Text="OFFSET:"></Run> <Run FontFamily="digital-7" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run></TextBlock> + <Slider Margin="0 5 0 0" HorizontalAlignment="Center" Width="150" Minimum="0" Maximum="100" Value="{Binding OffsetPercent}"></Slider> + </StackPanel> + </Grid> + </DockPanel> + </Grid> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ListBox> + </Grid> + </DockPanel> </Grid> </DockPanel> </Grid> |
