From 10eec8df1dfce197b31d51cfa49746b0ce07a5e5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 28 Jan 2018 17:27:49 +0200 Subject: Added Segment Brush Stops and Dynamic Ink Volumes! --- .../Images/color-palette.png | Bin 0 -> 1880 bytes .../Images/colorspace.png | Bin 0 -> 4232 bytes .../Tango.MachineStudio.Developer.csproj | 6 ++ .../ViewModels/MainViewVM.cs | 71 ++++++++++++++- .../Views/MainView.xaml | 99 +++++++++++++++++++-- 5 files changed, 169 insertions(+), 7 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png (limited to 'Software/Visual_Studio/MachineStudio/Modules') 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 new file mode 100644 index 000000000..b1c58876f Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/color-palette.png differ 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 new file mode 100644 index 000000000..fca9f226e Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/colorspace.png differ 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 @@ + + + + + + \ 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; + /// + /// Gets or sets the selected segment selected brush stop. + /// + public BrushStop SelectedBrushStop + { + get { return _selectedBrushStop; } + set { _selectedBrushStop = value; RaisePropertyChangedAuto(); } } private Rml _selectedRML; @@ -219,6 +229,16 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand RemoveJobCommand { get; set; } + /// + /// Gets or sets the add brush stop command. + /// + public RelayCommand AddBrushStopCommand { get; set; } + + /// + /// Gets or sets the remove brush stop command. + /// + 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 @@ -278,10 +300,22 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods + /// + /// Called when the selected segment has been changed + /// + protected virtual void OnSelectedSegmentChanged() + { + if (SelectedSegment != null) + { + SetSegmentBrushStopsInkVolumes(SelectedSegment); + SelectedBrushStop = SelectedSegment.BrushStops.FirstOrDefault(); + } + } + /// /// Called when the selected job has been changed. /// - 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); + } + } + /// /// Saves the liquid factors. /// @@ -460,6 +502,31 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + /// + /// Removes the selected brush stop. + /// + private void RemoveBrushStop() + { + if (SelectedBrushStop != null && SelectedSegment != null) + { + SelectedSegment.BrushStops.Remove(SelectedBrushStop); + } + } + + /// + /// Adds a new brush stop to the selected segment. + /// + 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 @@ @@ -437,10 +437,10 @@ @@ -486,8 +486,97 @@ - + + + + + + + + + + + + SEGMENT BRUSH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color Space + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1