diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-01-31 09:52:03 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-01-31 09:52:03 +0200 |
| commit | 141a32a03af30c1b54f5dffbd9953bb57a026fa8 (patch) | |
| tree | 06960064126246e9d4b93a75af26f46309f161eb /Software/Visual_Studio | |
| parent | 2b9a91ba032dcbbeedaefb1d7b06cb93285b99df (diff) | |
| parent | 418e1643cd49755a59b3d15c91303a386d0a635c (diff) | |
| download | Tango-141a32a03af30c1b54f5dffbd9953bb57a026fa8.tar.gz Tango-141a32a03af30c1b54f5dffbd9953bb57a026fa8.zip | |
Merge branch 'software' of https://twinetfs.visualstudio.com/Tango/_git/Tango into software
Diffstat (limited to 'Software/Visual_Studio')
8 files changed, 310 insertions, 78 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs index 7d22245ed..63dc92bcf 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs @@ -35,7 +35,7 @@ namespace Tango.PPC.Jobs.Converters } if (type == "H") { - if((number >0 && number <45) || (number >= 315 && number <360)) + if((number >0 && number <45) || (number >= 315 && number <=360)) return "Redder"; if ((number >= 45 && number < 135) ) return "Yellower"; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 6c4803bd2..28958cbc8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -303,22 +303,22 @@ <DataTemplate DataType="{ x:Type models:FavoriteColor}"> <Grid Margin="0 0 34 0" HorizontalAlignment="Left" VerticalAlignment="Top"> <Grid.RowDefinitions> - <RowDefinition Height="65"/> + <RowDefinition Height="68"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Border Background="{Binding Brush}" Width="65" Height="65" CornerRadius="10" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" HorizontalAlignment="Left" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList , Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <touch:TouchButton Width="65" Height="65" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.SelectColorCommand , ElementName=colorSelectionView}" CommandParameter="{Binding }" /> + <Border Background="{Binding Brush}" Width="68" Height="68" CornerRadius="10" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" HorizontalAlignment="Left" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList , Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <touch:TouchButton Width="68" Height="68" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.SelectColorCommand , ElementName=colorSelectionView}" CommandParameter="{Binding }" /> </Border> - <Border Background="{Binding Brush}" Width="65" Height="65" CornerRadius="10" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" BorderThickness="2" HorizontalAlignment="Left" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList, Converter={StaticResource BooleanToVisibilityConverter}}"> - <touch:TouchButton Width="65" Height="65" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.DeleteColorCommand , ElementName=colorSelectionView}" CommandParameter="{Binding }" > + <Border Background="{Binding Brush}" Width="68" Height="68" CornerRadius="10" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" BorderThickness="2" HorizontalAlignment="Left" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList, Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchButton Width="68" Height="68" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.DeleteColorCommand , ElementName=colorSelectionView}" CommandParameter="{Binding }" > <Border Height="26" Width="28" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/delete_color.png" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> </touch:TouchButton> </Border> <!--<Border Background="{Binding Color}" Width="65" Height="65" CornerRadius="6"></Border>--> - <TextBlock Grid.Row="1" Margin="3 12 0 10" MaxWidth="70" Text="{Binding Name}" FontSize="{StaticResource TangoSmallFontSizeBar}" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList , Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBlock> - <touch:TouchTextBox MaxLength="6" Grid.Row="1" Margin="3 12 0 10" MaxWidth="70" Text="{Binding Name, UpdateSourceTrigger=LostFocus, Mode=TwoWay}" FontSize="{StaticResource TangoSmallFontSizeBar}" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList, Converter={StaticResource BooleanToVisibilityConverter}}"/> + <TextBlock Grid.Row="1" Margin="3 12 0 10" MaxWidth="78" HorizontalAlignment="Left" TextAlignment="Left" Text="{Binding Name}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" ToolTip="{Binding Name}" FontSize="{StaticResource TangoSmallFontSizeBar}" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList , Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBlock> + <touch:TouchTextBox MaxLength="24" Grid.Row="1" Margin="3 12 0 10" MaxWidth="78" Text="{Binding Name, UpdateSourceTrigger=LostFocus, Mode=TwoWay}" FontSize="{StaticResource TangoSmallFontSizeBar}" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList, Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Left" TextBlock.TextAlignment="Left"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> @@ -471,7 +471,7 @@ </StackPanel> </ControlTemplate> </touch:TouchImageButton.Template> - </touch:TouchImageButton> + </touch:TouchImageButton> <ContentControl Name="myLabColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> @@ -530,6 +530,18 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> + <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + Command="{ Binding VectorFineTuningCommand}" > + <touch:TouchImageButton.Template> + <ControlTemplate TargetType="touch:TouchImageButton"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="Manual Fine-Tuning" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Regular" Margin="0 18 5 0"/> + <Image Source="{StaticResource VFineTuning_Dialog}"/> + </StackPanel> + </ControlTemplate> + </touch:TouchImageButton.Template> + </touch:TouchImageButton> + <ContentControl Name="myCMYKColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> <ContentControl Name="segmentCMYKContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}" IsTabStop="False"/> @@ -562,6 +574,17 @@ <RowDefinition Height="1*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> + <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + Command="{ Binding VectorFineTuningCommand}" > + <touch:TouchImageButton.Template> + <ControlTemplate TargetType="touch:TouchImageButton"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="Fine-Tuning" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Regular" Margin="0 18 5 0"/> + <Image Source="{StaticResource VFineTuning_Dialog}"/> + </StackPanel> + </ControlTemplate> + </touch:TouchImageButton.Template> + </touch:TouchImageButton> <ContentControl Name="myCatalogsColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> <DockPanel Grid.Row="1" Margin="0 0 20 0"> <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index f14da496b..7e5f73637 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -509,11 +509,14 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.Guid = InitialBrushStop.Guid; SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if (SelectedBrushStop.ColorSpace == ColorSpaces.Volume) + { SelectedColorTab = ColorTab.Volume; + SelectedBrushStop.SaveColorBeforeChanges(); + } if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) { SelectedColorTab = ColorTab.CIELab; - SelectedBrushStop.SaveLABBeforeChanges(); + SelectedBrushStop.SaveColorBeforeChanges(); } else if (SelectedBrushStop.ColorSpace == ColorSpaces.Catalog) { @@ -531,6 +534,7 @@ namespace Tango.PPC.Jobs.Dialogs // SelectedColorTab = ColorTab.HSB; else if (SelectedBrushStop.ColorSpace == ColorSpaces.RGB) SelectedColorTab = ColorTab.RGB; + SelectedBrushStop.FineTuningChanged = false; } else { @@ -707,7 +711,7 @@ namespace Tango.PPC.Jobs.Dialogs { return; } - if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) + // if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) { var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); if (testColor != null && testColor.TrialslogList.Count > 0) @@ -727,11 +731,18 @@ namespace Tango.PPC.Jobs.Dialogs return; var TestColor = TrialsLogEngine.Default.GetByBrushStopGuid(_selectedBrushStop.Guid); - if (TestColor != null && InitialBrushStop != null && (InitialBrushStop.ColorSpace != ColorSpaces.LAB || TestColor.L != InitialBrushStop.L || TestColor.A != InitialBrushStop.A || TestColor.B != InitialBrushStop.B )) + if (TestColor != null && InitialBrushStop != null && + ((InitialBrushStop.ColorSpace == ColorSpaces.LAB && (TestColor.OpenedFromCatalog != false || TestColor.OpenedFromCMYK != false)) + || (InitialBrushStop.ColorSpace == ColorSpaces.Volume && TestColor.OpenedFromCMYK != true) + || (InitialBrushStop.ColorSpace == ColorSpaces.Catalog && TestColor.OpenedFromCatalog != true))) { TrialsLogEngine.Default.Delete(TestColor); } - + if (DialogEditObject.IsEditingMode) + { + InitialBrushStop.FineTuningChanged = true; + } + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; base.Cancel(); } @@ -1039,14 +1050,21 @@ namespace Tango.PPC.Jobs.Dialogs #region Vector Fine tuning - private void OpenVectorFineTuning() + private async void OpenVectorFineTuning() { - SelectedBrushStop.SaveLABBeforeChanges(); + if (false == await NotifyAboutTrialsDataColorsSpace()) + { + return; + } - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); + SelectedBrushStop.SaveColorBeforeChanges(); + + VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); IsOpenVectorFineTuningDialog = true; - + + VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; + VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; VectorFineTuningDialogVM.Accepted += VectorFineTuningDialogAccepted; VectorFineTuningDialogVM.Canceled += VectorFineTuningDialogCanceled; @@ -1058,6 +1076,7 @@ namespace Tango.PPC.Jobs.Dialogs VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; IsOpenVectorFineTuningDialog = false; + SelectedBrushStop.FineTuningChanged = true; } private void VectorFineTuningDialogAccepted() @@ -1106,13 +1125,36 @@ namespace Tango.PPC.Jobs.Dialogs else { await NotificationProvider.ShowInfo("The color will not be changed."); - SelectedBrushStop.UndoLABChanges(); + SelectedBrushStop.UndoColorChanges(); } return false; } return true; } + public async Task<bool> NotifyAboutTrialsDataColorsSpace() + { + var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); + if (testColor != null && testColor.TrialslogList.Count > 0 && + ((testColor.OpenedFromCatalog && SelectedColorTab != ColorTab.Catalog) + || (testColor.OpenedFromCMYK && SelectedColorTab != ColorTab.Volume) + || (testColor.OpenedFromCatalog == false && testColor.OpenedFromCMYK == false && SelectedColorTab != ColorTab.CIELab))) + { + if (true == await NotificationProvider.ShowQuestion("The color correction is in progress, the trials data will be reset. Are you sure?")) + { + TrialsLogEngine.Default.Delete(testColor); + return true; + } + else + { + await NotificationProvider.ShowInfo("The color will not be changed."); + return false; + } + + } + return true; + } + #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 89f6bf2d7..b967ddec2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -81,13 +81,16 @@ <Setter Property="TextElement.Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> <Setter Property="BorderBrush" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> </DataTrigger> - <MultiDataTrigger> + <!--<MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ApplicationManager.IsInTechnicianMode}" Value="true"/> <Condition Binding="{Binding IsJobRunning}" Value="False"/> </MultiDataTrigger.Conditions> <Setter Property="Visibility" Value="Visible"/> - </MultiDataTrigger> + </MultiDataTrigger>--> + <DataTrigger Binding="{Binding IsJobRunning}" Value="False"> + <Setter Property="Visibility" Value="Visible"/> + </DataTrigger> </Style.Triggers> </Style> </touch:TouchButton.Style> @@ -231,9 +234,19 @@ <touch:TouchNavigationLinks Grid.Row="1" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 3" x:Name="navigationCSTLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" HorizontalContentAlignment="Center" SelectedIndex="{Binding SelectedTabIndex,Mode=TwoWay}" VerticalAlignment="Bottom" Margin="0,0,0,30" Padding="40 0 40 0" - FontSize="{StaticResource TangoNavigationLinksFontSize}" Grid.RowSpan="2" > + FontSize="{StaticResource TangoNavigationLinksFontSize}" Grid.RowSpan="2" PreviewMouseDown="NavigationCSTLinks_PreviewMouseDown" PreviewTouchDown="NavigationCSTLinks_PreviewTouchDown" > - <TextBlock HorizontalAlignment="Center" >Automatic</TextBlock> + <TextBlock HorizontalAlignment="Center" IsEnabled="{Binding IsOnlyManual, Converter={StaticResource BooleanInverseConverter}}" Text="Automatic"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> <TextBlock HorizontalAlignment="Center" >Manual</TextBlock> <touch:TouchNavigationLinks.Style> <Style TargetType="{x:Type touch:TouchNavigationLinks}"> @@ -244,6 +257,7 @@ </ItemsPanelTemplate> </Setter.Value> </Setter> + </Style> </touch:TouchNavigationLinks.Style> @@ -333,7 +347,7 @@ <TextBlock Text="H" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="7 0 0 0"/> </StackPanel> <TextBlock IsHitTestVisible="False" Text="{Binding DH, StringFormat=0.00, Converter={StaticResource DoubleNullConverter}}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 20 0 0"/> - <TextBlock Text="{Binding DH, Converter={StaticResource DeltaLCHToTextConverter}, ConverterParameter=H}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center" Margin="0 20 0 0"/> + <TextBlock Text="{Binding MeasuredH, Converter={StaticResource DeltaLCHToTextConverter}, ConverterParameter=H}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center" Margin="0 20 0 0"/> </StackPanel> </UniformGrid> @@ -362,8 +376,8 @@ </Style.Triggers> </Style> </StackPanel.Style> - <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" >Enter Measurement Result ( Optional):</TextBlock> - <UniformGrid Rows="1" Columns="3" Height="Auto" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Left" Margin="0 20 0 0"> + <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" >Enter Measurement Result (Optional):</TextBlock> + <UniformGrid Rows="1" Columns="3" Height="Auto" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Left" Margin="0 20 0 0" IsEnabled="{Binding IsOnlyManual, Converter={StaticResource BooleanInverseConverter}}"> <StackPanel Orientation="Vertical" VerticalAlignment="Center"> <TextBlock Text="L" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Bold" VerticalAlignment="Center" Margin="10 0 0 0"/> <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="100" Minimum="0" Value="{Binding MeasuredL, Delay=1000, Converter={StaticResource DoubleNullConverter}, ConverterParameter=1}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> @@ -426,7 +440,7 @@ <TextBlock Text="H" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="7 0 0 0"/> </StackPanel> <TextBlock IsHitTestVisible="False" Text="{Binding DH, StringFormat=0.00, Converter={StaticResource DoubleNullConverter}}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 20 0 0"/> - <TextBlock Text="{Binding DH, Converter={StaticResource DeltaLCHToTextConverter}, ConverterParameter=H}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center" Margin="0 20 0 0"/> + <TextBlock Text="{Binding MeasuredH, Converter={StaticResource DeltaLCHToTextConverter}, ConverterParameter=H}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center" Margin="0 20 0 0"/> </StackPanel> </UniformGrid> @@ -511,7 +525,7 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" Grid.ColumnSpan="2" VerticalAlignment="Center">Adjustment Preview:</TextBlock> - <StackPanel Orientation="Vertical" Grid.ColumnSpan="3" Grid.Row="1" Margin="0 10 0 0"> + <StackPanel Orientation="Vertical" Grid.ColumnSpan="2" Grid.Row="1" Margin="0 10 0 0"> <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" >Result</TextBlock> <Border Grid.Row="1" Height="220" Margin="0 10 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0" Background="{Binding VisualCorrectionModel.SourceColorBrush}" CornerRadius="12" > <UniformGrid Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> @@ -530,10 +544,10 @@ </UniformGrid> </Border> </StackPanel> - <StackPanel Orientation="Vertical" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Margin="0 10 0 0"> + <StackPanel Orientation="Vertical" Grid.Column="1" Grid.ColumnSpan="1" Grid.Row="1" Margin="0 10 0 0"> <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Correction</TextBlock> - <Border Grid.Row="1" Height="220" Margin="0 10 0 0" CornerRadius="12" BorderThickness="0" BorderBrush="{StaticResource TangoGrayBrush}" Background="{Binding VisualCorrectionModel.ManualColorBrush}" > + <Border Grid.Row="1" Height="220" Margin="0 10 0 0" CornerRadius="0 0 0 0" BorderThickness="0" BorderBrush="{StaticResource TangoGrayBrush}" Background="{Binding VisualCorrectionModel.ManualColorBrush}" > <UniformGrid Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> <TextBlock FontWeight="Medium" Margin="10 10 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> <Run Text="L:" ></Run> @@ -550,9 +564,9 @@ </UniformGrid> </Border> </StackPanel> - <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="1" Margin="0 10 0 0"> + <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="1" Margin="0 10 0 0" Visibility="{Binding IsTargetVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"> <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Target</TextBlock> - <Border Grid.Row ="1" Height="220" Margin="0 10 0 0" Background="{Binding ColorBrush}" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0" CornerRadius="12"></Border> + <Border Grid.Row ="1" Height="220" Margin="0 10 0 0" Background="{Binding ColorBrush}" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0" CornerRadius="0 12 12 0"></Border> </StackPanel> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs index 01c4a2193..b0252be6f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs @@ -32,7 +32,23 @@ namespace Tango.PPC.Jobs.Dialogs private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) { + } + private void NavigationCSTLinks_PreviewMouseDown(object sender, MouseButtonEventArgs e) + { + if (_vm != null && _vm.IsOnlyManual) + { + e.Handled = true; + } + } + + private void NavigationCSTLinks_PreviewTouchDown(object sender, TouchEventArgs e) + { + if (_vm != null && _vm.IsOnlyManual) + { + e.Handled = true; + } } + } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index 5d3ab5504..e473fa420 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -93,6 +93,7 @@ namespace Tango.PPC.Jobs.Dialogs public IPPCApplicationManager ApplicationManager { get; set; } public BrushStopModel BrushStopModel { get; set; } + public ColorSpaces OpenFromColorSpace { get; set; } private bool _isOutOfGamut; /// <summary> @@ -270,7 +271,7 @@ namespace Tango.PPC.Jobs.Dialogs } } } - + protected Double? _dL; /// <summary> @@ -291,6 +292,38 @@ namespace Tango.PPC.Jobs.Dialogs } } + /// <summary> + /// Gets the measured h for show text in deltaH. + /// </summary> + public double? MeasuredH + { + get { + if(IsValidLAB()) + { + var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; + LabColor labColor = new LabColor((double)MeasuredL, (double)MeasuredA, (double)MeasuredB); + var LCH_input = converter.ToLChab(labColor); + return LCH_input.h; + } + return null; + } + } + + private bool _IsTargetVisible; + + public bool IsTargetVisible + { + get { return _IsTargetVisible; } + set { + if (_IsTargetVisible != value) + { + _IsTargetVisible = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double? _dC; /// <summary> /// Gets or sets the delta C @@ -325,6 +358,7 @@ namespace Tango.PPC.Jobs.Dialogs if (ActiveLogModel != null) ActiveLogModel.dH = _dH == null ? 0 : (double)_dH; RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(MeasuredH)); } } } @@ -592,6 +626,20 @@ namespace Tango.PPC.Jobs.Dialogs } } + private bool _isOnlyManual; + /// <summary> + /// Gets or sets a value indicating whether this instance is only manual. Opened from CMYK tab. + /// </summary> + public bool IsOnlyManual + { + get { return _isOnlyManual; } + set { + _isOnlyManual = value; + RaisePropertyChangedAuto(); + } + } + + private int _selectedTabIndex; /// <summary> /// Gets or sets the index of the selected category. @@ -701,20 +749,21 @@ namespace Tango.PPC.Jobs.Dialogs PressedCommand = new RelayCommand((x) => { }); ; IsExpanderOpened = true; + IsTargetVisible = false; TangoIOC.Default.Inject(this); _CorrectOnlyHue = true; IsManualFineTuning = false; + IsOnlyManual = false; VisualCorrectionModel = new VisualOffsetModel(); } /// <summary> /// Initializes at open the dialog. /// </summary> - public void Init(BrushStopModel brushstop, double l, double a, double b)//, System.Windows.Media.Color targetColor) + public void Init(BrushStopModel brushstop, ColorSpaces colorspace)// double l, double a, double b)//, System.Windows.Media.Color targetColor) { - SelectedTabIndex = 0; CorrectOnlyHue = false; LightnessOffset = 0.0; @@ -725,8 +774,7 @@ namespace Tango.PPC.Jobs.Dialogs DL = null; DH = null; DeltaE = null; - - _sessionID = brushstop.Guid + $"{l}{a}{b}"; + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; @@ -736,14 +784,45 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel = brushstop.Clone(); BrushStopModel.Guid = brushstop.Guid; IsOutOfGamut = brushstop.IsOutOfGamut; - TargetL = l; - TargetB = b; - TargetA = a; + OpenFromColorSpace = colorspace; + if (OpenFromColorSpace == ColorSpaces.Catalog && brushstop.ColorCatalogsItem != null) + { - //TargetColor = targetColor; + TargetL = BrushStopModel.ColorCatalogsItem.L; + TargetA = BrushStopModel.ColorCatalogsItem.A; + TargetB = BrushStopModel.ColorCatalogsItem.B; + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.Cyan = brushstop.ColorCatalogsItem.Cyan; + BrushStopModel.Magenta = brushstop.ColorCatalogsItem.Magenta; + BrushStopModel.Yellow = brushstop.ColorCatalogsItem.Yellow; + BrushStopModel.Black = brushstop.ColorCatalogsItem.Black; + BrushStopModel.PreventPropertyUpdate = false; + IsOnlyManual = false; + } + else if(OpenFromColorSpace == ColorSpaces.Volume) + { + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.L = 0; + BrushStopModel.A = 0; + BrushStopModel.B = 0; + BrushStopModel.PreventPropertyUpdate = false; + BrushStopModel.ConvertColorToLAB(); + TargetL = BrushStopModel.L; + TargetB = BrushStopModel.B; + TargetA = BrushStopModel.A; + IsOnlyManual = true; + } + else + { + TargetL = brushstop.L; + TargetB = brushstop.B; + TargetA = brushstop.A; + BrushStopModel.ConvertColorToVolume(); + BrushStopModel.ColorSpace = ColorSpaces.LAB; + IsOnlyManual = false; + } - BrushStopModel.ConvertColorToVolume(); - BrushStopModel.ColorSpace = ColorSpaces.LAB; + _sessionID = BrushStopModel.Guid + $"{TargetL}{TargetA}{TargetB}"; Cyan = BrushStopModel.Cyan; Magenta = BrushStopModel.Magenta; @@ -815,6 +894,10 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(IsDisableInputLAB)); RaisePropertyChanged(nameof(TrialNumber)); RaisePropertyChanged(nameof(ColorBrush)); + if(IsOnlyManual) + SelectedTabIndex = 1; + else + SelectedTabIndex = 0; } public void InitManualCorrection() @@ -998,6 +1081,7 @@ namespace Tango.PPC.Jobs.Dialogs _measuredL = null; _measuredB = null; _measuredA = null; + IsTargetVisible = false; RaisePropertyChanged(nameof(MeasuredL)); RaisePropertyChanged(nameof(MeasuredA)); RaisePropertyChanged(nameof(MeasuredB)); @@ -1096,6 +1180,8 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.L = TargetL; TestColor.A = TargetA; TestColor.B = TargetB; + TestColor.OpenedFromCatalog = OpenFromColorSpace == ColorSpaces.Catalog; + TestColor.OpenedFromCMYK = OpenFromColorSpace == ColorSpaces.Volume; TestColor.BrushStopGuid = BrushStopModel.Guid; TestColor.TrialslogList.Clear(); TestColor.TrialslogList.AddRange(TrialsLogitems); @@ -1116,6 +1202,8 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.L = TargetL; TestColor.A = TargetA; TestColor.B = TargetB; + TestColor.OpenedFromCatalog = OpenFromColorSpace == ColorSpaces.Catalog; + TestColor.OpenedFromCMYK = OpenFromColorSpace == ColorSpaces.Volume; TestColor.TrialslogList.AddRange(TrialsLogitems); TrialsLogEngine.Default.AddTest(TestColor); //if (ActiveLogModel != null && !ActiveLogModel.IsTested @@ -1147,7 +1235,8 @@ namespace Tango.PPC.Jobs.Dialogs public void ClearFoNextTrial() { - SelectedTabIndex = 0; + if(IsOnlyManual) + SelectedTabIndex = 1; CorrectOnlyHue = false; _measuredL = null; @@ -1156,6 +1245,7 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(MeasuredL)); RaisePropertyChanged(nameof(MeasuredA)); RaisePropertyChanged(nameof(MeasuredB)); + IsTargetVisible = false; if (ActiveLogModel != null) { VisualCorrectionModel.ClearAll(ActiveLogModel.SuggestionL, ActiveLogModel.SuggestionA, ActiveLogModel.SuggestionB); @@ -1195,7 +1285,8 @@ namespace Tango.PPC.Jobs.Dialogs double dL, dC, dH; //DeltaE = DeltaE_CMC(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, out dL, out dC, out dH); - DeltaE = DeltaE_CMC( (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, TargetL, TargetA, TargetB, out dL, out dC, out dH); + //DeltaE = DeltaE_CMC( (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, TargetL, TargetA, TargetB, out dL, out dC, out dH); + DeltaE = DeltaE_CMC( TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, out dL, out dC, out dH); DL = dL; DC = (Double?)dC; @@ -1206,11 +1297,13 @@ namespace Tango.PPC.Jobs.Dialogs OnLightnessOffsetChanged(); OnChromaOffsetChanged(); OnHueOffsetChanged(); + IsTargetVisible = true; // ValidationTests(); } else if(DeltaE != null) { DL = DC = DH = DeltaE = null; + IsTargetVisible = false; } TestCommand.RaiseCanExecuteChanged(); ByPassTestCommand.RaiseCanExecuteChanged(); @@ -1275,12 +1368,16 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.PreventPropertyUpdate = false; //calculate CMYK - BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); - if (BrushStopModel.IsOutOfGamut) + if (OpenFromColorSpace == ColorSpaces.LAB || ((MeasuredL != null && MeasuredA != null && MeasuredB != null) + || IsManualFineTuning && (LightnessOffset != 0.0 || ChromaOffset != 0.0 || HueOffset != 0.0))) { - ActiveLogModel.NewSuggestionL = BrushStopModel.L; - ActiveLogModel.NewSuggestionA = BrushStopModel.A; - ActiveLogModel.NewSuggestionB = BrushStopModel.B; + BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); + if (BrushStopModel.IsOutOfGamut) + { + ActiveLogModel.NewSuggestionL = BrushStopModel.L; + ActiveLogModel.NewSuggestionA = BrushStopModel.A; + ActiveLogModel.NewSuggestionB = BrushStopModel.B; + } } BrushStopModel.ColorSpace = ColorSpaces.LAB; @@ -1309,17 +1406,20 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.A = ActiveLogModel.NewSuggestionA; BrushStopModel.B = ActiveLogModel.NewSuggestionB; BrushStopModel.PreventPropertyUpdate = false; - + //calculate CMYK - BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); - if(BrushStopModel.IsOutOfGamut) + if ( OpenFromColorSpace == ColorSpaces.LAB || ((MeasuredL != null && MeasuredA != null && MeasuredB != null) + || IsManualFineTuning && (LightnessOffset != 0.0 || ChromaOffset != 0.0 || HueOffset != 0.0))) { - ActiveLogModel.NewSuggestionL = BrushStopModel.L; - ActiveLogModel.NewSuggestionA = BrushStopModel.A; - ActiveLogModel.NewSuggestionB = BrushStopModel.B; + BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); + if (BrushStopModel.IsOutOfGamut) + { + ActiveLogModel.NewSuggestionL = BrushStopModel.L; + ActiveLogModel.NewSuggestionA = BrushStopModel.A; + ActiveLogModel.NewSuggestionB = BrushStopModel.B; + } + BrushStopModel.ColorSpace = ColorSpaces.LAB; } - - BrushStopModel.ColorSpace = ColorSpaces.LAB; var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -1539,11 +1639,7 @@ namespace Tango.PPC.Jobs.Dialogs Magenta = BrushStopModel.Magenta; Yellow = BrushStopModel.Yellow; Black = BrushStopModel.Black; - //ActiveLogModel.TestC = BrushStopModel.Cyan; - //ActiveLogModel.TestM = BrushStopModel.Magenta; - //ActiveLogModel.TestY = BrushStopModel.Yellow; - //ActiveLogModel.TestK = BrushStopModel.Black; - // SaveTest(GetExcelDataItems(ActiveLogModel, false)); + if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { var suggestionL = ActiveLogModel.NewSuggestionL; @@ -1613,16 +1709,16 @@ namespace Tango.PPC.Jobs.Dialogs double dECMC = Math.Sqrt(Math.Pow(deltaL / (2 * SL), 2) + Math.Pow(deltaC / SC, 2) + Math.Pow(deltaH / SH, 2)); - dL = (deltaL / (2 * SL)); - dC = (deltaC / SC); + dL = (deltaL / (2 * SL)) *(-1); + dC = (deltaC / SC)*(-1); - LabColor labColor = new LabColor(L1, a1, b1); - LabColor trget_labColor = new LabColor(L2, a2, b2); + LabColor target_labColor = new LabColor(L1, a1, b1); + LabColor labColor = new LabColor(L2, a2, b2); var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; var LCH_input = converter.ToLChab(labColor); - var LCH_target = converter.ToLChab(trget_labColor); + var LCH_target = converter.ToLChab(target_labColor); if(LCH_target.h > LCH_input.h) - dH = (deltaH / SH) * (-1); + dH = (deltaH / SH) * (-1); else dH = (deltaH / SH); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index d65c4e9e1..d415dbb79 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -733,12 +733,23 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public ColorSpaces LastChangedColorSpace { get; set; } + //Fine Tuning [JsonIgnore] public Double LBeforeChange { get; set; } [JsonIgnore] public Double ABeforeChange { get; set; } [JsonIgnore] public Double BBeforeChange { get; set; } + [JsonIgnore] + public Double CyanBeforeChange { get; set; } + [JsonIgnore] + public Double MagentaBeforeChange { get; set; } + [JsonIgnore] + public Double YellowBeforeChange { get; set; } + [JsonIgnore] + public Double BlackBeforeChange { get; set; } + + public bool FineTuningChanged { get; set; } #endregion @@ -1078,21 +1089,46 @@ namespace Tango.PPC.Jobs.Models return s; } - public void UndoLABChanges() + //Fine Tuning + public void UndoColorChanges() { - PreventPropertyUpdate = true; - L = LBeforeChange; - A = ABeforeChange; - PreventPropertyUpdate = false; - B = BBeforeChange; + if(ColorSpace == ColorSpaces.LAB) + { + PreventPropertyUpdate = true; + L = LBeforeChange; + A = ABeforeChange; + PreventPropertyUpdate = false; + B = BBeforeChange; + } + else if(ColorSpace == ColorSpaces.Volume) + { + PreventPropertyUpdate = true; + Cyan = CyanBeforeChange; + Magenta = MagentaBeforeChange; + Yellow = YellowBeforeChange; + PreventPropertyUpdate = false; + Black = BlackBeforeChange; + } } - public void SaveLABBeforeChanges() + //Fine Tuning + public void SaveColorBeforeChanges() { - LBeforeChange = L; - ABeforeChange = A; - BBeforeChange = B; + if (ColorSpace == ColorSpaces.LAB) + { + LBeforeChange = L; + ABeforeChange = A; + BBeforeChange = B; + } + else if (ColorSpace == ColorSpaces.Volume) + { + CyanBeforeChange = Cyan; + MagentaBeforeChange = Magenta; + YellowBeforeChange = Yellow; + BlackBeforeChange = Black; + } } + #endregion #region changes diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs index a83e0e595..d6ea11b81 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs @@ -21,9 +21,14 @@ namespace Tango.PPC.Jobs.Models public double A { get; set; } public double B { get; set; } + public bool OpenedFromCMYK { get; set; } + public bool OpenedFromCatalog { get; set; } + public TestColor() { TrialslogList = new List<TrialsLogModel>(); + OpenedFromCMYK = false; + OpenedFromCatalog = false; } } |
