diff --git a/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs b/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs deleted file mode 100644 index 2bded609..00000000 --- a/RainmeterStudio.SkinDesigner/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using RainmeterStudio.Core; - -// 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("")] -[assembly: RainmeterStudioPlugin] - -// 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")] diff --git a/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj b/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj deleted file mode 100644 index 30add7be..00000000 --- a/RainmeterStudio.SkinDesigner/RainmeterStudio.SkinDesignerPlugin.csproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - AnyCPU - {E8BD25E9-3055-4688-9E83-ECF684EF30C6} - Library - Properties - RainmeterStudio.SkinDesignerPlugin - RainmeterStudio.SkinDesignerPlugin - v4.5 - 512 - - - - true - full - false - ..\x32-Debug\StudioPlugins\ - DEBUG;TRACE - prompt - 4 - x86 - false - - - pdbonly - true - bin\Release\StudioPlugins\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - True - True - Graphics.resx - - - True - True - Icons.resx - - - True - True - Strings.resx - - - - SkinDesignerControl.xaml - - - - - - - - - - MSBuild:Compile - Designer - - - - - {1d2a4896-af31-4e82-a84f-4e218067701f} - RainmeterStudio.Core - False - - - - - - - - PublicResXFileCodeGenerator - Graphics.Designer.cs - - - PublicResXFileCodeGenerator - Icons.Designer.cs - - - PublicResXFileCodeGenerator - Strings.Designer.cs - - - - - - - - \ No newline at end of file diff --git a/RainmeterStudio.SkinDesigner/Resources/Graphics.Designer.cs b/RainmeterStudio.SkinDesigner/Resources/Graphics.Designer.cs deleted file mode 100644 index 4c6adc84..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Graphics.Designer.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace RainmeterStudio.SkinDesignerPlugin.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Graphics { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Graphics() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.SkinDesignerPlugin.Resources.Graphics", typeof(Graphics).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap TransparentBackground { - get { - object obj = ResourceManager.GetObject("TransparentBackground", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/RainmeterStudio.SkinDesigner/Resources/Graphics.resx b/RainmeterStudio.SkinDesigner/Resources/Graphics.resx deleted file mode 100644 index 74d21455..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Graphics.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - graphics\transparent_background.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/RainmeterStudio.SkinDesigner/Resources/Icons.Designer.cs b/RainmeterStudio.SkinDesigner/Resources/Icons.Designer.cs deleted file mode 100644 index d01198d6..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Icons.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace RainmeterStudio.SkinDesignerPlugin.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Icons { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Icons() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.SkinDesignerPlugin.Resources.Icons", typeof(Icons).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/RainmeterStudio.SkinDesigner/Resources/Icons.resx b/RainmeterStudio.SkinDesigner/Resources/Icons.resx deleted file mode 100644 index 85c90909..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Icons.resx +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/RainmeterStudio.SkinDesigner/Resources/Strings.Designer.cs b/RainmeterStudio.SkinDesigner/Resources/Strings.Designer.cs deleted file mode 100644 index 9e9761fc..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Strings.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace RainmeterStudio.SkinDesignerPlugin.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Strings { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Strings() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.SkinDesignerPlugin.Resources.Strings", typeof(Strings).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Test value. - /// - public static string Test { - get { - return ResourceManager.GetString("Test", resourceCulture); - } - } - } -} diff --git a/RainmeterStudio.SkinDesigner/Resources/Strings.resx b/RainmeterStudio.SkinDesigner/Resources/Strings.resx deleted file mode 100644 index 05dd1e09..00000000 --- a/RainmeterStudio.SkinDesigner/Resources/Strings.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Test value - - \ No newline at end of file diff --git a/RainmeterStudio.SkinDesigner/SkinDesigner.cs b/RainmeterStudio.SkinDesigner/SkinDesigner.cs deleted file mode 100644 index 9d4131f6..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDesigner.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using RainmeterStudio.Core.Editor; -using RainmeterStudio.Core.Model; -using RainmeterStudio.Core.Editor.Features; - -namespace RainmeterStudio.SkinDesignerPlugin -{ - /// - /// Skin designer document editor - /// - public class SkinDesigner : IDocumentEditor //TODO: , ISelectionPropertiesProvider, IToolboxProvider, IUndoSupport - { - /// - /// Gets the document attached to this editor instance - /// - public SkinDocument AttachedDocument { get; private set; } - - /// - /// Gets the document attached to this editor instance - /// - IDocument IDocumentEditor.AttachedDocument - { - get { return AttachedDocument; } - } - - /// - /// Gets the UI control to display for this editor - /// - public SkinDesignerControl EditorUI { get; private set; } - - /// - /// Gets the UI control to display for this editor - /// - UIElement IDocumentEditor.EditorUI - { - get { return EditorUI; } - } - - /// - /// Initializes this editor - /// - /// The document - public SkinDesigner(SkinDocument document) - { - AttachedDocument = document; - EditorUI = new SkinDesignerControl(document); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml deleted file mode 100644 index 2a6d62d7..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs b/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs deleted file mode 100644 index 898f8f8e..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDesignerControl.xaml.cs +++ /dev/null @@ -1,27 +0,0 @@ -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 -{ - /// - /// Interaction logic for SkinDesignerControl.xaml - /// - public partial class SkinDesignerControl : Page - { - public SkinDesignerControl(SkinDocument document) - { - InitializeComponent(); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs b/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs deleted file mode 100644 index 267f7a1c..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDesignerFactory.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RainmeterStudio.Core; -using RainmeterStudio.Core.Editor; -using RainmeterStudio.Core.Model; - -namespace RainmeterStudio.SkinDesignerPlugin -{ - /// - /// Skin designer factory - /// - [PluginExport] - public class SkinDesignerFactory : IDocumentEditorFactory - { - /// - /// Creates a new editor object - /// - /// Document to be edited by the editor - /// A new document editor - public IDocumentEditor CreateEditor(IDocument document) - { - return new SkinDesigner((SkinDocument)document); - } - - /// - /// Tests if this editor can edit this document type - /// - /// Document type - /// True if the editor can edit the document type - public bool CanEdit(Type type) - { - return type.Equals(typeof(SkinDocument)); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinDocument.cs b/RainmeterStudio.SkinDesigner/SkinDocument.cs deleted file mode 100644 index b1eb42e4..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDocument.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using RainmeterStudio.Core.Model; - -namespace RainmeterStudio.SkinDesignerPlugin -{ - /// - /// Skin document - /// - 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; } - - /// - /// Initializes this skin document - /// - public SkinDocument() - { - IsDirty = false; - Metadata = new SkinMetadata(); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinDocumentTemplate.cs b/RainmeterStudio.SkinDesigner/SkinDocumentTemplate.cs deleted file mode 100644 index c3501cd2..00000000 --- a/RainmeterStudio.SkinDesigner/SkinDocumentTemplate.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RainmeterStudio.Core; -using RainmeterStudio.Core.Editor; -using RainmeterStudio.Core.Model; - -namespace RainmeterStudio.SkinDesignerPlugin -{ - /// - /// Template of a skin which will be opened in the designer - /// - [PluginExport] - public class SkinDocumentTemplate : IDocumentTemplate - { - /// - /// Gets the document template name - /// - public string Name - { - get { return "Skin"; } - } - - /// - /// Gets the default extension of this template - /// - public string DefaultExtension - { - get { return "rsskin"; } - } - - /// - /// Gets or sets the properties of this template - /// - public IEnumerable Properties - { - get { return Enumerable.Empty(); } - } - - /// - /// Creates a new document using this template - /// - /// Newly created document - public IDocument CreateDocument() - { - return new SkinDocument(); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinMetadata.cs b/RainmeterStudio.SkinDesigner/SkinMetadata.cs deleted file mode 100644 index ed8c6b6b..00000000 --- a/RainmeterStudio.SkinDesigner/SkinMetadata.cs +++ /dev/null @@ -1,57 +0,0 @@ - -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 - { - /// - /// Gets a property indicating the name of the skin - /// - public Property SkinName { get; private set; } - - /// - /// Gets a property indicating the author of the skin - /// - public Property Author { get; private set; } - - /// - /// Gets a property containing information about this skin (credits, usage instructions, setup etc) - /// - public Property Information { get; private set; } - - /// - /// Gets a property indicating the version of this skin - /// - public Property Version { get; private set; } - - /// - /// Gets a property containing licensing information - /// - public Property License { get; private set; } - - /// - /// Initializes this metadata property - /// - public SkinMetadata() : - base("Metadata") - { - SkinName = new Property("Name"); - Author = new Property("Author"); - Information = new Property("Information"); - Version = new Property("Version"); - License = new Property("License"); - - Children.Add(SkinName); - Children.Add(Author); - Children.Add(Information); - Children.Add(Version); - Children.Add(License); - } - } -} diff --git a/RainmeterStudio.SkinDesigner/SkinStorage.cs b/RainmeterStudio.SkinDesigner/SkinStorage.cs deleted file mode 100644 index 8e173cb1..00000000 --- a/RainmeterStudio.SkinDesigner/SkinStorage.cs +++ /dev/null @@ -1,32 +0,0 @@ -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 ReadDocument(string path) - { - throw new NotImplementedException(); - } - - public void WriteDocument(IDocument document, string path) - { - throw new NotImplementedException(); - } - - public bool CanReadDocument(string path) - { - throw new NotImplementedException(); - } - - public bool CanWriteDocument(Type documentType) - { - throw new NotImplementedException(); - } - } -} diff --git a/RainmeterStudio/Editor/SkinDesigner/Controls/HoverAdorner.cs b/RainmeterStudio/Editor/SkinDesigner/Controls/HoverAdorner.cs new file mode 100644 index 00000000..f4681002 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/Controls/HoverAdorner.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Documents; +using System.Windows.Media; + +namespace RainmeterStudio.Editor.SkinDesigner.Controls +{ + public class HoverAdorner : Adorner + { + public HoverAdorner(UIElement adornedElement) + : base(adornedElement) + { + } + + protected override void OnRender(DrawingContext drawingContext) + { + base.OnRender(drawingContext); + + // Calculate DPI factor + Matrix matrix = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice; + double dpiFactor = 1.0 / matrix.M11; + + // Rectangle + Rect rect = new Rect(AdornedElement.DesiredSize); + Rect selectionRect = new Rect(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); + + // Create pen + Pen pen = new Pen(Brushes.Gray, 1 * dpiFactor); + pen.DashStyle = DashStyles.Dash; + + // Create a guidelines set for on-pixel drawing + GuidelineSet guidelines = new GuidelineSet(); + guidelines.GuidelinesX.Add(selectionRect.Left + pen.Thickness / 2); + guidelines.GuidelinesX.Add(selectionRect.Right + pen.Thickness / 2); + guidelines.GuidelinesY.Add(selectionRect.Top + pen.Thickness / 2); + guidelines.GuidelinesY.Add(selectionRect.Bottom + pen.Thickness / 2); + + // Draw + drawingContext.PushGuidelineSet(guidelines); + drawingContext.DrawRectangle(null, pen, selectionRect); + drawingContext.Pop(); + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml b/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml new file mode 100644 index 00000000..ab134487 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml.cs b/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml.cs new file mode 100644 index 00000000..6037a159 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/Controls/MeterControl.xaml.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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; +using RainmeterStudio.Rainmeter; + +namespace RainmeterStudio.Editor.SkinDesigner.Controls +{ + /// + /// Interaction logic for MeterControl.xaml + /// + public partial class MeterControl : UserControl + { + private Skin _skin; + + /// + /// Gets or sets the skin being edited + /// + public Skin Skin + { + get + { + return Skin; + } + set + { + _skin = value; + + Reset(); + } + } + + /// + /// Gets an enumerable with the meter items + /// + public IEnumerable Items { get { return Skin.Meters; } } + + /// + /// Gets a collection with the currently selected items + /// + public ObservableCollection SelectedItems { get; private set; } + + /// + /// Gets or sets the currently selected item + /// + public Meter SelectedItem { get; set; } + + /// + /// Gets or sets the selected item index + /// + public int SelectedIndex { get; set; } + + /// + /// Initializes the meter control + /// + public MeterControl() + { + InitializeComponent(); + Loaded += MeterControl_Loaded; + } + + void MeterControl_Loaded(object sender, RoutedEventArgs e) + { + //AdornerLayer.GetAdornerLayer(ellipse).Add(new SelectAdorner(ellipse)); + } + + private void Reset() + { + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/Controls/SelectAdorner.cs b/RainmeterStudio/Editor/SkinDesigner/Controls/SelectAdorner.cs new file mode 100644 index 00000000..bcc97295 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/Controls/SelectAdorner.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Documents; +using System.Windows.Media; + +namespace RainmeterStudio.Editor.SkinDesigner.Controls +{ + public class SelectAdorner : Adorner + { + public SelectAdorner(UIElement adornedElement) + : base(adornedElement) + { + } + + protected override void OnRender(DrawingContext drawingContext) + { + base.OnRender(drawingContext); + + // Calculate DPI factor + Matrix matrix = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice; + double dpiFactor = 1.0 / matrix.M11; + + // Rectangle + Rect rect = new Rect(AdornedElement.DesiredSize); + Rect selectionRect = new Rect(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); + + // Create pen + Pen pen = new Pen(Brushes.Blue, 1 * dpiFactor); + + // Create a guidelines set for on-pixel drawing + GuidelineSet guidelines = new GuidelineSet(); + guidelines.GuidelinesX.Add(selectionRect.Left + pen.Thickness / 2); + guidelines.GuidelinesX.Add(selectionRect.Right + pen.Thickness / 2); + guidelines.GuidelinesY.Add(selectionRect.Top + pen.Thickness / 2); + guidelines.GuidelinesY.Add(selectionRect.Bottom + pen.Thickness / 2); + + // Draw + drawingContext.PushGuidelineSet(guidelines); + drawingContext.DrawRectangle(null, pen, selectionRect); + drawingContext.Pop(); + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinDesignerFactory.cs b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerFactory.cs new file mode 100644 index 00000000..acde06ea --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerFactory.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Editor; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.Editor.SkinDesigner +{ + /// + /// Creates skin designers + /// + [PluginExport] + public class SkinDesignerFactory : IDocumentEditorFactory + { + /// + public IDocumentEditor CreateEditor(IDocument document) + { + return new SkinDesignerUI((SkinDocument)document); + } + + /// + public bool CanEdit(Type type) + { + return type == typeof(SkinDocument); + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml new file mode 100644 index 00000000..ac31449c --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml.cs b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml.cs new file mode 100644 index 00000000..0657fc38 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinDesignerUI.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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; +using RainmeterStudio.Core.Editor; +using RainmeterStudio.Core.Editor.Features; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.Editor.SkinDesigner +{ + /// + /// Interaction logic for SkinDesignerUI.xaml + /// + public partial class SkinDesignerUI : UserControl, IDocumentEditor, IToolboxProvider + { + private SkinDocument _document; + + #region IDocumentEditor + + /// + /// Gets the attached document + /// + public IDocument AttachedDocument + { + get { return _document; } + } + + /// + /// Gets the Editor UI + /// + public UIElement EditorUI + { + get { return this; } + } + + #endregion + + /// + /// Gets or sets the attached skin document + /// + public SkinDocument Document + { + get + { + return _document; + } + protected set + { + _document = value; + + Reset(); + } + } + + /// + /// Initializes the skin designer UI + /// + /// Skin document to be edited + public SkinDesignerUI(SkinDocument document) + { + InitializeComponent(); + + Document = document; + } + + /// + /// Reloads everything + /// + private void Reset() + { + meterControl.Skin = Document.Skin; + } + + public IEnumerable ToolboxItems + { + get + { + yield return new ToolboxItem("Item 1"); + yield return new ToolboxItem("Item 2"); + yield return new ToolboxItem("Item 3"); + yield return new ToolboxItem("Item 4"); + } + } + + public event EventHandler ToolboxItemsChanged; + + public void ToolboxItemDrop(ToolboxItem item) + { + + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinDocument.cs b/RainmeterStudio/Editor/SkinDesigner/SkinDocument.cs new file mode 100644 index 00000000..199154f0 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinDocument.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using RainmeterStudio.Core.Model; +using RainmeterStudio.Rainmeter; + +namespace RainmeterStudio.Editor.SkinDesigner +{ + public class SkinDocument : IDocument + { + private Skin _skin; + + /// + /// Triggered when the value of a property changes + /// + public event PropertyChangedEventHandler PropertyChanged; + + #region IDocument + + private Reference _reference; + private bool _isDirty; + + /// + /// Gets or sets the reference to this document + /// + public Reference Reference + { + get + { + return _reference; + } + set + { + _reference = value; + + if (PropertyChanged != null) + PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("Reference")); + } + } + + /// + /// Gets or sets a value indicating if this document has unsaved changes + /// + public bool IsDirty + { + get + { + return _isDirty; + } + set + { + _isDirty = value; + + if (PropertyChanged != null) + PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("IsDirty")); + } + } + + #endregion + + /// + /// Gets or sets the skin + /// + public Skin Skin + { + get + { + return _skin; + } + set + { + _skin = value; + + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs("Skin")); + } + } + + /// + /// Initializes this skin document + /// + public SkinDocument() + { + Skin = new Skin(); + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinDocumentEmptyTemplate.cs b/RainmeterStudio/Editor/SkinDesigner/SkinDocumentEmptyTemplate.cs new file mode 100644 index 00000000..cfd842ba --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinDocumentEmptyTemplate.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Model; + +namespace RainmeterStudio.Editor.SkinDesigner +{ + [PluginExport] + public class SkinDocumentEmptyTemplate : IDocumentTemplate + { + public string Name + { + get { return "Skin"; } + } + + public string DefaultExtension + { + get { return "rsskin"; } + } + + public IEnumerable Properties + { + get { yield break; } + } + + public IDocument CreateDocument() + { + return new SkinDocument(); + } + } +} diff --git a/RainmeterStudio/Editor/SkinDesigner/SkinStorage.cs b/RainmeterStudio/Editor/SkinDesigner/SkinStorage.cs new file mode 100644 index 00000000..75b02645 --- /dev/null +++ b/RainmeterStudio/Editor/SkinDesigner/SkinStorage.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RainmeterStudio.Core; +using RainmeterStudio.Core.Storage; + +namespace RainmeterStudio.Editor.SkinDesigner +{ + [PluginExport] + public class SkinStorage : IDocumentStorage + { + public Core.Model.IDocument ReadDocument(string path) + { + return new SkinDocument(); + } + + public void WriteDocument(Core.Model.IDocument document, string path) + { + } + + public bool CanReadDocument(string path) + { + return Path.GetExtension(path) == ".rsskin"; + } + + public bool CanWriteDocument(Type documentType) + { + return documentType == typeof(SkinDocument); + } + } +} diff --git a/RainmeterStudio/RainmeterStudio.csproj b/RainmeterStudio/RainmeterStudio.csproj index ccbf45aa..f1dad74b 100644 --- a/RainmeterStudio/RainmeterStudio.csproj +++ b/RainmeterStudio/RainmeterStudio.csproj @@ -65,10 +65,19 @@ + Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -82,6 +91,18 @@ ProjectEditorUI.xaml + + + MeterControl.xaml + + + + + SkinDesignerUI.xaml + + + + @@ -118,6 +139,9 @@ ProjectPanel.xaml + + ToolboxPanel.xaml + @@ -154,6 +178,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -251,6 +279,10 @@ {1d2a4896-af31-4e82-a84f-4e218067701f} RainmeterStudio.Core + + {c641d7f8-dddc-4ec6-8f5e-233520290642} + RainmeterStudio.Rainmeter + @@ -265,7 +297,13 @@ - + + + + + + +