Split into smaller projects, now uses plugins.

This commit is contained in:
2014-08-12 16:33:13 +03:00
parent 69913fa251
commit b8c8f2a1b0
80 changed files with 1520 additions and 494 deletions

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("RainmeterStudio.SkinDesigner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RainmeterStudio.SkinDesigner")]
[assembly: AssemblyCopyright("Copyright © 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("d4aa7c80-76e6-484d-8766-7cd75f6d9e18")]
// 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,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{E8BD25E9-3055-4688-9E83-ECF684EF30C6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RainmeterStudio.SkinDesignerPlugin</RootNamespace>
<AssemblyName>RainmeterStudio.SkinDesignerPlugin</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\Plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SkinDesigner.cs" />
<Compile Include="SkinDesignerControl.xaml.cs">
<DependentUpon>SkinDesignerControl.xaml</DependentUpon>
</Compile>
<Compile Include="SkinDesignerFactory.cs" />
<Compile Include="SkinDocument.cs" />
<Compile Include="SkinMetadata.cs" />
<Compile Include="SkinStorage.cs" />
<Compile Include="SkinTemplate.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="SkinDesignerControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RainmeterStudio.Core\RainmeterStudio.Core.csproj">
<Project>{1d2a4896-af31-4e82-a84f-4e218067701f}</Project>
<Name>RainmeterStudio.Core</Name>
</ProjectReference>
</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>

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.SkinDesignerPlugin
{
/// <summary>
/// Skin designer document editor
/// </summary>
public class SkinDesigner : IDocumentEditor
{
/// <summary>
/// Gets the document attached to this editor instance
/// </summary>
public SkinDocument AttachedDocument { get; private set; }
/// <summary>
/// Gets the document attached to this editor instance
/// </summary>
IDocument IDocumentEditor.AttachedDocument
{
get { return AttachedDocument; }
}
/// <summary>
/// Gets the UI control to display for this editor
/// </summary>
public SkinDesignerControl EditorUI { get; private set; }
/// <summary>
/// Gets the UI control to display for this editor
/// </summary>
UIElement IDocumentEditor.EditorUI
{
get { return EditorUI; }
}
/// <summary>
/// Initializes this editor
/// </summary>
/// <param name="document">The document</param>
public SkinDesigner(SkinDocument document)
{
AttachedDocument = document;
}
}
}

View File

@ -0,0 +1,13 @@
<Page x:Class="RainmeterStudio.SkinDesignerPlugin.SkinDesignerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="SkinDesignerControl">
<Grid>
</Grid>
</Page>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace RainmeterStudio.SkinDesignerPlugin
{
/// <summary>
/// Interaction logic for SkinDesignerControl.xaml
/// </summary>
public partial class SkinDesignerControl : Page
{
public SkinDesignerControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RainmeterStudio.Core;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.SkinDesignerPlugin
{
/// <summary>
/// Skin designer factory
/// </summary>
[PluginExport]
public class SkinDesignerFactory : IDocumentEditorFactory
{
/// <summary>
/// Creates a new editor object
/// </summary>
/// <param name="document">Document to be edited by the editor</param>
/// <returns>A new document editor</returns>
public IDocumentEditor CreateEditor(IDocument document)
{
return new SkinDesigner(document as SkinDocument);
}
/// <summary>
/// Tests if this editor can edit this document type
/// </summary>
/// <param name="type">Document type</param>
/// <returns>True if the editor can edit the document type</returns>
public bool CanEdit(Type type)
{
return (type == typeof(SkinDocument));
}
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.SkinDesignerPlugin
{
/// <summary>
/// Skin document
/// </summary>
public class SkinDocument : IDocument
{
private Reference _reference;
public Reference Reference
{
get
{
return _reference;
}
set
{
_reference = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Reference"));
}
}
public bool IsDirty { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public SkinMetadata Metadata { get; private set; }
/// <summary>
/// Initializes this skin document
/// </summary>
public SkinDocument()
{
IsDirty = false;
Metadata = new SkinMetadata();
}
}
}

View File

@ -0,0 +1,57 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RainmeterStudio.Core.Model;
using RainmeterStudio.Core.Model.Generic;
namespace RainmeterStudio.SkinDesignerPlugin
{
public class SkinMetadata : Property
{
/// <summary>
/// Gets a property indicating the name of the skin
/// </summary>
public Property<string> SkinName { get; private set; }
/// <summary>
/// Gets a property indicating the author of the skin
/// </summary>
public Property<string> Author { get; private set; }
/// <summary>
/// Gets a property containing information about this skin (credits, usage instructions, setup etc)
/// </summary>
public Property<string> Information { get; private set; }
/// <summary>
/// Gets a property indicating the version of this skin
/// </summary>
public Property<Version> Version { get; private set; }
/// <summary>
/// Gets a property containing licensing information
/// </summary>
public Property<string> License { get; private set; }
/// <summary>
/// Initializes this metadata property
/// </summary>
public SkinMetadata() :
base("Metadata")
{
SkinName = new Property<string>("Name");
Author = new Property<string>("Author");
Information = new Property<string>("Information");
Version = new Property<Version>("Version");
License = new Property<string>("License");
Children.Add(SkinName);
Children.Add(Author);
Children.Add(Information);
Children.Add(Version);
Children.Add(License);
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RainmeterStudio.Core.Model;
using RainmeterStudio.Core.Storage;
namespace RainmeterStudio.SkinDesignerPlugin
{
public class SkinStorage : IDocumentStorage
{
public IDocument Read(string path)
{
throw new NotImplementedException();
}
public void Write(string path, IDocument document)
{
throw new NotImplementedException();
}
public bool CanRead(string path)
{
throw new NotImplementedException();
}
public bool CanWrite(Type documentType)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.SkinDesignerPlugin
{
/// <summary>
/// Template of a skin which will be opened in the designer
/// </summary>
public class SkinTemplate : DocumentTemplate
{
/// <summary>
/// Initializes this skin template
/// </summary>
public SkinTemplate()
: base("Skin", "ini")
{
}
/// <summary>
/// Creates a new document using this template
/// </summary>
/// <returns>Newly created document</returns>
public override IDocument CreateDocument()
{
return new SkinDocument();
}
}
}