- Started Windows, Metro and Linux Platform-Plugins - Moved the RecordingSample to the Samples folder - Started two samples for using the graphics device in a WinForms and Wpf Editor - Refactorings in the AddIn-System - Moved the Window initialization-code to the Platform modules - Changed the License text in all code files which is now way smaller - Started ProjectConverter tool which converts all the projects and solution to the target configuration - Changed the SupportedPlatform names in the Resource files - Changed the WIN8 define to WINDOWSMETRO which is actually meant - Removed NLog and started our own Logger class - Many more stuff...
80 lines
3.3 KiB
C#
80 lines
3.3 KiB
C#
#region Using Statements
|
|
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
#if !WINDOWSMETRO
|
|
using System.ComponentModel.Design.Serialization;
|
|
#endif
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using System.Reflection;
|
|
|
|
#endregion // Using Statements
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANX.Framework.Design
|
|
{
|
|
#if !WINDOWSMETRO //TODO: search replacement for Win8
|
|
|
|
public class MatrixConverter : MathTypeConverter
|
|
{
|
|
public MatrixConverter()
|
|
{
|
|
base.propertyDescriptions = MathTypeConverter.CreateFieldDescriptor<Matrix>(
|
|
"M11", "M12", "M13", "M14",
|
|
"M21", "M22", "M23", "M24",
|
|
"M31", "M32", "M33", "M34",
|
|
"M41", "M42", "M43", "M44");
|
|
supportStringConvert = false;
|
|
}
|
|
|
|
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
|
{
|
|
if (destinationType == null)
|
|
{
|
|
throw new ArgumentNullException("destinationType");
|
|
}
|
|
if (value is Matrix)
|
|
{
|
|
Matrix instance = (Matrix)value;
|
|
|
|
if (destinationType == typeof(InstanceDescriptor))
|
|
{
|
|
var constructor = typeof(Matrix).GetConstructor(new Type[] {
|
|
typeof(float), typeof(float), typeof(float), typeof(float),
|
|
typeof(float), typeof(float), typeof(float), typeof(float),
|
|
typeof(float), typeof(float), typeof(float), typeof(float),
|
|
typeof(float), typeof(float), typeof(float), typeof(float)
|
|
});
|
|
return new InstanceDescriptor(constructor, new object[] {
|
|
instance.M11, instance.M12, instance.M13, instance.M14,
|
|
instance.M21, instance.M22, instance.M23, instance.M24,
|
|
instance.M31, instance.M32, instance.M33, instance.M34,
|
|
instance.M41, instance.M42, instance.M43, instance.M44
|
|
});
|
|
}
|
|
}
|
|
|
|
return base.ConvertTo(context, culture, value, destinationType);
|
|
}
|
|
|
|
public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
|
|
{
|
|
if (propertyValues == null)
|
|
{
|
|
throw new ArgumentNullException("propertyValues");
|
|
}
|
|
return new Matrix(
|
|
(float)propertyValues["M11"], (float)propertyValues["M12"], (float)propertyValues["M13"], (float)propertyValues["M14"],
|
|
(float)propertyValues["M21"], (float)propertyValues["M22"], (float)propertyValues["M23"], (float)propertyValues["M24"],
|
|
(float)propertyValues["M31"], (float)propertyValues["M32"], (float)propertyValues["M33"], (float)propertyValues["M34"],
|
|
(float)propertyValues["M41"], (float)propertyValues["M42"], (float)propertyValues["M43"], (float)propertyValues["M44"]);
|
|
}
|
|
}
|
|
|
|
#endif
|
|
}
|