Completed rename from RainmeterEditor to RainmeterStudio
13
RainmeterStudio/App.xaml
Normal file
@ -0,0 +1,13 @@
|
||||
<Application x:Class="RainmeterStudio.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="UI/MainWindow.xaml"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="UI/Styles/Common.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
22
RainmeterStudio/App.xaml.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using RainmeterStudio.Business;
|
||||
using RainmeterStudio.Documents.Text;
|
||||
|
||||
namespace RainmeterStudio
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
DocumentManager.Instance.RegisterEditorFactory(new TextEditorFactory());
|
||||
}
|
||||
}
|
||||
}
|
78
RainmeterStudio/Business/DocumentManager.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
using RainmeterStudio.Model.Events;
|
||||
|
||||
namespace RainmeterStudio.Business
|
||||
{
|
||||
public class DocumentManager
|
||||
{
|
||||
#region Singleton instance
|
||||
private static DocumentManager _instance = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance of DocumentManager
|
||||
/// </summary>
|
||||
public static DocumentManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
_instance = new DocumentManager();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DocumentManager()
|
||||
{
|
||||
}
|
||||
|
||||
List<IDocumentEditorFactory> _factories = new List<IDocumentEditorFactory>();
|
||||
List<IDocumentEditor> _editors = new List<IDocumentEditor>();
|
||||
|
||||
public event EventHandler<DocumentOpenedEventArgs> DocumentOpened;
|
||||
|
||||
/// <summary>
|
||||
/// Registers a document editor factory
|
||||
/// </summary>
|
||||
/// <param name="factory">Document editor factory</param>
|
||||
public void RegisterEditorFactory(IDocumentEditorFactory factory)
|
||||
{
|
||||
_factories.Add(factory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new document in the specified path, with the specified format, and opens it
|
||||
/// </summary>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="path"></param>
|
||||
public void Create(DocumentFormat format, string path)
|
||||
{
|
||||
// Create document
|
||||
var document = format.Factory.CreateDocument(format, path);
|
||||
|
||||
// Create editor
|
||||
var editor = format.Factory.CreateEditor(document);
|
||||
_editors.Add(editor);
|
||||
|
||||
// Trigger event
|
||||
if (DocumentOpened != null)
|
||||
DocumentOpened(this, new DocumentOpenedEventArgs(editor));
|
||||
}
|
||||
|
||||
public IEnumerable<DocumentFormat> DocumentFormats
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var f in _factories)
|
||||
foreach (var df in f.CreateDocumentFormats)
|
||||
yield return df;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
RainmeterStudio/Business/ProjectManager.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Business
|
||||
{
|
||||
public class ProjectManager
|
||||
{
|
||||
public Project ActiveProject { get; protected set; }
|
||||
|
||||
public void Open() { }
|
||||
public void Close() { }
|
||||
}
|
||||
}
|
12
RainmeterStudio/Documents/Ini/IniDocument.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Ini
|
||||
{
|
||||
/*public class IniDocument : IDocument
|
||||
{
|
||||
}*/
|
||||
}
|
31
RainmeterStudio/Documents/Ini/IniSkinDesigner.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Ini
|
||||
{
|
||||
/*public class IniSkinDesigner : IDocumentEditor
|
||||
{
|
||||
public override IDocument Document
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override string Title
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override System.Windows.UIElement EditorUI
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override EventHandler SelectionChanged
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
}*/
|
||||
}
|
11
RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml
Normal file
@ -0,0 +1,11 @@
|
||||
<UserControl x:Class="RainmeterStudio.Documents.Ini.IniSkinDesignerControl"
|
||||
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">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
27
RainmeterStudio/Documents/Ini/IniSkinDesignerControl.xaml.cs
Normal 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.Documents.Ini
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for IniSkinDesignerControl.xaml
|
||||
/// </summary>
|
||||
public partial class IniSkinDesignerControl : UserControl
|
||||
{
|
||||
public IniSkinDesignerControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
14
RainmeterStudio/Documents/Ini/IniSkinDesignerFactory.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Ini
|
||||
{
|
||||
/*public class IniSkinDesignerFactory : IDocumentEditorFactory
|
||||
{
|
||||
|
||||
}*/
|
||||
}
|
35
RainmeterStudio/Documents/Text/TextDocument.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Text
|
||||
{
|
||||
public class TextDocument : IDocument
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetFileName(FilePath);
|
||||
}
|
||||
}
|
||||
|
||||
public string FilePath
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public TextDocument()
|
||||
{
|
||||
Text = String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
27
RainmeterStudio/Documents/Text/TextEditor.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Text
|
||||
{
|
||||
public class TextEditor : IDocumentEditor
|
||||
{
|
||||
private TextDocument _document;
|
||||
private TextEditorControl _control;
|
||||
|
||||
public TextEditor(TextDocument document)
|
||||
{
|
||||
_document = document;
|
||||
_control = new TextEditorControl(document);
|
||||
}
|
||||
|
||||
public override IDocument Document { get { return _document; } }
|
||||
|
||||
public override string Title { get { return _document.Name; } }
|
||||
|
||||
public override System.Windows.UIElement EditorUI { get { return _control; } }
|
||||
}
|
||||
}
|
11
RainmeterStudio/Documents/Text/TextEditorControl.xaml
Normal file
@ -0,0 +1,11 @@
|
||||
<UserControl x:Class="RainmeterStudio.Documents.Text.TextEditorControl"
|
||||
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">
|
||||
<Grid>
|
||||
<TextBox Name="text" AcceptsReturn="True" />
|
||||
</Grid>
|
||||
</UserControl>
|
32
RainmeterStudio/Documents/Text/TextEditorControl.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
||||
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.Documents.Text
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TextEditorControl.xaml
|
||||
/// </summary>
|
||||
public partial class TextEditorControl : UserControl
|
||||
{
|
||||
private TextDocument _document;
|
||||
|
||||
public TextEditorControl(TextDocument document)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_document = document;
|
||||
text.Text = document.Text;
|
||||
}
|
||||
}
|
||||
}
|
59
RainmeterStudio/Documents/Text/TextEditorFactory.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Business;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Text
|
||||
{
|
||||
public class TextEditorFactory : IDocumentEditorFactory
|
||||
{
|
||||
private TextStorage _storage = new TextStorage();
|
||||
|
||||
/// <inheritdoc />
|
||||
public string EditorName
|
||||
{
|
||||
get { return Resources.Strings.DocumentEditor_Text_Name; }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<DocumentFormat> CreateDocumentFormats
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new DocumentFormat()
|
||||
{
|
||||
Name = Resources.Strings.DocumentFormat_TextFile_Name,
|
||||
Category = Resources.Strings.Category_Utility,
|
||||
DefaultExtension = ".txt",
|
||||
Description = Resources.Strings.DocumentFormat_TextFile_Description,
|
||||
Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Resources/Icons/text_file_32.png", UriKind.RelativeOrAbsolute)),
|
||||
Factory = this
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IDocumentEditor CreateEditor(IDocument document)
|
||||
{
|
||||
TextDocument textDocument = document as TextDocument;
|
||||
|
||||
if (textDocument == null)
|
||||
throw new ArgumentException("Cannot edit provided document.");
|
||||
|
||||
return new TextEditor(textDocument);
|
||||
}
|
||||
|
||||
public IDocumentStorage Storage { get { return _storage; } }
|
||||
|
||||
public IDocument CreateDocument(DocumentFormat format, string path)
|
||||
{
|
||||
var document = new TextDocument();
|
||||
document.FilePath = path;
|
||||
|
||||
return document;
|
||||
}
|
||||
}
|
||||
}
|
64
RainmeterStudio/Documents/Text/TextStorage.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Documents.Text
|
||||
{
|
||||
/// <summary>
|
||||
/// Storage for text files
|
||||
/// </summary>
|
||||
public class TextStorage : IDocumentStorage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
IDocument IDocumentStorage.Read(string path)
|
||||
{
|
||||
TextDocument document = new TextDocument();
|
||||
document.FilePath = path;
|
||||
document.Text = File.ReadAllText(path);
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Write(string path, IDocument document)
|
||||
{
|
||||
TextDocument textDocument = document as TextDocument;
|
||||
|
||||
if (textDocument == null)
|
||||
throw new ArgumentException("Provided document is not supported by this storage.");
|
||||
|
||||
File.WriteAllText(path, textDocument.Text);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool CanRead(string path)
|
||||
{
|
||||
// Open the file
|
||||
FileStream file = File.OpenRead(path);
|
||||
|
||||
// Read a small chunk (1kb should be enough)
|
||||
byte[] buffer = new byte[1024];
|
||||
int read = file.Read(buffer, 0, buffer.Length);
|
||||
|
||||
// Close file
|
||||
file.Close();
|
||||
|
||||
// Find 4 consecutive zero bytes
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < read; i++)
|
||||
{
|
||||
// Count zero bytes
|
||||
if (buffer[i] == 0)
|
||||
++cnt;
|
||||
else cnt = 0;
|
||||
|
||||
// Found > 4? Most likely binary file
|
||||
if (cnt >= 4)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not found, probably text file
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
53
RainmeterStudio/Interop/NativeLibrary.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Interop
|
||||
{
|
||||
public class NativeLibrary : IDisposable
|
||||
{
|
||||
#region Imports
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern IntPtr LoadLibrary(string libname);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Ansi)]
|
||||
private static extern bool FreeLibrary(IntPtr hModule);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Ansi)]
|
||||
private static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
|
||||
|
||||
#endregion
|
||||
|
||||
public string DllName { get; private set; }
|
||||
private IntPtr _handle;
|
||||
|
||||
public NativeLibrary(string dllName)
|
||||
{
|
||||
// Set properties
|
||||
DllName = dllName;
|
||||
|
||||
// Load library
|
||||
_handle = LoadLibrary(DllName);
|
||||
if (_handle == IntPtr.Zero)
|
||||
{
|
||||
int errorCode = Marshal.GetLastWin32Error();
|
||||
throw new BadImageFormatException(string.Format("Failed to load library (ErrorCode: {0})", errorCode));
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_handle != IntPtr.Zero)
|
||||
FreeLibrary(_handle);
|
||||
}
|
||||
|
||||
public Delegate GetFunctionByName(string name, Type delegateType)
|
||||
{
|
||||
IntPtr addr = GetProcAddress(_handle, name);
|
||||
return Marshal.GetDelegateForFunctionPointer(addr, delegateType);
|
||||
}
|
||||
}
|
||||
}
|
20
RainmeterStudio/LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2008 Ricardo Amores Hernández
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
RainmeterStudio/Model/DocumentFormat.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public class DocumentFormat
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ImageSource Icon { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DefaultExtension { get; set; }
|
||||
public IDocumentEditorFactory Factory { get; set; }
|
||||
public string Category { get; set; }
|
||||
}
|
||||
}
|
17
RainmeterStudio/Model/Events/DocumentOpenedEventArgs.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Model.Events
|
||||
{
|
||||
public class DocumentOpenedEventArgs : EventArgs
|
||||
{
|
||||
public IDocumentEditor Editor { get; private set; }
|
||||
|
||||
public DocumentOpenedEventArgs(IDocumentEditor editor)
|
||||
{
|
||||
Editor = editor;
|
||||
}
|
||||
}
|
||||
}
|
13
RainmeterStudio/Model/IDocument.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public interface IDocument
|
||||
{
|
||||
string Name { get; }
|
||||
string FilePath { get; }
|
||||
}
|
||||
}
|
136
RainmeterStudio/Model/IDocumentEditor.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public abstract class IDocumentEditor : IDisposable
|
||||
{
|
||||
#region Dirty flag
|
||||
|
||||
private bool _dirty = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag indicating if the active document is dirty (modified and not saved)
|
||||
/// </summary>
|
||||
public virtual bool Dirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dirty;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
_dirty = value;
|
||||
if (DirtyChanged != null)
|
||||
DirtyChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the dirty flag changes
|
||||
/// </summary>
|
||||
public event EventHandler DirtyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Document
|
||||
|
||||
/// <summary>
|
||||
/// Gets the opened document
|
||||
/// </summary>
|
||||
public abstract IDocument Document { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title to be displayed in the title bar
|
||||
/// </summary>
|
||||
public abstract string Title { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the title changes
|
||||
/// </summary>
|
||||
public event EventHandler TitleChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorUI
|
||||
|
||||
/// <summary>
|
||||
/// Gets the editor UI
|
||||
/// </summary>
|
||||
public abstract UIElement EditorUI { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selection properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if this editor uses the selection properties window
|
||||
/// </summary>
|
||||
public virtual bool UsesSelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the selected object
|
||||
/// </summary>
|
||||
public virtual string SelectionName
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of properties for the currently selected object
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> SelectionProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the selected object changes (used to update properties)
|
||||
/// </summary>
|
||||
public event EventHandler SelectionChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Toolbox
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of items to populate the toolbox
|
||||
/// </summary>
|
||||
public virtual IEnumerable<string> ToolboxItems
|
||||
{
|
||||
get
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ToolboxChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
39
RainmeterStudio/Model/IDocumentEditorFactory.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Storage;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public interface IDocumentEditorFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the editor
|
||||
/// </summary>
|
||||
string EditorName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Formats that will be used to populate the 'create document' dialog
|
||||
/// </summary>
|
||||
IEnumerable<DocumentFormat> CreateDocumentFormats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new editor object
|
||||
/// </summary>
|
||||
/// <param name="document">Document to be edited by the editor</param>
|
||||
/// <returns>A new document editor</returns>
|
||||
IDocumentEditor CreateEditor(IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new document
|
||||
/// </summary>
|
||||
/// <returns>A new document</returns>
|
||||
IDocument CreateDocument(DocumentFormat format, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the storage of this factory
|
||||
/// </summary>
|
||||
IDocumentStorage Storage { get; }
|
||||
}
|
||||
}
|
26
RainmeterStudio/Model/IDocumentStorage.cs
Normal file
@ -0,0 +1,26 @@
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public interface IDocumentStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads a document from file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>Read document</returns>
|
||||
IDocument Read(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a document to a file
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <param name="document">Document to write</param>
|
||||
void Write(string path, IDocument document);
|
||||
|
||||
/// <summary>
|
||||
/// Tests if the file can be read by this storage
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file</param>
|
||||
/// <returns>True if file can be read</returns>
|
||||
bool CanRead(string path);
|
||||
}
|
||||
}
|
114
RainmeterStudio/Model/Project.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public class Project
|
||||
{
|
||||
[XmlElement("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlElement("author")]
|
||||
public string Author { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version Version { get; set; }
|
||||
|
||||
[XmlElement("version")]
|
||||
public string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return Version.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
Version = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("autoLoadFile")]
|
||||
public Reference AutoLoadFile { get; set; }
|
||||
|
||||
[XmlArray("variableFiles")]
|
||||
public List<Reference> VariableFiles { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumRainmeter { get; set; }
|
||||
|
||||
[XmlElement("minimumRainmeter")]
|
||||
public string MinimumRainmeterString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumRainmeter.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumRainmeter = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Version MinimumWindows { get; set; }
|
||||
|
||||
[XmlElement("minimumWindows")]
|
||||
public string MinimumWindowsString
|
||||
{
|
||||
get
|
||||
{
|
||||
return MinimumWindows.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
MinimumWindows = new Version(value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlElement("root")]
|
||||
public Tree<Reference> Root { get; set; }
|
||||
|
||||
public Project()
|
||||
{
|
||||
Root = new Tree<Reference>();
|
||||
VariableFiles = new List<Reference>();
|
||||
Version = new Version();
|
||||
MinimumRainmeter = new Version("3.1");
|
||||
MinimumWindows = new Version("5.1");
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Project other = obj as Project;
|
||||
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
bool res = String.Equals(Author, other.Author);
|
||||
res &= Reference.Equals(AutoLoadFile, other.AutoLoadFile);
|
||||
res &= Version.Equals(MinimumRainmeter, other.MinimumRainmeter);
|
||||
res &= Version.Equals(MinimumWindows, other.MinimumWindows);
|
||||
res &= String.Equals(Name, other.Name);
|
||||
res &= Tree<Reference>.Equals(Root, other.Root);
|
||||
res &= Version.Equals(Version, other.Version);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Author == null) ? 0 : Author.GetHashCode();
|
||||
hash = hash * 7 + ((AutoLoadFile == null) ? 0 : AutoLoadFile.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumRainmeter == null) ? 0 : MinimumRainmeter.GetHashCode());
|
||||
hash = hash * 7 + ((MinimumWindows == null) ? 0 : MinimumWindows.GetHashCode());
|
||||
hash = hash * 7 + ((Name == null) ? 0 : Name.GetHashCode());
|
||||
hash = hash * 7 + ((Root == null) ? 0 : Root.GetHashCode());
|
||||
hash = hash * 7 + ((Version == null) ? 0 : Version.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
30
RainmeterStudio/Model/Property.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public class Property
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
private object _value;
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ValueChanged;
|
||||
}
|
||||
}
|
11
RainmeterStudio/Model/RainmeterConfig.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public class RainmeterConfig
|
||||
{
|
||||
}
|
||||
}
|
50
RainmeterStudio/Model/Reference.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Reference to a file or folder
|
||||
/// </summary>
|
||||
public class Reference
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute("path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
public Reference()
|
||||
{
|
||||
}
|
||||
|
||||
public Reference(string name, string path = null)
|
||||
{
|
||||
Name = name;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var other = obj as Reference;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare using string equals
|
||||
return String.Equals(Name, other.Name) && String.Equals(Path, other.Path);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = (Name == null) ? 0 : Name.GetHashCode();
|
||||
hash = hash * 7 + ((Path == null) ? 0 : Path.GetHashCode());
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
153
RainmeterStudio/Model/Tree.cs
Normal file
@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RainmeterStudio.Model
|
||||
{
|
||||
public class Tree<T>
|
||||
{
|
||||
[XmlElement("data")]
|
||||
public T Data { get; set; }
|
||||
|
||||
[XmlArray("children"), XmlArrayItem("child")]
|
||||
public List<Tree<T>> Children { get; set; }
|
||||
|
||||
public Tree()
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = default(T);
|
||||
}
|
||||
|
||||
public Tree(T data)
|
||||
{
|
||||
Children = new List<Tree<T>>();
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public int IndexOf(Tree<T> item)
|
||||
{
|
||||
return Children.IndexOf(item);
|
||||
}
|
||||
|
||||
public void Insert(int index, Tree<T> item)
|
||||
{
|
||||
Children.Insert(index, item);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
Children.RemoveAt(index);
|
||||
}
|
||||
|
||||
public Tree<T> this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Children[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
Children[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Tree<T> item)
|
||||
{
|
||||
Children.Add(item);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Children.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(Tree<T> item)
|
||||
{
|
||||
return Children.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(Tree<T>[] array, int arrayIndex)
|
||||
{
|
||||
Children.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Children.Count; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Remove(Tree<T> item)
|
||||
{
|
||||
return Children.Remove(item);
|
||||
}
|
||||
|
||||
public IEnumerator<Tree<T>> GetEnumerator()
|
||||
{
|
||||
return Children.GetEnumerator();
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
return Children.IndexOf(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
Children.Insert(index, new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
Children.Add(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
return Children.Contains(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
foreach (var node in Children)
|
||||
array[arrayIndex++] = node.Data;
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
return Children.Remove(new Tree<T>(item));
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
Tree<T> other = obj as Tree<T>;
|
||||
|
||||
// Types are different, so not equal
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
// Compare data
|
||||
if (!object.Equals(Data, other.Data))
|
||||
return false;
|
||||
|
||||
// Compare children array
|
||||
return Children.SequenceEqual(other.Children);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = ((Data == null) ? 0 : Data.GetHashCode());
|
||||
|
||||
foreach (var c in Children)
|
||||
hash = hash * 7 + c.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
55
RainmeterStudio/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 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")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RainmeterStudio")]
|
||||
[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)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// 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")]
|
63
RainmeterStudio/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RainmeterStudio.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// 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()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
RainmeterStudio/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
RainmeterStudio/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RainmeterStudio.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
RainmeterStudio/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
59
RainmeterStudio/Rainmeter.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Interop;
|
||||
|
||||
namespace RainmeterStudio
|
||||
{
|
||||
class Rainmeter
|
||||
{
|
||||
#region Imports
|
||||
|
||||
[DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr Rainmeter_Initialize();
|
||||
|
||||
[DllImport("Rainmeter.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void Rainmeter_Finalize(IntPtr handle);
|
||||
|
||||
#endregion
|
||||
|
||||
private static Rainmeter _instance = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the single instance of this class
|
||||
/// </summary>
|
||||
public static Rainmeter Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
_instance = new Rainmeter();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private IntPtr _handle;
|
||||
|
||||
#region Constructor, finalizer
|
||||
|
||||
private Rainmeter()
|
||||
{
|
||||
_handle = Rainmeter_Initialize();
|
||||
|
||||
if (_handle == IntPtr.Zero)
|
||||
throw new Exception("Failed to initialize native library.");
|
||||
}
|
||||
|
||||
~Rainmeter()
|
||||
{
|
||||
Rainmeter_Finalize(_handle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public IntPtr Handle { get { return _handle; } }
|
||||
}
|
||||
}
|
214
RainmeterStudio/RainmeterStudio.csproj
Normal file
@ -0,0 +1,214 @@
|
||||
<?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>{438D0136-4A27-4E4D-A617-FFACE4554236}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RainmeterStudio</RootNamespace>
|
||||
<AssemblyName>RainmeterEditor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\x32-Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="INIFileParser">
|
||||
<HintPath>..\packages\ini-parser.2.1.1\lib\INIFileParser.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Xceed.Wpf.AvalonDock">
|
||||
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero">
|
||||
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Expression">
|
||||
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Expression.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro">
|
||||
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010">
|
||||
<HintPath>..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Business\DocumentManager.cs" />
|
||||
<Compile Include="Business\ProjectManager.cs" />
|
||||
<Compile Include="Documents\Text\TextDocument.cs" />
|
||||
<Compile Include="Documents\Text\TextEditorControl.xaml.cs">
|
||||
<DependentUpon>TextEditorControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Documents\Text\TextStorage.cs" />
|
||||
<Compile Include="Model\DocumentFormat.cs" />
|
||||
<Compile Include="Model\IDocument.cs" />
|
||||
<Compile Include="Model\IDocumentEditor.cs" />
|
||||
<Compile Include="Model\IDocumentEditorFactory.cs" />
|
||||
<Compile Include="Documents\Ini\IniDocument.cs" />
|
||||
<Compile Include="Documents\Ini\IniSkinDesigner.cs" />
|
||||
<Compile Include="Documents\Ini\IniSkinDesignerControl.xaml.cs">
|
||||
<DependentUpon>IniSkinDesignerControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Documents\Ini\IniSkinDesignerFactory.cs" />
|
||||
<Compile Include="Documents\Text\TextEditor.cs" />
|
||||
<Compile Include="Documents\Text\TextEditorFactory.cs" />
|
||||
<Compile Include="Interop\NativeLibrary.cs" />
|
||||
<Compile Include="Model\Project.cs" />
|
||||
<Compile Include="Model\Property.cs" />
|
||||
<Compile Include="Model\RainmeterConfig.cs" />
|
||||
<Compile Include="Model\Reference.cs" />
|
||||
<Compile Include="Model\Tree.cs" />
|
||||
<Compile Include="Rainmeter.cs" />
|
||||
<Compile Include="Resources\Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\IDocumentStorage.cs" />
|
||||
<Compile Include="Storage\ProjectStorage.cs" />
|
||||
<Compile Include="Storage\SkinDirectory.cs" />
|
||||
<Compile Include="UI\Command.cs" />
|
||||
<Compile Include="UI\Dialogs\CreateDocumentDialog.xaml.cs">
|
||||
<DependentUpon>CreateDocumentDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controller\DocumentController.cs" />
|
||||
<Compile Include="Model\Events\DocumentOpenedEventArgs.cs" />
|
||||
<Compile Include="UI\SkinsPanel.xaml.cs">
|
||||
<DependentUpon>SkinsPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Documents\Ini\IniSkinDesignerControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Documents\Text\TextEditorControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI\Dialogs\CreateDocumentDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UI\SkinsPanel.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI\Styles\ButtonStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI\Styles\Common.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Strings.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="LICENSE" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\text_file_32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SplashScreen Include="Resources\splash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\arrow_left_16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\arrow_right_16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\arrow_backward_16.png" />
|
||||
<Resource Include="Resources\Icons\arrow_forward_16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\page_white_star_16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons\project_16.png" />
|
||||
<Resource Include="Resources\Icons\project_star_16.png" />
|
||||
</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>
|
BIN
RainmeterStudio/Resources/Icons/arrow_backward_16.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
RainmeterStudio/Resources/Icons/arrow_forward_16.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
RainmeterStudio/Resources/Icons/arrow_left_16.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
RainmeterStudio/Resources/Icons/arrow_right_16.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
RainmeterStudio/Resources/Icons/page_white_star_16.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
RainmeterStudio/Resources/Icons/project_16.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
RainmeterStudio/Resources/Icons/project_star_16.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
RainmeterStudio/Resources/Icons/text_file_32.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
117
RainmeterStudio/Resources/Strings.Designer.cs
generated
Normal file
@ -0,0 +1,117 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RainmeterStudio.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// 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()]
|
||||
internal 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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.Resources.Strings", typeof(Strings).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Utility.
|
||||
/// </summary>
|
||||
internal static string Category_Utility {
|
||||
get {
|
||||
return ResourceManager.GetString("Category_Utility", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _File....
|
||||
/// </summary>
|
||||
internal static string DocumentCreateCommand_DisplayText {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentCreateCommand_DisplayText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Creates a new file.
|
||||
/// </summary>
|
||||
internal static string DocumentCreateCommand_ToolTip {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentCreateCommand_ToolTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Text Editor.
|
||||
/// </summary>
|
||||
internal static string DocumentEditor_Text_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentEditor_Text_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Blank text file.
|
||||
/// </summary>
|
||||
internal static string DocumentFormat_TextFile_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentFormat_TextFile_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Text file.
|
||||
/// </summary>
|
||||
internal static string DocumentFormat_TextFile_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("DocumentFormat_TextFile_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
138
RainmeterStudio/Resources/Strings.resx
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Category_Utility" xml:space="preserve">
|
||||
<value>Utility</value>
|
||||
</data>
|
||||
<data name="DocumentCreateCommand_DisplayText" xml:space="preserve">
|
||||
<value>_File...</value>
|
||||
</data>
|
||||
<data name="DocumentCreateCommand_ToolTip" xml:space="preserve">
|
||||
<value>Creates a new file</value>
|
||||
</data>
|
||||
<data name="DocumentEditor_Text_Name" xml:space="preserve">
|
||||
<value>Text Editor</value>
|
||||
</data>
|
||||
<data name="DocumentFormat_TextFile_Description" xml:space="preserve">
|
||||
<value>Blank text file</value>
|
||||
</data>
|
||||
<data name="DocumentFormat_TextFile_Name" xml:space="preserve">
|
||||
<value>Text file</value>
|
||||
</data>
|
||||
</root>
|
BIN
RainmeterStudio/Resources/splash.png
Normal file
After Width: | Height: | Size: 317 KiB |
40
RainmeterStudio/Storage/ProjectStorage.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.Storage
|
||||
{
|
||||
public class ProjectStorage
|
||||
{
|
||||
public Project Load(string path)
|
||||
{
|
||||
// Open file
|
||||
var file = File.OpenText(path);
|
||||
|
||||
// Deserialize file
|
||||
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
||||
Project project = serializer.Deserialize(file) as Project;
|
||||
|
||||
// Clean up
|
||||
file.Close();
|
||||
return project;
|
||||
}
|
||||
|
||||
public void Save(string path, Project project)
|
||||
{
|
||||
// Open file
|
||||
var file = File.OpenWrite(path);
|
||||
|
||||
// Deserialize file
|
||||
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
||||
serializer.Serialize(file, project);
|
||||
|
||||
// Clean up
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
25
RainmeterStudio/Storage/SkinDirectory.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace RainmeterStudio.Storage
|
||||
{
|
||||
public static class SkinDirectory
|
||||
{
|
||||
private static string _path = null;
|
||||
|
||||
public static string Path
|
||||
{
|
||||
get
|
||||
{
|
||||
return "";
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
88
RainmeterStudio/UI/Command.cs
Normal file
@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace RainmeterStudio.UI
|
||||
{
|
||||
public class Command : ICommand
|
||||
{
|
||||
#region Private members
|
||||
|
||||
private Action<object> _execute;
|
||||
private Func<object, bool> _canExecute;
|
||||
private Action _executeNoParam;
|
||||
private Func<bool> _canExecuteNoParam;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
public string Name { get; set; }
|
||||
public string DisplayText { get; set; }
|
||||
public string Tooltip { get; set; }
|
||||
public ImageSource Icon { get; set; }
|
||||
public KeyGesture Shortcut { get; set; }
|
||||
|
||||
public string ShortcutText
|
||||
{
|
||||
get
|
||||
{
|
||||
string text = String.Empty;
|
||||
|
||||
if ((Shortcut.Modifiers & ModifierKeys.Windows) != 0)
|
||||
text += "Win+";
|
||||
|
||||
if ((Shortcut.Modifiers & ModifierKeys.Control) != 0)
|
||||
text += "Ctrl+";
|
||||
|
||||
if ((Shortcut.Modifiers & ModifierKeys.Alt) != 0)
|
||||
text += "Alt+";
|
||||
|
||||
if ((Shortcut.Modifiers & ModifierKeys.Shift) != 0)
|
||||
text += "Shift+";
|
||||
|
||||
text += Enum.GetName(typeof(Key), Shortcut.Key);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public Command(string name = null, Action<object> execute = null, Func<object, bool> canExecute = null)
|
||||
{
|
||||
Name = name;
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public Command(string name = null, Action execute = null, Func<bool> canExecute = null)
|
||||
{
|
||||
Name = name;
|
||||
_executeNoParam = execute;
|
||||
_canExecuteNoParam = canExecute;
|
||||
}
|
||||
|
||||
public virtual bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute != null)
|
||||
return _canExecute(parameter);
|
||||
else if (_canExecuteNoParam != null)
|
||||
return _canExecuteNoParam();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Execute(object parameter)
|
||||
{
|
||||
if (_execute != null)
|
||||
_execute(parameter);
|
||||
else if (_executeNoParam != null)
|
||||
_executeNoParam();
|
||||
}
|
||||
}
|
||||
}
|
77
RainmeterStudio/UI/Controller/DocumentController.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using RainmeterStudio.Business;
|
||||
using RainmeterStudio.UI.Dialogs;
|
||||
using RainmeterStudio.Model.Events;
|
||||
using RainmeterStudio.Model;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace RainmeterStudio.UI.Controller
|
||||
{
|
||||
public class DocumentController
|
||||
{
|
||||
#region Commands
|
||||
|
||||
public Command DocumentCreateCommand { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public event EventHandler<DocumentOpenedEventArgs> DocumentOpened
|
||||
{
|
||||
add
|
||||
{
|
||||
DocumentManager.Instance.DocumentOpened += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
DocumentManager.Instance.DocumentOpened -= value;
|
||||
}
|
||||
}
|
||||
public event EventHandler DocumentClosed;
|
||||
|
||||
public Window OwnerWindow { get; set; }
|
||||
|
||||
public DocumentController()
|
||||
{
|
||||
DocumentCreateCommand = new Command("DocumentCreateCommand", () => CreateWindow())
|
||||
{
|
||||
DisplayText = Resources.Strings.DocumentCreateCommand_DisplayText,
|
||||
Tooltip = Resources.Strings.DocumentCreateCommand_ToolTip,
|
||||
Icon = new BitmapImage(new Uri("/Resources/Icons/page_white_star_16.png", UriKind.RelativeOrAbsolute)),
|
||||
Shortcut = new KeyGesture(Key.N, ModifierKeys.Control)
|
||||
};
|
||||
}
|
||||
|
||||
public void CreateWindow(DocumentFormat defaultFormat = null, string defaultPath = "")
|
||||
{
|
||||
// Show dialog
|
||||
var dialog = new CreateDocumentDialog()
|
||||
{
|
||||
Owner = OwnerWindow,
|
||||
SelectedFormat = defaultFormat,
|
||||
SelectedPath = defaultPath
|
||||
};
|
||||
bool? res = dialog.ShowDialog();
|
||||
|
||||
if (!res.HasValue || !res.Value)
|
||||
return;
|
||||
|
||||
var format = dialog.SelectedFormat;
|
||||
var path = dialog.SelectedPath;
|
||||
|
||||
// Call manager
|
||||
DocumentManager.Instance.Create(format, path);
|
||||
}
|
||||
|
||||
public void Create(DocumentFormat format, string path)
|
||||
{
|
||||
// Call manager
|
||||
DocumentManager.Instance.Create(format, path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
64
RainmeterStudio/UI/Dialogs/CreateDocumentDialog.xaml
Normal file
@ -0,0 +1,64 @@
|
||||
<Window x:Class="RainmeterStudio.UI.Dialogs.CreateDocumentDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Create..." Height="250" Width="400"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
WindowStyle="ToolWindow" ShowInTaskbar="False">
|
||||
|
||||
<Grid Background="WhiteSmoke">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListView Name="listFormats" Grid.Row="0">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel>
|
||||
<Image DockPanel.Dock="Left" Source="{Binding Icon}"
|
||||
Width="32" Height="32" Margin="2"
|
||||
Stretch="Uniform" VerticalAlignment="Top" />
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Description}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock FontWeight="Bold" FontSize="13pt" Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ListView.GroupStyle>
|
||||
</ListView>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0">Path:</TextBlock>
|
||||
<TextBox Name="textPath" Grid.Row="0" Grid.Column="1"></TextBox>
|
||||
<Button Grid.Row="0" Grid.Column="2">...</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Name="buttonCreate" Click="buttonCreate_Click" IsDefault="True">Create</Button>
|
||||
<Button Name="buttonCancel" Click="buttonCancel_Click" IsCancel="True">Cancel</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
93
RainmeterStudio/UI/Dialogs/CreateDocumentDialog.xaml.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
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.Shapes;
|
||||
using RainmeterStudio.Business;
|
||||
using RainmeterStudio.Model;
|
||||
|
||||
namespace RainmeterStudio.UI.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CreateDocumentDialog.xaml
|
||||
/// </summary>
|
||||
public partial class CreateDocumentDialog : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected file format
|
||||
/// </summary>
|
||||
public DocumentFormat SelectedFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
return listFormats.SelectedItem as DocumentFormat;
|
||||
}
|
||||
set
|
||||
{
|
||||
listFormats.SelectedItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path
|
||||
/// </summary>
|
||||
public string SelectedPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return textPath.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
textPath.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of CreateDocumentDialog
|
||||
/// </summary>
|
||||
public CreateDocumentDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
PopulateFormats();
|
||||
Validate();
|
||||
}
|
||||
|
||||
private void PopulateFormats()
|
||||
{
|
||||
listFormats.ItemsSource = DocumentManager.Instance.DocumentFormats;
|
||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listFormats.ItemsSource);
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Validate()
|
||||
{
|
||||
bool res = true;
|
||||
res &= !String.IsNullOrWhiteSpace(textPath.Text);
|
||||
res &= (listFormats.SelectedItem != null);
|
||||
|
||||
buttonCreate.IsEnabled = res;
|
||||
}
|
||||
}
|
||||
}
|
116
RainmeterStudio/UI/MainWindow.xaml
Normal file
@ -0,0 +1,116 @@
|
||||
<Window x:Class="RainmeterStudio.UI.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="clr-namespace:RainmeterStudio.UI"
|
||||
xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
|
||||
xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
|
||||
Title="Rainmeter Studio" Height="350" Width="525"
|
||||
ResizeMode="CanResizeWithGrip" >
|
||||
|
||||
<Window.Resources>
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<!-- Menu bar -->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!-- Toolbar -->
|
||||
<RowDefinition />
|
||||
<!-- Dock area -->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!-- Status bar -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Menu bar -->
|
||||
<Menu Grid.Row="0" Grid.ColumnSpan="10">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_New">
|
||||
<MenuItem DataContext="{Binding DocumentCreateCommand}"
|
||||
Command="{Binding}" Header="{Binding DisplayText}" ToolTip="{Binding Tooltip}"
|
||||
InputGestureText="{Binding ShortcutText}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{Binding Icon}" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Project..." Command="{Binding DocumentCreateCommand}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="/Resources/Icons/project_star_16.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Open..." />
|
||||
<Separator />
|
||||
<MenuItem Header="_Close" />
|
||||
<MenuItem Header="E_xit" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Edit" />
|
||||
<MenuItem Header="_Help" />
|
||||
</Menu>
|
||||
|
||||
<!-- Toolbar -->
|
||||
<ToolBarTray Grid.Row="1">
|
||||
<ToolBar>
|
||||
<Button Name="buttonBackward" ToolTip="Navigate backward">
|
||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_backward_16.png" />
|
||||
</Button>
|
||||
<Button Name="buttonForward" ToolTip="Navigate forward">
|
||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_forward_16.png" />
|
||||
</Button>
|
||||
<Separator />
|
||||
<Button DataContext="{Binding DocumentCreateCommand}"
|
||||
Command="{Binding}" ToolTip="{Binding Tooltip}">
|
||||
<Image Source="{Binding Icon}" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
|
||||
<!-- Grid splitter -->
|
||||
<GridSplitter Grid.Row="2" Grid.Column="1"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<!-- Document panel -->
|
||||
<ad:DockingManager
|
||||
x:Name="dockingManager"
|
||||
Grid.Row="2">
|
||||
<adlayout:LayoutRoot>
|
||||
|
||||
<adlayout:LayoutRoot.LeftSide>
|
||||
<adlayout:LayoutAnchorSide>
|
||||
<adlayout:LayoutAnchorGroup>
|
||||
<adlayout:LayoutAnchorable Title="Toolbox" />
|
||||
</adlayout:LayoutAnchorGroup>
|
||||
</adlayout:LayoutAnchorSide>
|
||||
</adlayout:LayoutRoot.LeftSide>
|
||||
|
||||
<adlayout:LayoutPanel Orientation="Horizontal">
|
||||
<adlayout:LayoutDocumentPane x:Name="documentPane" />
|
||||
|
||||
<adlayout:LayoutAnchorablePaneGroup DockWidth="150" Orientation="Vertical">
|
||||
<adlayout:LayoutAnchorablePane>
|
||||
<adlayout:LayoutAnchorable Title="Skins">
|
||||
<ui:SkinsPanel />
|
||||
</adlayout:LayoutAnchorable>
|
||||
<adlayout:LayoutAnchorable Title="Outline" />
|
||||
</adlayout:LayoutAnchorablePane>
|
||||
<adlayout:LayoutAnchorablePane>
|
||||
<adlayout:LayoutAnchorable Title="Properties" />
|
||||
</adlayout:LayoutAnchorablePane>
|
||||
</adlayout:LayoutAnchorablePaneGroup>
|
||||
</adlayout:LayoutPanel>
|
||||
</adlayout:LayoutRoot>
|
||||
</ad:DockingManager>
|
||||
|
||||
<!-- Status bar -->
|
||||
<StatusBar Grid.Row="3" Grid.ColumnSpan="10">
|
||||
|
||||
<ProgressBar Name="statusProgress"
|
||||
Width="64" Height="8"
|
||||
IsIndeterminate="True"
|
||||
Visibility="Collapsed" />
|
||||
|
||||
<TextBlock Name="statusMessage">Ready</TextBlock>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
75
RainmeterStudio/UI/MainWindow.xaml.cs
Normal file
@ -0,0 +1,75 @@
|
||||
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;
|
||||
using RainmeterStudio.Model.Events;
|
||||
using RainmeterStudio.UI.Controller;
|
||||
using Xceed.Wpf.AvalonDock.Layout;
|
||||
|
||||
namespace RainmeterStudio.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private DocumentController documentController;
|
||||
|
||||
public Command DocumentCreateCommand { get { return documentController.DocumentCreateCommand; } }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DataContext = this;
|
||||
|
||||
documentController = new DocumentController();
|
||||
documentController.OwnerWindow = this;
|
||||
documentController.DocumentOpened += documentController_DocumentOpened;
|
||||
AddKeyBinding(documentController.DocumentCreateCommand);
|
||||
}
|
||||
|
||||
private void AddKeyBinding(Command c)
|
||||
{
|
||||
if (c.Shortcut != null)
|
||||
InputBindings.Add(new KeyBinding(c, c.Shortcut));
|
||||
}
|
||||
|
||||
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
||||
{
|
||||
// Spawn a new window
|
||||
LayoutDocument document = new LayoutDocument();
|
||||
document.Content = e.Editor.EditorUI;
|
||||
document.Title = e.Editor.Title;
|
||||
document.Closing += document_Closing;
|
||||
|
||||
documentPane.Children.Add(document);
|
||||
documentPane.SelectedContentIndex = documentPane.IndexOf(document);
|
||||
}
|
||||
|
||||
void document_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
switch (MessageBox.Show("Are you sure?", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
|
||||
{
|
||||
case MessageBoxResult.Yes:
|
||||
break;
|
||||
|
||||
case MessageBoxResult.No:
|
||||
break;
|
||||
|
||||
default:
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
RainmeterStudio/UI/SkinsPanel.xaml
Normal file
@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="RainmeterStudio.UI.SkinsPanel"
|
||||
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">
|
||||
<Grid>
|
||||
<TreeView>
|
||||
<TreeViewItem Header="Sample item">
|
||||
<TreeViewItem Header="Sample subitem" />
|
||||
</TreeViewItem>
|
||||
<TreeViewItem Header="Sample item 2" />
|
||||
</TreeView>
|
||||
</Grid>
|
||||
</UserControl>
|
31
RainmeterStudio/UI/SkinsPanel.xaml.cs
Normal file
@ -0,0 +1,31 @@
|
||||
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;
|
||||
using RainmeterStudio.Interop;
|
||||
using RainmeterStudio.Storage;
|
||||
|
||||
namespace RainmeterStudio.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SkinsPanel.xaml
|
||||
/// </summary>
|
||||
public partial class SkinsPanel : UserControl
|
||||
{
|
||||
public SkinsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//var x = Rainmeter.Instance.Handle;
|
||||
}
|
||||
}
|
||||
}
|
55
RainmeterStudio/UI/Styles/ButtonStyle.xaml
Normal file
@ -0,0 +1,55 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Margin" Value="1" />
|
||||
<Setter Property="Padding" Value="6,1,6,1" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Name="_border"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
CornerRadius="2"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#eeee" Offset="0" />
|
||||
<GradientStop Color="#cccc" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<ContentPresenter Name="_content" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="_border" Property="Background" >
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#eeee" Offset="0" />
|
||||
<GradientStop Color="#dddd" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="_border" Property="Background" >
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#dddd" Offset="0" />
|
||||
<GradientStop Color="#bbbb" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="_content" Property="Opacity" Value=".5" />
|
||||
</Trigger>
|
||||
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
6
RainmeterStudio/UI/Styles/Common.xaml
Normal file
@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ButtonStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
3
RainmeterStudio/app.config
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
5
RainmeterStudio/packages.config
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AvalonDock" version="2.0.2000" targetFramework="net40" />
|
||||
<package id="ini-parser" version="2.1.1" targetFramework="net40" />
|
||||
</packages>
|