Work on project manager and project panel
@ -8,6 +8,39 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="UI/Styles/Common.xaml" />
|
<ResourceDictionary Source="UI/Styles/Common.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<Style TargetType="ToolBar">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="ToolBarTray">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CommandMenuItemStyle" TargetType="MenuItem">
|
||||||
|
<Setter Property="Command" Value="{Binding}" />
|
||||||
|
<Setter Property="Header" Value="{Binding DisplayText}" />
|
||||||
|
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||||
|
<Setter Property="InputGestureText" Value="{Binding ShortcutText}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CommandButtonStyle" TargetType="ButtonBase">
|
||||||
|
<Setter Property="Command" Value="{Binding}" />
|
||||||
|
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Opacity" Value=".5" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CommandAutoHideButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource CommandButtonStyle}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using RainmeterStudio.Model;
|
using RainmeterStudio.Model;
|
||||||
@ -16,11 +17,6 @@ namespace RainmeterStudio.Business
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Project ActiveProject { get; protected set; }
|
public Project ActiveProject { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the currently opened project's path
|
|
||||||
/// </summary>
|
|
||||||
public string ActiveProjectPath { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the project storage
|
/// Gets or sets the project storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -61,9 +57,10 @@ namespace RainmeterStudio.Business
|
|||||||
// Create project object
|
// Create project object
|
||||||
ActiveProject = new Project();
|
ActiveProject = new Project();
|
||||||
ActiveProject.Name = name;
|
ActiveProject.Name = name;
|
||||||
|
ActiveProject.Path = path;
|
||||||
|
|
||||||
// Save to file
|
// Save to file
|
||||||
ActiveProjectPath = path;
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
SaveActiveProject();
|
SaveActiveProject();
|
||||||
|
|
||||||
// Raise event
|
// Raise event
|
||||||
@ -83,7 +80,7 @@ namespace RainmeterStudio.Business
|
|||||||
|
|
||||||
// Open using storage
|
// Open using storage
|
||||||
ActiveProject = Storage.Load(path);
|
ActiveProject = Storage.Load(path);
|
||||||
ActiveProjectPath = path;
|
ActiveProject.Path = path;
|
||||||
|
|
||||||
// Raise event
|
// Raise event
|
||||||
if (ActiveProjectChanged != null)
|
if (ActiveProjectChanged != null)
|
||||||
@ -100,7 +97,7 @@ namespace RainmeterStudio.Business
|
|||||||
throw new InvalidOperationException("Cannot save a project that is not opened.");
|
throw new InvalidOperationException("Cannot save a project that is not opened.");
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
Storage.Save(ActiveProjectPath, ActiveProject);
|
Storage.Save(ActiveProject.Path, ActiveProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -109,7 +106,6 @@ namespace RainmeterStudio.Business
|
|||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
ActiveProject = null;
|
ActiveProject = null;
|
||||||
ActiveProjectPath = null;
|
|
||||||
|
|
||||||
// Raise event
|
// Raise event
|
||||||
if (ActiveProjectChanged != null)
|
if (ActiveProjectChanged != null)
|
||||||
|
@ -29,7 +29,7 @@ namespace RainmeterStudio.Documents.Text
|
|||||||
Category = Resources.Strings.Category_Utility,
|
Category = Resources.Strings.Category_Utility,
|
||||||
DefaultExtension = ".txt",
|
DefaultExtension = ".txt",
|
||||||
Description = Resources.Strings.DocumentFormat_TextFile_Description,
|
Description = Resources.Strings.DocumentFormat_TextFile_Description,
|
||||||
Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Resources/Icons/text_file_32.png", UriKind.RelativeOrAbsolute)),
|
Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri(Resources.Icons.DocumentTemplate_Text, UriKind.RelativeOrAbsolute)),
|
||||||
Factory = this
|
Factory = this
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,82 @@ using System.Xml.Serialization;
|
|||||||
|
|
||||||
namespace RainmeterStudio.Model
|
namespace RainmeterStudio.Model
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a Rainmeter Studio project
|
||||||
|
/// </summary>
|
||||||
public class Project
|
public class Project
|
||||||
{
|
{
|
||||||
[XmlElement("name")]
|
#region Name property
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
|
private string _name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the project
|
||||||
|
/// </summary>
|
||||||
|
[XmlElement("name")]
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_name = value;
|
||||||
|
|
||||||
|
if (Root != null)
|
||||||
|
Root.Data = new Reference(Name, Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _path;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Path property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the file path of this project
|
||||||
|
/// </summary>
|
||||||
|
[XmlIgnore]
|
||||||
|
public string Path
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _path;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_path = value;
|
||||||
|
|
||||||
|
if (Root != null)
|
||||||
|
Root.Data = new Reference(Name, Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Author property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the author of the project
|
||||||
|
/// </summary>
|
||||||
[XmlElement("author")]
|
[XmlElement("author")]
|
||||||
public string Author { get; set; }
|
public string Author { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Version property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the version of the project
|
||||||
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Version Version { get; set; }
|
public Version Version { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the string representation of the project version
|
||||||
|
/// </summary>
|
||||||
[XmlElement("version")]
|
[XmlElement("version")]
|
||||||
public string VersionString
|
public string VersionString
|
||||||
{
|
{
|
||||||
@ -30,15 +95,39 @@ namespace RainmeterStudio.Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Auto-load file property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the reference to the file to automatically load at package installation
|
||||||
|
/// </summary>
|
||||||
[XmlElement("autoLoadFile")]
|
[XmlElement("autoLoadFile")]
|
||||||
public Reference AutoLoadFile { get; set; }
|
public Reference AutoLoadFile { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Variable files property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the list of variable files
|
||||||
|
/// </summary>
|
||||||
[XmlArray("variableFiles")]
|
[XmlArray("variableFiles")]
|
||||||
public List<Reference> VariableFiles { get; set; }
|
public List<Reference> VariableFiles { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Minimum rainmeter & windows properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum rainmeter version
|
||||||
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Version MinimumRainmeter { get; set; }
|
public Version MinimumRainmeter { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the string representation of the minimum rainmeter version
|
||||||
|
/// </summary>
|
||||||
[XmlElement("minimumRainmeter")]
|
[XmlElement("minimumRainmeter")]
|
||||||
public string MinimumRainmeterString
|
public string MinimumRainmeterString
|
||||||
{
|
{
|
||||||
@ -52,9 +141,15 @@ namespace RainmeterStudio.Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum Windows version
|
||||||
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Version MinimumWindows { get; set; }
|
public Version MinimumWindows { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the string representation of the minimum Windows version
|
||||||
|
/// </summary>
|
||||||
[XmlElement("minimumWindows")]
|
[XmlElement("minimumWindows")]
|
||||||
public string MinimumWindowsString
|
public string MinimumWindowsString
|
||||||
{
|
{
|
||||||
@ -68,9 +163,23 @@ namespace RainmeterStudio.Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Root property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the root node
|
||||||
|
/// </summary>
|
||||||
[XmlElement("root")]
|
[XmlElement("root")]
|
||||||
public Tree<Reference> Root { get; set; }
|
public Tree<Reference> Root { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a project
|
||||||
|
/// </summary>
|
||||||
public Project()
|
public Project()
|
||||||
{
|
{
|
||||||
Root = new Tree<Reference>();
|
Root = new Tree<Reference>();
|
||||||
@ -80,6 +189,10 @@ namespace RainmeterStudio.Model
|
|||||||
MinimumWindows = new Version("5.1");
|
MinimumWindows = new Version("5.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Equals
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
Project other = obj as Project;
|
Project other = obj as Project;
|
||||||
@ -110,5 +223,7 @@ namespace RainmeterStudio.Model
|
|||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
@ -12,17 +13,17 @@ namespace RainmeterStudio.Model
|
|||||||
public T Data { get; set; }
|
public T Data { get; set; }
|
||||||
|
|
||||||
[XmlArray("children"), XmlArrayItem("child")]
|
[XmlArray("children"), XmlArrayItem("child")]
|
||||||
public List<Tree<T>> Children { get; set; }
|
public ObservableCollection<Tree<T>> Children { get; set; }
|
||||||
|
|
||||||
public Tree()
|
public Tree()
|
||||||
{
|
{
|
||||||
Children = new List<Tree<T>>();
|
Children = new ObservableCollection<Tree<T>>();
|
||||||
Data = default(T);
|
Data = default(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tree(T data)
|
public Tree(T data)
|
||||||
{
|
{
|
||||||
Children = new List<Tree<T>>();
|
Children = new ObservableCollection<Tree<T>>();
|
||||||
Data = data;
|
Data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<Compile Include="Storage\ProjectStorage.cs" />
|
<Compile Include="Storage\ProjectStorage.cs" />
|
||||||
<Compile Include="Storage\SkinDirectory.cs" />
|
<Compile Include="Storage\SkinDirectory.cs" />
|
||||||
<Compile Include="UI\Command.cs" />
|
<Compile Include="UI\Command.cs" />
|
||||||
|
<Compile Include="UI\Controller\IconProvider.cs" />
|
||||||
<Compile Include="UI\Controller\ProjectController.cs" />
|
<Compile Include="UI\Controller\ProjectController.cs" />
|
||||||
<Compile Include="UI\Dialogs\CreateDocumentDialog.xaml.cs">
|
<Compile Include="UI\Dialogs\CreateDocumentDialog.xaml.cs">
|
||||||
<DependentUpon>CreateDocumentDialog.xaml</DependentUpon>
|
<DependentUpon>CreateDocumentDialog.xaml</DependentUpon>
|
||||||
@ -119,9 +120,10 @@
|
|||||||
<Compile Include="UI\Dialogs\CreateProjectDialog.xaml.cs">
|
<Compile Include="UI\Dialogs\CreateProjectDialog.xaml.cs">
|
||||||
<DependentUpon>CreateProjectDialog.xaml</DependentUpon>
|
<DependentUpon>CreateProjectDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UI\SkinsPanel.xaml.cs">
|
<Compile Include="UI\ProjectPanel.xaml.cs">
|
||||||
<DependentUpon>SkinsPanel.xaml</DependentUpon>
|
<DependentUpon>ProjectPanel.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Utils\DirectoryHelper.cs" />
|
||||||
<Page Include="Documents\Ini\IniSkinDesignerControl.xaml">
|
<Page Include="Documents\Ini\IniSkinDesignerControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -150,7 +152,7 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="UI\SkinsPanel.xaml">
|
<Page Include="UI\ProjectPanel.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@ -199,27 +201,52 @@
|
|||||||
<AppDesigner Include="Properties\" />
|
<AppDesigner Include="Properties\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\text_file_32.png" />
|
<Resource Include="Resources\Icons\32\text_generic.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SplashScreen Include="Resources\splash.png" />
|
<SplashScreen Include="Resources\splash.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\arrow_left_16.png" />
|
<Resource Include="Resources\Icons\16\arrow_left.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\arrow_right_16.png" />
|
<Resource Include="Resources\Icons\16\arrow_right.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\arrow_backward_16.png" />
|
<Resource Include="Resources\Icons\16\arrow_backward.png" />
|
||||||
<Resource Include="Resources\Icons\arrow_forward_16.png" />
|
<Resource Include="Resources\Icons\16\arrow_forward.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\page_white_star_16.png" />
|
<Resource Include="Resources\Icons\16\page_white_star.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Icons\project_16.png" />
|
<Resource Include="Resources\Icons\16\project.png" />
|
||||||
<Resource Include="Resources\Icons\project_star_16.png" />
|
<Resource Include="Resources\Icons\16\project_star.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\page_white_delete.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\folder.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\text_generic.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\file_generic.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\arrow_refresh_small.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\plus.png" />
|
||||||
|
<Resource Include="Resources\Icons\16\minus.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\folder_explore.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Icons\16\view-refresh.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
111
RainmeterStudio/Resources/Icons.Designer.cs
generated
@ -61,20 +61,119 @@ namespace RainmeterStudio.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to /Resources/Icons/page_white_star_16.png.
|
/// Looks up a localized string similar to /Resources/Icons/16/page_white_star.png.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string DocumentCreateCommand_Icon {
|
internal static string DocumentCreateCommand {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("DocumentCreateCommand_Icon", resourceCulture);
|
return ResourceManager.GetString("DocumentCreateCommand", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to /Resources/Icons/project_star_16.png.
|
/// Looks up a localized string similar to /Resources/Icons/32/text_generic.png.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string ProjectCreateCommand_Icon {
|
internal static string DocumentTemplate_Text {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ProjectCreateCommand_Icon", resourceCulture);
|
return ResourceManager.GetString("DocumentTemplate_Text", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/project_star.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectCreateCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectCreateCommand", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/project.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectItem_rsproj {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectItem_rsproj", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/text_generic.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectItem_txt {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectItem_txt", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/folder.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectItemFolder {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectItemFolder", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/page_white_delete.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectItemNone {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectItemNone", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/file_generic.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectItemUnknown {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectItemUnknown", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/minus.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectPanel_CollapseAllCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/plus.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectPanel_ExpandAllCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/view-refresh.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectPanel_RefreshCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_RefreshCommand", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/folder_explore.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectPanel_ShowAllFilesCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to /Resources/Icons/16/arrow_refresh_small.png.
|
||||||
|
/// </summary>
|
||||||
|
internal static string ProjectPanel_SyncWithActiveViewCommand {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,10 +117,43 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="DocumentCreateCommand_Icon" xml:space="preserve">
|
<data name="DocumentCreateCommand" xml:space="preserve">
|
||||||
<value>/Resources/Icons/page_white_star_16.png</value>
|
<value>/Resources/Icons/16/page_white_star.png</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ProjectCreateCommand_Icon" xml:space="preserve">
|
<data name="DocumentTemplate_Text" xml:space="preserve">
|
||||||
<value>/Resources/Icons/project_star_16.png</value>
|
<value>/Resources/Icons/32/text_generic.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectCreateCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/project_star.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectItemFolder" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/folder.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectItemNone" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/page_white_delete.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectItemUnknown" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/file_generic.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectItem_rsproj" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/project.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectItem_txt" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/text_generic.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_CollapseAllCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/minus.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ExpandAllCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/plus.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_RefreshCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/view-refresh.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ShowAllFilesCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/folder_explore.png</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_SyncWithActiveViewCommand" xml:space="preserve">
|
||||||
|
<value>/Resources/Icons/16/arrow_refresh_small.png</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 345 B |
BIN
RainmeterStudio/Resources/Icons/16/arrow_refresh_small.png
Normal file
After Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
BIN
RainmeterStudio/Resources/Icons/16/file_generic.png
Normal file
After Width: | Height: | Size: 741 B |
BIN
RainmeterStudio/Resources/Icons/16/folder.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
RainmeterStudio/Resources/Icons/16/folder_explore.png
Normal file
After Width: | Height: | Size: 679 B |
BIN
RainmeterStudio/Resources/Icons/16/minus.png
Normal file
After Width: | Height: | Size: 596 B |
BIN
RainmeterStudio/Resources/Icons/16/page_white_delete.png
Normal file
After Width: | Height: | Size: 536 B |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
BIN
RainmeterStudio/Resources/Icons/16/plus.png
Normal file
After Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 742 B |
BIN
RainmeterStudio/Resources/Icons/16/text_generic.png
Normal file
After Width: | Height: | Size: 778 B |
BIN
RainmeterStudio/Resources/Icons/16/view-refresh.png
Normal file
After Width: | Height: | Size: 922 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
90
RainmeterStudio/Resources/Strings.Designer.cs
generated
@ -221,5 +221,95 @@ namespace RainmeterStudio.Resources {
|
|||||||
return ResourceManager.GetString("ProjectCreateDialog_Title", resourceCulture);
|
return ResourceManager.GetString("ProjectCreateDialog_Title", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Collapse all.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_CollapseAllCommand_DisplayText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand_DisplayText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Collapse all.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_CollapseAllCommand_ToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand_ToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Expand all.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_ExpandAllCommand_DisplayText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand_DisplayText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Expand all.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_ExpandAllCommand_ToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand_ToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Refresh.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_RefreshCommand_DisplayText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_RefreshCommand_DisplayText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Refresh.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_RefreshCommand_ToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_RefreshCommand_ToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Show all files.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_ShowAllFilesCommand_DisplayText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand_DisplayText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Show all files.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_ShowAllFilesCommand_ToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand_ToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Sync with active view.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_SyncWithActiveViewCommand_DisplayText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand_DisplayText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Sync with active view.
|
||||||
|
/// </summary>
|
||||||
|
public static string ProjectPanel_SyncWithActiveViewCommand_ToolTip {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand_ToolTip", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,4 +171,34 @@
|
|||||||
<data name="ProjectCreateDialog_Title" xml:space="preserve">
|
<data name="ProjectCreateDialog_Title" xml:space="preserve">
|
||||||
<value>Create project</value>
|
<value>Create project</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ProjectPanel_CollapseAllCommand_DisplayText" xml:space="preserve">
|
||||||
|
<value>Collapse all</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_CollapseAllCommand_ToolTip" xml:space="preserve">
|
||||||
|
<value>Collapse all</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ExpandAllCommand_DisplayText" xml:space="preserve">
|
||||||
|
<value>Expand all</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ExpandAllCommand_ToolTip" xml:space="preserve">
|
||||||
|
<value>Expand all</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_RefreshCommand_DisplayText" xml:space="preserve">
|
||||||
|
<value>Refresh</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_RefreshCommand_ToolTip" xml:space="preserve">
|
||||||
|
<value>Refresh</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ShowAllFilesCommand_DisplayText" xml:space="preserve">
|
||||||
|
<value>Show all files</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_ShowAllFilesCommand_ToolTip" xml:space="preserve">
|
||||||
|
<value>Show all files</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_SyncWithActiveViewCommand_DisplayText" xml:space="preserve">
|
||||||
|
<value>Sync with active view</value>
|
||||||
|
</data>
|
||||||
|
<data name="ProjectPanel_SyncWithActiveViewCommand_ToolTip" xml:space="preserve">
|
||||||
|
<value>Sync with active view</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -18,6 +18,8 @@ namespace RainmeterStudio.Storage
|
|||||||
// Deserialize file
|
// Deserialize file
|
||||||
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
||||||
Project project = serializer.Deserialize(file) as Project;
|
Project project = serializer.Deserialize(file) as Project;
|
||||||
|
if (project != null)
|
||||||
|
project.Path = path;
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
file.Close();
|
file.Close();
|
||||||
@ -29,12 +31,13 @@ namespace RainmeterStudio.Storage
|
|||||||
// Open file
|
// Open file
|
||||||
var file = File.OpenWrite(path);
|
var file = File.OpenWrite(path);
|
||||||
|
|
||||||
// Deserialize file
|
// Serialize file
|
||||||
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
var serializer = new XmlSerializer(typeof(Project), new XmlRootAttribute("project"));
|
||||||
serializer.Serialize(file, project);
|
serializer.Serialize(file, project);
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
file.Close();
|
file.Close();
|
||||||
|
project.Path = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using RainmeterStudio.UI.Controller;
|
||||||
|
|
||||||
namespace RainmeterStudio.UI
|
namespace RainmeterStudio.UI
|
||||||
{
|
{
|
||||||
@ -20,18 +21,97 @@ namespace RainmeterStudio.UI
|
|||||||
|
|
||||||
#region Public properties
|
#region Public properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the command
|
||||||
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string DisplayText { get; set; }
|
|
||||||
public string Tooltip { get; set; }
|
#region Display text property
|
||||||
public ImageSource Icon { get; set; }
|
private string _displayText = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display text of the command
|
||||||
|
/// </summary>
|
||||||
|
public string DisplayText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_displayText == null)
|
||||||
|
return Resources.Strings.ResourceManager.GetString(Name + "_DisplayText");
|
||||||
|
|
||||||
|
return _displayText;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_displayText = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ToolTip property
|
||||||
|
private string _toolTip = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the tooltip
|
||||||
|
/// </summary>
|
||||||
|
public string ToolTip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_toolTip == null)
|
||||||
|
return Resources.Strings.ResourceManager.GetString(Name + "_ToolTip");
|
||||||
|
|
||||||
|
return _toolTip;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_toolTip = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Icon property
|
||||||
|
private ImageSource _icon = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the command's icon
|
||||||
|
/// </summary>
|
||||||
|
public ImageSource Icon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_icon == null)
|
||||||
|
return IconProvider.GetIcon(Name);
|
||||||
|
|
||||||
|
return _icon;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_icon = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Keyboard shortcut property
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the keyboard shortcut of this command
|
||||||
|
/// </summary>
|
||||||
public KeyGesture Shortcut { get; set; }
|
public KeyGesture Shortcut { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the text representation of the keyboard shortcut
|
||||||
|
/// </summary>
|
||||||
public string ShortcutText
|
public string ShortcutText
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string text = String.Empty;
|
string text = String.Empty;
|
||||||
|
|
||||||
|
if (Shortcut == null)
|
||||||
|
return text;
|
||||||
|
|
||||||
if ((Shortcut.Modifiers & ModifierKeys.Windows) != 0)
|
if ((Shortcut.Modifiers & ModifierKeys.Windows) != 0)
|
||||||
text += "Win+";
|
text += "Win+";
|
||||||
|
|
||||||
@ -51,22 +131,45 @@ namespace RainmeterStudio.UI
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#pragma warning disable 67
|
||||||
|
|
||||||
public event EventHandler CanExecuteChanged;
|
public event EventHandler CanExecuteChanged;
|
||||||
|
|
||||||
public Command(string name = null, Action<object> execute = null, Func<object, bool> canExecute = null)
|
#pragma warning restore 67
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes this command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the command</param>
|
||||||
|
/// <param name="execute">Callback function to execute when the command is triggered</param>
|
||||||
|
/// <param name="canExecute">Function that can be queried if the command can execute</param>
|
||||||
|
public Command(string name, Action<object> execute, Func<object, bool> canExecute = null)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
_execute = execute;
|
_execute = execute;
|
||||||
_canExecute = canExecute;
|
_canExecute = canExecute;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command(string name = null, Action execute = null, Func<bool> canExecute = null)
|
/// <summary>
|
||||||
|
/// Initializes this command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the command</param>
|
||||||
|
/// <param name="execute">Callback function to execute when the command is triggered</param>
|
||||||
|
/// <param name="canExecute">Function that can be queried if the command can execute</param>
|
||||||
|
public Command(string name, Action execute, Func<bool> canExecute = null)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
_executeNoParam = execute;
|
_executeNoParam = execute;
|
||||||
_canExecuteNoParam = canExecute;
|
_canExecuteNoParam = canExecute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function that can be queried if the command can be executed
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter">Command parameter</param>
|
||||||
|
/// <returns>True if the function can be executed</returns>
|
||||||
public virtual bool CanExecute(object parameter)
|
public virtual bool CanExecute(object parameter)
|
||||||
{
|
{
|
||||||
if (_canExecute != null)
|
if (_canExecute != null)
|
||||||
@ -77,6 +180,10 @@ namespace RainmeterStudio.UI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Executes the command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter">Command parameter</param>
|
||||||
public virtual void Execute(object parameter)
|
public virtual void Execute(object parameter)
|
||||||
{
|
{
|
||||||
if (_execute != null)
|
if (_execute != null)
|
||||||
@ -85,4 +192,18 @@ namespace RainmeterStudio.UI
|
|||||||
_executeNoParam();
|
_executeNoParam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class UIElementExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a keyboard shortcut to an UI element
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uiElement">UI element</param>
|
||||||
|
/// <param name="command">Command</param>
|
||||||
|
public static void AddKeyBinding(this System.Windows.UIElement uiElement, Command command)
|
||||||
|
{
|
||||||
|
if (command.Shortcut != null)
|
||||||
|
uiElement.InputBindings.Add(new KeyBinding(command, command.Shortcut));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,6 @@ namespace RainmeterStudio.UI.Controller
|
|||||||
{
|
{
|
||||||
_documentCreateCommand = new Command("DocumentCreateCommand", () => CreateWindow())
|
_documentCreateCommand = new Command("DocumentCreateCommand", () => CreateWindow())
|
||||||
{
|
{
|
||||||
DisplayText = Resources.Strings.DocumentCreateCommand_DisplayText,
|
|
||||||
Tooltip = Resources.Strings.DocumentCreateCommand_ToolTip,
|
|
||||||
Icon = new BitmapImage(new Uri(Resources.Icons.DocumentCreateCommand_Icon, UriKind.RelativeOrAbsolute)),
|
|
||||||
Shortcut = new KeyGesture(Key.N, ModifierKeys.Control)
|
Shortcut = new KeyGesture(Key.N, ModifierKeys.Control)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
72
RainmeterStudio/UI/Controller/IconProvider.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using RainmeterStudio.Model;
|
||||||
|
|
||||||
|
namespace RainmeterStudio.UI.Controller
|
||||||
|
{
|
||||||
|
public static class IconProvider
|
||||||
|
{
|
||||||
|
private static Dictionary<string, ImageSource> _loadedImages = new Dictionary<string, ImageSource>();
|
||||||
|
|
||||||
|
public static ImageSource GetIcon(string key)
|
||||||
|
{
|
||||||
|
if (!_loadedImages.ContainsKey(key))
|
||||||
|
{
|
||||||
|
// Try to get the icon file name
|
||||||
|
string iconPath = Resources.Icons.ResourceManager.GetString(key);
|
||||||
|
if (iconPath == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Load the image
|
||||||
|
var uri = new Uri(iconPath, UriKind.RelativeOrAbsolute);
|
||||||
|
_loadedImages.Add(key, new BitmapImage(uri));
|
||||||
|
}
|
||||||
|
return _loadedImages[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageSource GetProjectItemIcon(Reference item)
|
||||||
|
{
|
||||||
|
// Resource name
|
||||||
|
string key = "ProjectItem";
|
||||||
|
|
||||||
|
if (Directory.Exists(item.Path))
|
||||||
|
key += "Directory";
|
||||||
|
|
||||||
|
else if (File.Exists(item.Path))
|
||||||
|
key += "_" + Path.GetExtension(item.Path).Substring(1);
|
||||||
|
|
||||||
|
else key += "None";
|
||||||
|
|
||||||
|
// Get icon
|
||||||
|
var icon = GetIcon(key);
|
||||||
|
if (icon == null)
|
||||||
|
return GetIcon("ProjectItemUnknown");
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IconProviderConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
var tree = value as Tree<Reference>;
|
||||||
|
if (tree != null)
|
||||||
|
{
|
||||||
|
return IconProvider.GetProjectItemIcon(tree.Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -44,7 +44,7 @@ namespace RainmeterStudio.UI.Controller
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Manager.ActiveProjectPath;
|
return Manager.ActiveProject.Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +78,8 @@ namespace RainmeterStudio.UI.Controller
|
|||||||
{
|
{
|
||||||
if (_projectCreateCommand == null)
|
if (_projectCreateCommand == null)
|
||||||
{
|
{
|
||||||
_projectCreateCommand = new Command("ProjectCreateComand", () => CreateProject())
|
_projectCreateCommand = new Command("ProjectCreateCommand", () => CreateProject())
|
||||||
{
|
{
|
||||||
DisplayText = Resources.Strings.ProjectCreateCommand_DisplayText,
|
|
||||||
Tooltip = Resources.Strings.ProjectCreateCommand_ToolTip,
|
|
||||||
Icon = new BitmapImage(new Uri(Resources.Icons.ProjectCreateCommand_Icon, UriKind.RelativeOrAbsolute)),
|
|
||||||
Shortcut = new KeyGesture(Key.N, ModifierKeys.Control | ModifierKeys.Shift)
|
Shortcut = new KeyGesture(Key.N, ModifierKeys.Control | ModifierKeys.Shift)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -123,10 +120,11 @@ namespace RainmeterStudio.UI.Controller
|
|||||||
if (!res.HasValue || !res.Value)
|
if (!res.HasValue || !res.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
string selectedName = dialog.SelectedName;
|
||||||
string selectedPath = dialog.SelectedPath;
|
string selectedPath = dialog.SelectedPath;
|
||||||
|
|
||||||
// Call manager
|
// Call manager
|
||||||
Manager.CreateProject(name, selectedPath); // TODO
|
Manager.CreateProject(selectedName, selectedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -125,10 +125,15 @@ namespace RainmeterStudio.UI.Dialogs
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Add event handlers
|
||||||
textLocation.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(textLocation_TextChanged));
|
textLocation.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(textLocation_TextChanged));
|
||||||
textPath.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(textPath_TextChanged));
|
textPath.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(textPath_TextChanged));
|
||||||
|
|
||||||
|
// Set data context
|
||||||
DataContext = this;
|
DataContext = this;
|
||||||
|
|
||||||
|
// Focus on name textbox
|
||||||
|
textName.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Create()
|
private void Create()
|
||||||
|
@ -4,29 +4,9 @@
|
|||||||
xmlns:ui="clr-namespace:RainmeterStudio.UI"
|
xmlns:ui="clr-namespace:RainmeterStudio.UI"
|
||||||
xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
|
xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
|
||||||
xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
|
xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
|
||||||
Title="Rainmeter Studio" Height="350" Width="525"
|
Title="Rainmeter Studio" Height="600" Width="800"
|
||||||
ResizeMode="CanResizeWithGrip" >
|
ResizeMode="CanResizeWithGrip" >
|
||||||
|
|
||||||
<Window.Resources>
|
|
||||||
<Style x:Key="CommandMenuItemStyle" TargetType="MenuItem">
|
|
||||||
<Setter Property="Command" Value="{Binding}" />
|
|
||||||
<Setter Property="Header" Value="{Binding DisplayText}" />
|
|
||||||
<Setter Property="ToolTip" Value="{Binding Tooltip}" />
|
|
||||||
<Setter Property="InputGestureText" Value="{Binding ShortcutText}" />
|
|
||||||
</Style>
|
|
||||||
<Style x:Key="CommandButtonStyle" TargetType="Button">
|
|
||||||
<Setter Property="Command" Value="{Binding}" />
|
|
||||||
<Setter Property="ToolTip" Value="{Binding Tooltip}" />
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -70,14 +50,16 @@
|
|||||||
<ToolBarTray Grid.Row="1">
|
<ToolBarTray Grid.Row="1">
|
||||||
<ToolBar>
|
<ToolBar>
|
||||||
<Button Name="buttonBackward" ToolTip="Navigate backward">
|
<Button Name="buttonBackward" ToolTip="Navigate backward">
|
||||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_backward_16.png" />
|
<Image Width="16" Height="16" Source="/Resources/Icons/16/arrow_backward.png" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button Name="buttonForward" ToolTip="Navigate forward">
|
<Button Name="buttonForward" ToolTip="Navigate forward">
|
||||||
<Image Width="16" Height="16" Source="/Resources/Icons/arrow_forward_16.png" />
|
<Image Width="16" Height="16" Source="/Resources/Icons/16/arrow_forward.png" />
|
||||||
</Button>
|
</Button>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Button DataContext="{Binding DocumentController.DocumentCreateCommand}"
|
<Button DataContext="{Binding DocumentController.DocumentCreateCommand}"
|
||||||
Style="{StaticResource CommandButtonStyle}" />
|
Style="{StaticResource CommandButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
|
|
||||||
@ -102,10 +84,10 @@
|
|||||||
<adlayout:LayoutPanel Orientation="Horizontal">
|
<adlayout:LayoutPanel Orientation="Horizontal">
|
||||||
<adlayout:LayoutDocumentPane x:Name="documentPane" />
|
<adlayout:LayoutDocumentPane x:Name="documentPane" />
|
||||||
|
|
||||||
<adlayout:LayoutAnchorablePaneGroup DockWidth="150" Orientation="Vertical">
|
<adlayout:LayoutAnchorablePaneGroup DockWidth="250" Orientation="Vertical">
|
||||||
<adlayout:LayoutAnchorablePane>
|
<adlayout:LayoutAnchorablePane>
|
||||||
<adlayout:LayoutAnchorable Title="Skins">
|
<adlayout:LayoutAnchorable Title="Project">
|
||||||
<ui:SkinsPanel />
|
<ui:ProjectPanel x:Name="projectPanel" />
|
||||||
</adlayout:LayoutAnchorable>
|
</adlayout:LayoutAnchorable>
|
||||||
<adlayout:LayoutAnchorable Title="Outline" />
|
<adlayout:LayoutAnchorable Title="Outline" />
|
||||||
</adlayout:LayoutAnchorablePane>
|
</adlayout:LayoutAnchorablePane>
|
||||||
|
@ -39,19 +39,16 @@ namespace RainmeterStudio.UI
|
|||||||
ProjectManager projectManager = new ProjectManager(projectStorage);
|
ProjectManager projectManager = new ProjectManager(projectStorage);
|
||||||
ProjectController = new Controller.ProjectController(projectManager);
|
ProjectController = new Controller.ProjectController(projectManager);
|
||||||
ProjectController.OwnerWindow = this;
|
ProjectController.OwnerWindow = this;
|
||||||
AddKeyBinding(ProjectController.ProjectCreateCommand);
|
this.AddKeyBinding(ProjectController.ProjectCreateCommand);
|
||||||
|
|
||||||
// Initialize document controller
|
// Initialize document controller
|
||||||
DocumentController = new DocumentController();
|
DocumentController = new DocumentController();
|
||||||
DocumentController.OwnerWindow = this;
|
DocumentController.OwnerWindow = this;
|
||||||
DocumentController.DocumentOpened += documentController_DocumentOpened;
|
DocumentController.DocumentOpened += documentController_DocumentOpened;
|
||||||
AddKeyBinding(DocumentController.DocumentCreateCommand);
|
this.AddKeyBinding(DocumentController.DocumentCreateCommand);
|
||||||
}
|
|
||||||
|
|
||||||
private void AddKeyBinding(Command c)
|
// Initialize panels
|
||||||
{
|
projectPanel.Controller = ProjectController;
|
||||||
if (c.Shortcut != null)
|
|
||||||
InputBindings.Add(new KeyBinding(c, c.Shortcut));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
||||||
|
61
RainmeterStudio/UI/ProjectPanel.xaml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<UserControl x:Class="RainmeterStudio.UI.ProjectPanel"
|
||||||
|
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"
|
||||||
|
xmlns:ctrl="clr-namespace:RainmeterStudio.UI.Controller"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ctrl:IconProviderConverter x:Key="IconConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Toolbar -->
|
||||||
|
<ToolBar Grid.Row="0" ToolBarTray.IsLocked="True">
|
||||||
|
<Button DataContext="{Binding SyncWithActiveViewCommand}"
|
||||||
|
Style="{StaticResource CommandButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
|
<Button DataContext="{Binding RefreshCommand}"
|
||||||
|
Style="{StaticResource CommandButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
|
<Button DataContext="{Binding CollapseAllCommand}"
|
||||||
|
Style="{StaticResource CommandAutoHideButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
|
<Button DataContext="{Binding ExpandAllCommand}"
|
||||||
|
Style="{StaticResource CommandAutoHideButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</Button>
|
||||||
|
<ToggleButton Name="toggleShowAllFiles"
|
||||||
|
DataContext="{Binding ShowAllFilesCommand}"
|
||||||
|
Style="{StaticResource CommandButtonStyle}">
|
||||||
|
<Image Width="16" Height="16" Source="{Binding Icon}" />
|
||||||
|
</ToggleButton>
|
||||||
|
</ToolBar>
|
||||||
|
|
||||||
|
<!-- Project item tree -->
|
||||||
|
<TreeView Grid.Row="2" Name="treeProjectItems">
|
||||||
|
<TreeView.ItemContainerStyle>
|
||||||
|
<Style TargetType="{x:Type TreeViewItem}">
|
||||||
|
<Setter Property="IsExpanded" Value="True" />
|
||||||
|
</Style>
|
||||||
|
</TreeView.ItemContainerStyle>
|
||||||
|
<TreeView.ItemTemplate>
|
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Image DockPanel.Dock="Left" Width="16" Height="16" Source="{Binding Converter={StaticResource IconConverter}}" />
|
||||||
|
<TextBlock Text="{Binding Data.Name}" />
|
||||||
|
</DockPanel>
|
||||||
|
</HierarchicalDataTemplate>
|
||||||
|
</TreeView.ItemTemplate>
|
||||||
|
</TreeView>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
177
RainmeterStudio/UI/ProjectPanel.xaml.cs
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
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.Model;
|
||||||
|
using RainmeterStudio.Storage;
|
||||||
|
using RainmeterStudio.UI.Controller;
|
||||||
|
using RainmeterStudio.Utils;
|
||||||
|
|
||||||
|
namespace RainmeterStudio.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for SkinsPanel.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ProjectPanel : UserControl
|
||||||
|
{
|
||||||
|
private ProjectController _controller;
|
||||||
|
public ProjectController Controller
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _controller;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
// Unsubscribe from old project
|
||||||
|
if (_controller != null)
|
||||||
|
{
|
||||||
|
Controller.ActiveProjectChanged -= Controller_ActiveProjectChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set new project
|
||||||
|
_controller = value;
|
||||||
|
_controller.ActiveProjectChanged += Controller_ActiveProjectChanged;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Command _syncWithActiveViewCommand;
|
||||||
|
public Command SyncWithActiveViewCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_syncWithActiveViewCommand == null)
|
||||||
|
{
|
||||||
|
_syncWithActiveViewCommand = new Command("ProjectPanel_SyncWithActiveViewCommand", SyncWithActiveView);
|
||||||
|
}
|
||||||
|
return _syncWithActiveViewCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Command _refreshCommand;
|
||||||
|
public Command RefreshCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_refreshCommand == null)
|
||||||
|
{
|
||||||
|
_refreshCommand = new Command("ProjectPanel_RefreshCommand", SyncWithActiveView)
|
||||||
|
{
|
||||||
|
Shortcut = new KeyGesture(Key.F5)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return _refreshCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Command _expandAllCommand;
|
||||||
|
public Command ExpandAllCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_expandAllCommand == null)
|
||||||
|
{
|
||||||
|
_expandAllCommand = new Command("ProjectPanel_ExpandAllCommand", SyncWithActiveView);
|
||||||
|
}
|
||||||
|
return _expandAllCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Command _collapseAllCommand;
|
||||||
|
public Command CollapseAllCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_collapseAllCommand == null)
|
||||||
|
{
|
||||||
|
_collapseAllCommand = new Command("ProjectPanel_CollapseAllCommand", SyncWithActiveView);
|
||||||
|
}
|
||||||
|
return _collapseAllCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Command _showAllFilesCommand;
|
||||||
|
public Command ShowAllFilesCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_showAllFilesCommand == null)
|
||||||
|
{
|
||||||
|
_showAllFilesCommand = new Command("ProjectPanel_ShowAllFilesCommand", SyncWithActiveView);
|
||||||
|
}
|
||||||
|
return _showAllFilesCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.DataContext = this;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller_ActiveProjectChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SyncWithActiveView()
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Refresh()
|
||||||
|
{
|
||||||
|
if (Controller == null || Controller.ActiveProject == null)
|
||||||
|
{
|
||||||
|
this.IsEnabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.IsEnabled = true;
|
||||||
|
|
||||||
|
// Display all files in the project directory
|
||||||
|
if (toggleShowAllFiles.IsChecked.HasValue && toggleShowAllFiles.IsChecked.Value)
|
||||||
|
{
|
||||||
|
string projectFolder = System.IO.Path.GetDirectoryName(Controller.ActiveProjectPath);
|
||||||
|
var tree = DirectoryHelper.GetFolderTree(projectFolder);
|
||||||
|
tree.Data = Controller.ActiveProject.Root.Data;
|
||||||
|
|
||||||
|
treeProjectItems.Items.Clear();
|
||||||
|
treeProjectItems.Items.Add(tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display only the project items
|
||||||
|
else
|
||||||
|
{
|
||||||
|
treeProjectItems.Items.Clear();
|
||||||
|
treeProjectItems.Items.Add(Controller.ActiveProject.Root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleShowAllFiles_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleShowAllFiles_Unchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
<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>
|
|
@ -1,31 +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;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
32
RainmeterStudio/Utils/DirectoryHelper.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using RainmeterStudio.Model;
|
||||||
|
|
||||||
|
namespace RainmeterStudio.Utils
|
||||||
|
{
|
||||||
|
public static class DirectoryHelper
|
||||||
|
{
|
||||||
|
public static Tree<Reference> GetFolderTree(string folder)
|
||||||
|
{
|
||||||
|
// Build tree object
|
||||||
|
Reference reference = new Reference(Path.GetFileName(folder), folder);
|
||||||
|
Tree<Reference> tree = new Tree<Reference>(reference);
|
||||||
|
|
||||||
|
// Navigate folder structure
|
||||||
|
if (Directory.Exists(folder))
|
||||||
|
{
|
||||||
|
foreach (var item in Directory.EnumerateDirectories(folder)
|
||||||
|
.Concat(Directory.EnumerateFiles(folder)))
|
||||||
|
{
|
||||||
|
tree.Add(GetFolderTree(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return tree
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|