Added Designer plugin

This commit is contained in:
Michael Becker 2014-06-02 14:04:44 -04:00
parent ec5509f522
commit 7e9a131be1
13 changed files with 432 additions and 0 deletions

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniversalEditor.ObjectModels.Markup;
using UniversalEditor.DataFormats.Markup.XML;
namespace UniversalEditor.DataFormats.Designer
{
public class DesignerXMLDataFormat : XMLDataFormat
{
protected override void BeforeLoadInternal(Stack<ObjectModel> objectModels)
{
base.BeforeLoadInternal(objectModels);
objectModels.Push(new MarkupObjectModel());
}
protected override void AfterLoadInternal(Stack<ObjectModel> objectModels)
{
base.AfterLoadInternal(objectModels);
MarkupObjectModel mom = (objectModels.Pop() as MarkupObjectModel);
DesignerObjectModel dsn = (objectModels.Pop() as DesignerObjectModel);
}
protected override void BeforeSaveInternal(Stack<ObjectModel> objectModels)
{
base.BeforeSaveInternal(objectModels);
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class Component
{
public class ComponentCollection
: System.Collections.ObjectModel.Collection<Component>
{
}
private Guid mvarID = Guid.Empty;
public Guid ID { get { return mvarID; } set { mvarID = value; } }
private string mvarTitle = String.Empty;
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
private Property.PropertyCollection mvarProperties = new Property.PropertyCollection();
public Property.PropertyCollection Properties { get { return mvarProperties; } }
}
}

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class ComponentInstance
{
public class ComponentInstanceCollection
: System.Collections.ObjectModel.Collection<ComponentInstance>
{
}
private Guid mvarID = Guid.Empty;
public Guid ID { get { return mvarID; } set { mvarID = value; } }
private Component mvarComponent = null;
public Component Component { get { return mvarComponent; } set { mvarComponent = value; } }
private ConnectionValue.ConnectionValueCollection mvarConnectionValues = new ConnectionValue.ConnectionValueCollection();
public ConnectionValue.ConnectionValueCollection ConnectionValues { get { return mvarConnectionValues; } }
private PropertyValue.PropertyValueCollection mvarPropertyValues = new PropertyValue.PropertyValueCollection();
public PropertyValue.PropertyValueCollection PropertyValues { get { return mvarPropertyValues; } }
private Measurement mvarX = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The distance between the left edge of the design and the left edge of the component.
/// </summary>
public Measurement X { get { return mvarX; } set { mvarX = value; } }
private Measurement mvarY = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The distance between the top edge of the design and the top edge of the component.
/// </summary>
public Measurement Y { get { return mvarY; } set { mvarY = value; } }
private Measurement mvarZ = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The distance between the left edge of the design and the left edge of the component.
/// </summary>
public Measurement Z { get { return mvarZ; } set { mvarZ = value; } }
private Measurement mvarWidth = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The width of the component.
/// </summary>
public Measurement Width { get { return mvarWidth; } set { mvarWidth = value; } }
private Measurement mvarHeight = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The height of the component.
/// </summary>
public Measurement Height { get { return mvarHeight; } set { mvarHeight = value; } }
private Measurement mvarDepth = new Measurement(0, MeasurementUnit.Pixel);
/// <summary>
/// The depth of the component.
/// </summary>
public Measurement Depth { get { return mvarDepth; } set { mvarDepth = value; } }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class Connection
{
public class ConnectionCollection
: System.Collections.ObjectModel.Collection<Connection>
{
}
private Guid mvarID = Guid.Empty;
public Guid ID { get { return mvarID; } set { mvarID = value; } }
private string mvarTitle = String.Empty;
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class ConnectionValue
{
public class ConnectionValueCollection
: System.Collections.ObjectModel.Collection<ConnectionValue>
{
}
private Connection mvarSourceConnection = null;
public Connection SourceConnection { get { return mvarSourceConnection; } set { mvarSourceConnection = value; } }
private Connection mvarDestinationConnection = null;
public Connection DestinationConnection { get { return mvarDestinationConnection; } set { mvarDestinationConnection = value; } }
public ConnectionValue(Connection source, Connection destination)
{
mvarSourceConnection = source;
mvarDestinationConnection = destination;
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class Design
{
public class DesignCollection
: System.Collections.ObjectModel.Collection<Design>
{
}
private ComponentInstance.ComponentInstanceCollection mvarComponentInstances = new ComponentInstance.ComponentInstanceCollection();
public ComponentInstance.ComponentInstanceCollection ComponentInstances { get { return mvarComponentInstances; } }
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class DesignerObjectModel : ObjectModel
{
public override void Clear()
{
throw new NotImplementedException();
}
public override void CopyTo(ObjectModel where)
{
throw new NotImplementedException();
}
private static ObjectModelReference _omr = null;
public override ObjectModelReference MakeReference()
{
if (_omr == null)
{
_omr = base.MakeReference();
_omr.Title = "Designer";
}
return _omr;
}
private Design.DesignCollection mvarDesigns = new Design.DesignCollection();
public Design.DesignCollection Designs { get { return mvarDesigns; } }
private Library.LibraryCollection mvarLibraries = new Library.LibraryCollection();
public Library.LibraryCollection Libraries { get { return mvarLibraries; } }
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class Library
{
public class LibraryCollection
: System.Collections.ObjectModel.Collection<Library>
{
}
private Guid mvarID = Guid.Empty;
public Guid ID { get { return mvarID; } set { mvarID = value; } }
private string mvarTitle = String.Empty;
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
private Component.ComponentCollection mvarComponents = new Component.ComponentCollection();
public Component.ComponentCollection Components { get { return mvarComponents; } set { mvarComponents = value; } }
}
}

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public enum MeasurementUnit
{
Percentage,
Pixel,
Unknown
}
public struct Measurement
{
private MeasurementUnit mvarUnit;
public MeasurementUnit Unit { get { return mvarUnit; } }
private double mvarValue;
public double Value { get { return mvarValue; } set { mvarValue = value; } }
private bool mvarIsNotEmpty;
public bool IsEmpty { get { return !mvarIsNotEmpty; } }
public Measurement(string value)
{
if (value.EndsWith("px"))
{
string v = value.Substring(0, value.Length - 2);
mvarValue = double.Parse(v);
mvarUnit = MeasurementUnit.Pixel;
}
else if (value.EndsWith("%"))
{
string v = value.Substring(0, value.Length - 1);
mvarValue = double.Parse(v);
mvarUnit = MeasurementUnit.Percentage;
}
throw new FormatException("The string could not be parsed as a valid Measurement.");
}
public Measurement(double value)
{
mvarIsNotEmpty = true;
mvarValue = value;
mvarUnit = MeasurementUnit.Pixel;
}
public Measurement(double value, MeasurementUnit unit)
{
mvarIsNotEmpty = true;
mvarValue = value;
mvarUnit = unit;
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class Property
{
public class PropertyCollection
: System.Collections.ObjectModel.Collection<Property>
{
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.ObjectModels.Designer
{
public class PropertyValue
{
public class PropertyValueCollection
: System.Collections.ObjectModel.Collection<PropertyValue>
{
}
private Property mvarProperty = null;
public Property Property { get { return mvarProperty; } set { mvarProperty = value; } }
private bool mvarIsSet = false;
public bool IsSet { get { return mvarIsSet; } set { mvarIsSet = value; } }
private object mvarValue = null;
public object Value { get { return mvarValue; } set { mvarValue = value; } }
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UniversalEditor.Plugins.Designer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("City of Orlando")]
[assembly: AssemblyProduct("UniversalEditor.Plugins.Designer")]
[assembly: AssemblyCopyright("Copyright © City of Orlando 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e641ae35-1fc1-49e5-a7d2-f489d903a8a8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{899E3DD6-EA65-4168-AAE3-867A4F9650A6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UniversalEditor</RootNamespace>
<AssemblyName>UniversalEditor.Plugins.Designer</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>