Index: Core/Common/src/Core.Common.Gui/Converters/ColorTypeConverter.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/Converters/ColorTypeConverter.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/Converters/ColorTypeConverter.cs (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -0,0 +1,37 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using System.Drawing; + +namespace Core.Common.Gui.Converters +{ + /// + /// A type converter to convert color objects to and from various other representations. + /// + public class ColorTypeConverter : ColorConverter + { + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return false; + } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -ra70cb733eb761229173777b9f6cd1b977830b24b -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision a70cb733eb761229173777b9f6cd1b977830b24b) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -121,6 +121,7 @@ + @@ -232,6 +233,7 @@ + Index: Core/Common/src/Core.Common.Gui/UITypeEditors/ColorEditor.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/UITypeEditors/ColorEditor.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/UITypeEditors/ColorEditor.cs (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -0,0 +1,82 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Design; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace Core.Common.Gui.UITypeEditors +{ + /// + /// This class defines dialog from which the user can select a color. + /// + public class ColorEditor : UITypeEditor + { + public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) + { + return UITypeEditorEditStyle.Modal; + } + + public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) + { + var service = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); + + if (service != null) + { + var color = (Color) value; + + var colorDialog = new ColorDialog + { + Color = color, + AllowFullOpen = true, + FullOpen = true + }; + + if (colorDialog.ShowDialog() == DialogResult.OK) + { + value = colorDialog.Color; + } + } + + return value; + } + + public override bool GetPaintValueSupported(ITypeDescriptorContext context) + { + return true; + } + + public override void PaintValue(PaintValueEventArgs e) + { + var color = (Color) e.Value; + + using (var brush = new SolidBrush(color)) + { + e.Graphics.FillRectangle(brush, e.Bounds); + } + + e.Graphics.DrawRectangle(Pens.Black, e.Bounds); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Converters/ColorTypeConverterTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/Converters/ColorTypeConverterTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/Converters/ColorTypeConverterTest.cs (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using System.Drawing; +using Core.Common.Gui.Converters; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Common.Gui.Test.Converters +{ + [TestFixture] + public class ColorTypeConverterTest + { + [Test] + public void Constructor_ExpectedProperties() + { + // Call + var converter = new ColorTypeConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + public void GetStandardValuesSupported_Always_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var context = mocks.Stub(); + mocks.ReplayAll(); + + var converter = new ColorTypeConverter(); + + // Call + bool standardValuesSupported = converter.GetStandardValuesSupported(context); + + // Assert + Assert.IsFalse(standardValuesSupported); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj =================================================================== diff -u -ra70cb733eb761229173777b9f6cd1b977830b24b -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision a70cb733eb761229173777b9f6cd1b977830b24b) +++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -96,6 +96,7 @@ + @@ -140,6 +141,7 @@ + Index: Core/Common/test/Core.Common.Gui.Test/UITypeEditors/ColorEditorTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Gui.Test/UITypeEditors/ColorEditorTest.cs (revision 0) +++ Core/Common/test/Core.Common.Gui.Test/UITypeEditors/ColorEditorTest.cs (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Design; +using Core.Common.Gui.UITypeEditors; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Common.Gui.Test.UITypeEditors +{ + [TestFixture] + public class ColorEditorTest + { + [Test] + public void DefaultConstructor_ReturnsNewInstance() + { + // Call + var editor = new ColorEditor(); + + // Assert + Assert.IsInstanceOf(editor); + } + + [Test] + public void GetEditStyle_Always_ReturnUITypeEditorEditStyleModal() + { + // Setup + var mocks = new MockRepository(); + var context = mocks.Stub(); + mocks.ReplayAll(); + + var editor = new ColorEditor(); + + // Call + UITypeEditorEditStyle editStyle = editor.GetEditStyle(context); + + // Assert + Assert.AreEqual(UITypeEditorEditStyle.Modal, editStyle); + mocks.VerifyAll(); + } + + [Test] + public void EditValue_WithoutService_ReturnEqualValue() + { + var mocks = new MockRepository(); + var context = mocks.Stub(); + var provider = mocks.Stub(); + mocks.ReplayAll(); + + var editor = new ColorEditor(); + Color color = Color.Beige; + + // Call + object value = editor.EditValue(context, provider, color); + + // Assert + Assert.AreEqual(color, value); + mocks.VerifyAll(); + } + + [Test] + public void GetPaintValueSupported_Always_ReturnTrue() + { + // Setup + var editor = new ColorEditor(); + + // Call + bool paintValueSupported = editor.GetPaintValueSupported(); + + // Assert + Assert.IsTrue(paintValueSupported); + } + } +} Fisheye: Tag b2cfd1d6f0d22011df44df97e970c9aa74e6ca58 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.Map/Converters/MapColorConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj =================================================================== diff -u -r899cae178642faba04c628db05a792b657b6d979 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj (.../Core.Plugins.Map.csproj) (revision 899cae178642faba04c628db05a792b657b6d979) +++ Core/Plugins/src/Core.Plugins.Map/Core.Plugins.Map.csproj (.../Core.Plugins.Map.csproj) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -68,9 +68,7 @@ True Resources.resx - - Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs =================================================================== diff -u -refe5cc540b802c2307b33eadaa7912e38b9d68a3 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs (.../MapLineDataProperties.cs) (revision efe5cc540b802c2307b33eadaa7912e38b9d68a3) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapLineDataProperties.cs (.../MapLineDataProperties.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -24,6 +24,8 @@ using System.Drawing.Design; using System.Drawing.Drawing2D; using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.UITypeEditors; using Core.Common.Utils.Attributes; using Core.Components.Gis.Data; using Core.Plugins.Map.Converters; @@ -42,7 +44,7 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_Color_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.MapLineData_Color_Description))] [Editor(typeof(ColorEditor), typeof(UITypeEditor))] - [TypeConverter(typeof(MapColorConverter))] + [TypeConverter(typeof(ColorTypeConverter))] public Color Color { get Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs =================================================================== diff -u -refe5cc540b802c2307b33eadaa7912e38b9d68a3 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision efe5cc540b802c2307b33eadaa7912e38b9d68a3) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPointDataProperties.cs (.../MapPointDataProperties.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -23,6 +23,8 @@ using System.Drawing; using System.Drawing.Design; using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.UITypeEditors; using Core.Common.Utils; using Core.Common.Utils.Attributes; using Core.Components.Gis.Data; @@ -43,7 +45,7 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_Color_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_Color_Description))] [Editor(typeof(ColorEditor), typeof(UITypeEditor))] - [TypeConverter(typeof(MapColorConverter))] + [TypeConverter(typeof(ColorTypeConverter))] public Color Color { get @@ -62,7 +64,7 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_StrokeColor_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.MapPointData_StrokeColor_Description))] [Editor(typeof(ColorEditor), typeof(UITypeEditor))] - [TypeConverter(typeof(MapColorConverter))] + [TypeConverter(typeof(ColorTypeConverter))] public Color StrokeColor { get Index: Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPolygonDataProperties.cs =================================================================== diff -u -refe5cc540b802c2307b33eadaa7912e38b9d68a3 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPolygonDataProperties.cs (.../MapPolygonDataProperties.cs) (revision efe5cc540b802c2307b33eadaa7912e38b9d68a3) +++ Core/Plugins/src/Core.Plugins.Map/PropertyClasses/MapPolygonDataProperties.cs (.../MapPolygonDataProperties.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -23,6 +23,8 @@ using System.Drawing; using System.Drawing.Design; using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.UITypeEditors; using Core.Common.Utils.Attributes; using Core.Components.Gis.Data; using Core.Plugins.Map.Converters; @@ -41,7 +43,7 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_Color_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.MapPolygonData_FillColor_Description))] [Editor(typeof(ColorEditor), typeof(UITypeEditor))] - [TypeConverter(typeof(MapColorConverter))] + [TypeConverter(typeof(ColorTypeConverter))] public Color FillColor { get @@ -60,7 +62,7 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MapData_StrokeColor_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.MapPolygonData_StrokeColor_Description))] [Editor(typeof(ColorEditor), typeof(UITypeEditor))] - [TypeConverter(typeof(MapColorConverter))] + [TypeConverter(typeof(ColorTypeConverter))] public Color StrokeColor { get Fisheye: Tag b2cfd1d6f0d22011df44df97e970c9aa74e6ca58 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.Map/UITypeEditors/ColorEditor.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b2cfd1d6f0d22011df44df97e970c9aa74e6ca58 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.Map.Test/Converters/MapColorConverterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj =================================================================== diff -u -r899cae178642faba04c628db05a792b657b6d979 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision 899cae178642faba04c628db05a792b657b6d979) +++ Core/Plugins/test/Core.Plugins.Map.Test/Core.Plugins.Map.Test.csproj (.../Core.Plugins.Map.Test.csproj) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -84,7 +84,6 @@ - @@ -109,7 +108,6 @@ TestView.cs - Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs =================================================================== diff -u -refe5cc540b802c2307b33eadaa7912e38b9d68a3 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs (.../MapLineDataPropertiesTest.cs) (revision efe5cc540b802c2307b33eadaa7912e38b9d68a3) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapLineDataPropertiesTest.cs (.../MapLineDataPropertiesTest.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -24,6 +24,7 @@ using System.Drawing.Drawing2D; using System.Linq; using Core.Common.Base; +using Core.Common.Gui.Converters; using Core.Common.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Features; @@ -79,7 +80,7 @@ Assert.AreEqual(8, dynamicProperties.Count); PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex]; - Assert.IsInstanceOf(colorProperty.Converter); + Assert.IsInstanceOf(colorProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, "Stijl", "Kleur", Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs =================================================================== diff -u -r9db03162dd78287d02807c92b35d7d967fac9c8a -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (.../MapPointDataPropertiesTest.cs) (revision 9db03162dd78287d02807c92b35d7d967fac9c8a) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPointDataPropertiesTest.cs (.../MapPointDataPropertiesTest.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -23,6 +23,7 @@ using System.Drawing; using System.Linq; using Core.Common.Base; +using Core.Common.Gui.Converters; using Core.Common.TestUtil; using Core.Common.Utils; using Core.Components.Gis.Data; @@ -81,14 +82,14 @@ Assert.AreEqual(10, dynamicProperties.Count); PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex]; - Assert.IsInstanceOf(colorProperty.Converter); + Assert.IsInstanceOf(colorProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, "Stijl", "Kleur", "De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor strokeColorProperty = dynamicProperties[strokeColorPropertyIndex]; - Assert.IsInstanceOf(colorProperty.Converter); + Assert.IsInstanceOf(colorProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty, "Stijl", "Lijnkleur", Index: Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPolygonDataPropertiesTest.cs =================================================================== diff -u -refe5cc540b802c2307b33eadaa7912e38b9d68a3 -rb2cfd1d6f0d22011df44df97e970c9aa74e6ca58 --- Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPolygonDataPropertiesTest.cs (.../MapPolygonDataPropertiesTest.cs) (revision efe5cc540b802c2307b33eadaa7912e38b9d68a3) +++ Core/Plugins/test/Core.Plugins.Map.Test/PropertyClasses/MapPolygonDataPropertiesTest.cs (.../MapPolygonDataPropertiesTest.cs) (revision b2cfd1d6f0d22011df44df97e970c9aa74e6ca58) @@ -23,6 +23,7 @@ using System.Drawing; using System.Linq; using Core.Common.Base; +using Core.Common.Gui.Converters; using Core.Common.TestUtil; using Core.Components.Gis.Data; using Core.Components.Gis.Features; @@ -78,14 +79,14 @@ Assert.AreEqual(8, dynamicProperties.Count); PropertyDescriptor colorProperty = dynamicProperties[fillColorPropertyIndex]; - Assert.IsInstanceOf(colorProperty.Converter); + Assert.IsInstanceOf(colorProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, "Stijl", "Kleur", "De kleur van de vlakken waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor widthProperty = dynamicProperties[strokeColorPropertyIndex]; - Assert.IsInstanceOf(colorProperty.Converter); + Assert.IsInstanceOf(colorProperty.Converter); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(widthProperty, "Stijl", "Lijnkleur", Fisheye: Tag b2cfd1d6f0d22011df44df97e970c9aa74e6ca58 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.Map.Test/UITypeEditors/ColorEditorTest.cs'. Fisheye: No comparison available. Pass `N' to diff?