mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added ProfileEditorModel
Refactored some namespaces Got rid of ProfileViewModel
This commit is contained in:
parent
15275c83a0
commit
afb6315ec6
@ -356,6 +356,8 @@
|
|||||||
<Compile Include="Managers\LuaManager.cs" />
|
<Compile Include="Managers\LuaManager.cs" />
|
||||||
<Compile Include="Managers\MainManager.cs" />
|
<Compile Include="Managers\MainManager.cs" />
|
||||||
<Compile Include="Managers\PreviewManager.cs" />
|
<Compile Include="Managers\PreviewManager.cs" />
|
||||||
|
<Compile Include="Models\LayerEditorModel.cs" />
|
||||||
|
<Compile Include="Models\ProfileEditorModel.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
||||||
@ -654,17 +656,16 @@
|
|||||||
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerTweenViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerTweenViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\ProfileViewModel.cs" />
|
|
||||||
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerConditionViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerConditionViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerDynamicPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\Profiles\LayerDynamicPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\LayerEditorViewModel.cs" />
|
<Compile Include="ViewModels\LayerEditorViewModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Abstract\LayerPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Abstract\LayerPropertiesViewModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Types\Headset\HeadsetPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Headset\HeadsetPropertiesViewModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Types\Folder\FolderPropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Folder\FolderPropertiesViewModel.cs" />
|
||||||
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesViewModel.cs" />
|
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Profiles\ProfileEditorViewModel.cs" />
|
<Compile Include="ViewModels\ProfileEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||||
<Compile Include="ViewModels\WelcomeViewModel.cs" />
|
<Compile Include="ViewModels\WelcomeViewModel.cs" />
|
||||||
<Compile Include="Views\DebugView.xaml.cs">
|
<Compile Include="Views\DebugView.xaml.cs">
|
||||||
@ -709,7 +710,7 @@
|
|||||||
<Compile Include="Views\Profiles\LayerDynamicPropertiesView.xaml.cs">
|
<Compile Include="Views\Profiles\LayerDynamicPropertiesView.xaml.cs">
|
||||||
<DependentUpon>LayerDynamicPropertiesView.xaml</DependentUpon>
|
<DependentUpon>LayerDynamicPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\LayerEditorView.xaml.cs">
|
<Compile Include="Views\LayerEditorView.xaml.cs">
|
||||||
<DependentUpon>LayerEditorView.xaml</DependentUpon>
|
<DependentUpon>LayerEditorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesView.xaml.cs">
|
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesView.xaml.cs">
|
||||||
@ -721,7 +722,7 @@
|
|||||||
<Compile Include="Views\Profiles\LayerTweenView.xaml.cs">
|
<Compile Include="Views\Profiles\LayerTweenView.xaml.cs">
|
||||||
<DependentUpon>LayerTweenView.xaml</DependentUpon>
|
<DependentUpon>LayerTweenView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\Profiles\ProfileEditorView.xaml.cs">
|
<Compile Include="Views\ProfileEditorView.xaml.cs">
|
||||||
<DependentUpon>ProfileEditorView.xaml</DependentUpon>
|
<DependentUpon>ProfileEditorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\ShellView.xaml.cs">
|
<Compile Include="Views\ShellView.xaml.cs">
|
||||||
@ -952,7 +953,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\LayerEditorView.xaml">
|
<Page Include="Views\LayerEditorView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@ -968,7 +969,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\Profiles\ProfileEditorView.xaml">
|
<Page Include="Views\ProfileEditorView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.DeviceProviders;
|
using Artemis.DeviceProviders;
|
||||||
|
using Artemis.Models;
|
||||||
using Artemis.Modules.Abstract;
|
using Artemis.Modules.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
||||||
@ -8,7 +9,6 @@ using Artemis.Utilities.DataReaders;
|
|||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
using Artemis.ViewModels;
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Artemis.ViewModels.Profiles;
|
|
||||||
using Ninject.Extensions.Conventions;
|
using Ninject.Extensions.Conventions;
|
||||||
using Ninject.Modules;
|
using Ninject.Modules;
|
||||||
|
|
||||||
@ -18,10 +18,16 @@ namespace Artemis.InjectionModules
|
|||||||
{
|
{
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
|
#region Models
|
||||||
|
|
||||||
|
Bind<ProfileEditorModel>().ToSelf();
|
||||||
|
Bind<LayerEditorModel>().ToSelf();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ViewModels
|
#region ViewModels
|
||||||
|
|
||||||
Bind<ShellViewModel>().ToSelf().InSingletonScope();
|
Bind<ShellViewModel>().ToSelf().InSingletonScope();
|
||||||
Bind<ProfileViewModel>().ToSelf();
|
|
||||||
Bind<ProfileEditorViewModel>().ToSelf();
|
Bind<ProfileEditorViewModel>().ToSelf();
|
||||||
Bind<DebugViewModel>().ToSelf().InSingletonScope();
|
Bind<DebugViewModel>().ToSelf().InSingletonScope();
|
||||||
Kernel.Bind(x =>
|
Kernel.Bind(x =>
|
||||||
|
|||||||
12
Artemis/Artemis/Models/LayerEditorModel.cs
Normal file
12
Artemis/Artemis/Models/LayerEditorModel.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Artemis.Models
|
||||||
|
{
|
||||||
|
public class LayerEditorModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
354
Artemis/Artemis/Models/ProfileEditorModel.cs
Normal file
354
Artemis/Artemis/Models/ProfileEditorModel.cs
Normal file
@ -0,0 +1,354 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Artemis.DAL;
|
||||||
|
using Artemis.Managers;
|
||||||
|
using Artemis.Modules.Abstract;
|
||||||
|
using Artemis.Profiles;
|
||||||
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.Profiles.Layers.Types.Folder;
|
||||||
|
using Artemis.Properties;
|
||||||
|
using Artemis.Services;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
|
using Ninject.Parameters;
|
||||||
|
|
||||||
|
namespace Artemis.Models
|
||||||
|
{
|
||||||
|
public class ProfileEditorModel : IDisposable
|
||||||
|
{
|
||||||
|
private readonly DeviceManager _deviceManager;
|
||||||
|
private readonly LuaManager _luaManager;
|
||||||
|
private readonly DialogService _dialogService;
|
||||||
|
private readonly WindowService _windowService;
|
||||||
|
private FileSystemWatcher _watcher;
|
||||||
|
private ProfileModel _luaProfile;
|
||||||
|
|
||||||
|
public ProfileEditorModel(WindowService windowService, MetroDialogService dialogService,
|
||||||
|
DeviceManager deviceManager, LuaManager luaManager)
|
||||||
|
{
|
||||||
|
_windowService = windowService;
|
||||||
|
_dialogService = dialogService;
|
||||||
|
_deviceManager = deviceManager;
|
||||||
|
_luaManager = luaManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Layers
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Opens a new LayerEditorView for the given layer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="layer">The layer to open the view for</param>
|
||||||
|
/// <param name="dataModel">The datamodel to bind the editor to</param>
|
||||||
|
public void EditLayer(LayerModel layer, ModuleDataModel dataModel)
|
||||||
|
{
|
||||||
|
IParameter[] args =
|
||||||
|
{
|
||||||
|
new ConstructorArgument("dataModel", dataModel),
|
||||||
|
new ConstructorArgument("layer", layer)
|
||||||
|
};
|
||||||
|
_windowService.ShowDialog<LayerEditorViewModel>(args);
|
||||||
|
|
||||||
|
// If the layer was a folder, but isn't anymore, assign it's children to it's parent.
|
||||||
|
if (layer.LayerType is FolderType || !layer.Children.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (layer.Children.Any())
|
||||||
|
{
|
||||||
|
var child = layer.Children[0];
|
||||||
|
layer.Children.Remove(child);
|
||||||
|
if (layer.Parent != null)
|
||||||
|
{
|
||||||
|
layer.Parent.Children.Add(child);
|
||||||
|
layer.Parent.FixOrder();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.Profile.Layers.Add(child);
|
||||||
|
layer.Profile.FixOrder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the given layer from the profile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="layer">The layer to remove</param>
|
||||||
|
/// <param name="profileModel">The profile to remove it from</param>
|
||||||
|
public void RemoveLayer(LayerModel layer, ProfileModel profileModel)
|
||||||
|
{
|
||||||
|
if (layer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (layer.Parent != null)
|
||||||
|
{
|
||||||
|
var parent = layer.Parent;
|
||||||
|
layer.Parent.Children.Remove(layer);
|
||||||
|
parent.FixOrder();
|
||||||
|
}
|
||||||
|
else if (layer.Profile != null)
|
||||||
|
{
|
||||||
|
var profile = layer.Profile;
|
||||||
|
layer.Profile.Layers.Remove(layer);
|
||||||
|
profile.FixOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extra cleanup in case of a wonky layer that has no parent
|
||||||
|
if (profileModel.Layers.Contains(layer))
|
||||||
|
profileModel.Layers.Remove(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Profiles
|
||||||
|
|
||||||
|
public async Task<ProfileModel> AddProfile(ModuleModel moduleModel)
|
||||||
|
{
|
||||||
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
|
{
|
||||||
|
_dialogService.ShowMessageBox("Cannot add profile.",
|
||||||
|
"To add a profile, please select a keyboard in the options menu first.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var name = await GetValidProfileName("Name profile", "Please enter a unique name for your new profile");
|
||||||
|
// User cancelled
|
||||||
|
if (name == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var profile = new ProfileModel
|
||||||
|
{
|
||||||
|
Name = name,
|
||||||
|
KeyboardSlug = _deviceManager.ActiveKeyboard.Slug,
|
||||||
|
Width = _deviceManager.ActiveKeyboard.Width,
|
||||||
|
Height = _deviceManager.ActiveKeyboard.Height,
|
||||||
|
GameName = moduleModel.Name
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!ProfileProvider.IsProfileUnique(profile))
|
||||||
|
{
|
||||||
|
var overwrite = await _dialogService.ShowQuestionMessageBox("Overwrite existing profile",
|
||||||
|
"A profile with this name already exists for this game. Would you like to overwrite it?");
|
||||||
|
if (!overwrite.Value)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfileProvider.AddOrUpdate(profile);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task RenameProfile(ProfileModel profileModel)
|
||||||
|
{
|
||||||
|
var name = await GetValidProfileName("Rename profile", "Please enter a unique new profile name");
|
||||||
|
// User cancelled
|
||||||
|
if (name == null)
|
||||||
|
return;
|
||||||
|
var doRename = await MakeProfileUnique(profileModel, name, profileModel.Name);
|
||||||
|
if (!doRename)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ProfileProvider.RenameProfile(profileModel, profileModel.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DuplicateProfile(ProfileModel selectedProfile)
|
||||||
|
{
|
||||||
|
var newProfile = GeneralHelpers.Clone(selectedProfile);
|
||||||
|
var name = await GetValidProfileName("Rename profile", "Please enter a unique new profile name");
|
||||||
|
// User cancelled
|
||||||
|
if (name == null)
|
||||||
|
return;
|
||||||
|
var doRename = await MakeProfileUnique(newProfile, name, newProfile.Name);
|
||||||
|
if (!doRename)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Make sure it's not default, in case of copying a default profile
|
||||||
|
newProfile.IsDefault = false;
|
||||||
|
ProfileProvider.AddOrUpdate(newProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task DeleteProfile(ProfileModel selectedProfile, ModuleModel moduleModel)
|
||||||
|
{
|
||||||
|
var confirm = await _dialogService.ShowQuestionMessageBox("Delete profile",
|
||||||
|
$"Are you sure you want to delete the profile named: {selectedProfile.Name}?\n\n" +
|
||||||
|
"This cannot be undone.");
|
||||||
|
if (!confirm.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var defaultProfile = ProfileProvider.GetProfile(_deviceManager.ActiveKeyboard, moduleModel, "Default");
|
||||||
|
var deleteProfile = selectedProfile;
|
||||||
|
|
||||||
|
moduleModel.ChangeProfile(defaultProfile);
|
||||||
|
ProfileProvider.DeleteProfile(deleteProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task ImportProfile(ModuleModel moduleModel)
|
||||||
|
{
|
||||||
|
var dialog = new OpenFileDialog {Filter = "Artemis profile (*.json)|*.json"};
|
||||||
|
var result = dialog.ShowDialog();
|
||||||
|
if (result != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var profileModel = ProfileProvider.LoadProfileIfValid(dialog.FileName);
|
||||||
|
if (profileModel == null)
|
||||||
|
{
|
||||||
|
_dialogService.ShowErrorMessageBox("Oh noes, the profile you provided is invalid. " +
|
||||||
|
"If this keeps happening, please make an issue on GitHub and provide the profile.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify the game
|
||||||
|
if (profileModel.GameName != moduleModel.Name)
|
||||||
|
{
|
||||||
|
_dialogService.ShowErrorMessageBox(
|
||||||
|
$"Oh oops! This profile is ment for {profileModel.GameName}, not {moduleModel.Name} :c");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify the keyboard
|
||||||
|
var deviceManager = _deviceManager;
|
||||||
|
if (profileModel.KeyboardSlug != deviceManager.ActiveKeyboard.Slug)
|
||||||
|
{
|
||||||
|
var adjustKeyboard = await _dialogService.ShowQuestionMessageBox("Profile not made for this keyboard",
|
||||||
|
$"Watch out, this profile wasn't ment for this keyboard, but for the {profileModel.KeyboardSlug}. " +
|
||||||
|
"You can still import it but you'll probably have to do some adjusting\n\n" +
|
||||||
|
"Continue?");
|
||||||
|
if (!adjustKeyboard.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Resize layers that are on the full keyboard width
|
||||||
|
profileModel.ResizeLayers(deviceManager.ActiveKeyboard);
|
||||||
|
// Put layers back into the canvas if they fell outside it
|
||||||
|
profileModel.FixBoundaries(deviceManager.ActiveKeyboard.KeyboardRectangle(1));
|
||||||
|
|
||||||
|
// Setup profile metadata to match the new keyboard
|
||||||
|
profileModel.KeyboardSlug = deviceManager.ActiveKeyboard.Slug;
|
||||||
|
profileModel.Width = deviceManager.ActiveKeyboard.Width;
|
||||||
|
profileModel.Height = deviceManager.ActiveKeyboard.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
var name = await GetValidProfileName("Rename profile", "Please enter a unique new profile name");
|
||||||
|
// User cancelled
|
||||||
|
if (name == null)
|
||||||
|
return;
|
||||||
|
var doRename = await MakeProfileUnique(profileModel, name, profileModel.Name);
|
||||||
|
if (!doRename)
|
||||||
|
return;
|
||||||
|
|
||||||
|
profileModel.IsDefault = false;
|
||||||
|
ProfileProvider.AddOrUpdate(profileModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> GetValidProfileName(string title, string text)
|
||||||
|
{
|
||||||
|
var name = await _dialogService.ShowInputDialog(title, text);
|
||||||
|
|
||||||
|
// Null when the user cancelled
|
||||||
|
if (name == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (name.Length >= 2)
|
||||||
|
return name;
|
||||||
|
|
||||||
|
_dialogService.ShowMessageBox("Invalid profile name",
|
||||||
|
"Please provide a valid profile name that's longer than 2 symbols");
|
||||||
|
|
||||||
|
return await GetValidProfileName(title, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> MakeProfileUnique(ProfileModel profileModel, string name, string oldName)
|
||||||
|
{
|
||||||
|
profileModel.Name = name;
|
||||||
|
if (ProfileProvider.IsProfileUnique(profileModel))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
name = await GetValidProfileName("Rename profile", "Please enter a unique new profile name");
|
||||||
|
if (name != null)
|
||||||
|
return await MakeProfileUnique(profileModel, name, oldName);
|
||||||
|
|
||||||
|
// If cancelled, restore old name and stop
|
||||||
|
profileModel.Name = oldName;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region LUA
|
||||||
|
|
||||||
|
public void OpenLuaEditor(ProfileModel profileModel)
|
||||||
|
{
|
||||||
|
// Clean up old environment
|
||||||
|
DisposeLuaWatcher();
|
||||||
|
|
||||||
|
// Create a temp file
|
||||||
|
var fileName = Guid.NewGuid() + ".lua";
|
||||||
|
var file = File.Create(Path.GetTempPath() + fileName);
|
||||||
|
file.Dispose();
|
||||||
|
|
||||||
|
// Add instructions to LUA script if it's a new file
|
||||||
|
if (string.IsNullOrEmpty(profileModel.LuaScript))
|
||||||
|
profileModel.LuaScript = Encoding.UTF8.GetString(Resources.lua_placeholder);
|
||||||
|
File.WriteAllText(Path.GetTempPath() + fileName, profileModel.LuaScript);
|
||||||
|
|
||||||
|
// Watch the file for changes
|
||||||
|
_luaProfile = profileModel;
|
||||||
|
_watcher = new FileSystemWatcher(Path.GetTempPath(), fileName);
|
||||||
|
_watcher.Changed += LuaFileChanged;
|
||||||
|
_watcher.EnableRaisingEvents = true;
|
||||||
|
_watcher.Path = Path.GetTempPath();
|
||||||
|
_watcher.Filter = fileName;
|
||||||
|
|
||||||
|
// Open the temp file with the default editor
|
||||||
|
System.Diagnostics.Process.Start(Path.GetTempPath() + fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LuaFileChanged(object sender, FileSystemEventArgs args)
|
||||||
|
{
|
||||||
|
if (_luaProfile == null)
|
||||||
|
{
|
||||||
|
DisposeLuaWatcher();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.ChangeType != WatcherChangeTypes.Changed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (_luaProfile)
|
||||||
|
{
|
||||||
|
using (var fs = new FileStream(args.FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
|
{
|
||||||
|
using (var sr = new StreamReader(fs))
|
||||||
|
{
|
||||||
|
_luaProfile.LuaScript = sr.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfileProvider.AddOrUpdate(_luaProfile);
|
||||||
|
_luaManager.SetupLua(_luaProfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisposeLuaWatcher()
|
||||||
|
{
|
||||||
|
if (_watcher == null) return;
|
||||||
|
_watcher.Changed -= LuaFileChanged;
|
||||||
|
_watcher.Dispose();
|
||||||
|
_watcher = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
DisposeLuaWatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Rendering
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Services;
|
using Artemis.Services;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using Artemis.Modules.Abstract;
|
using Artemis.Modules.Abstract;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.AmbientLight
|
namespace Artemis.Profiles.Layers.Types.AmbientLight
|
||||||
|
|||||||
@ -13,6 +13,7 @@ using Artemis.Profiles.Layers.Types.AmbientLight.Model.Extensions;
|
|||||||
using Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing;
|
using Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using Artemis.Profiles.Layers.Models;
|
|||||||
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Audio
|
namespace Artemis.Profiles.Layers.Types.Audio
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Folder
|
namespace Artemis.Profiles.Layers.Types.Folder
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using Artemis.Profiles.Layers.Interfaces;
|
|||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Folder
|
namespace Artemis.Profiles.Layers.Types.Folder
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Artemis.Profiles.Layers.Interfaces;
|
|||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Generic
|
namespace Artemis.Profiles.Layers.Types.Generic
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Artemis.Profiles.Layers.Interfaces;
|
|||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Headset
|
namespace Artemis.Profiles.Layers.Types.Headset
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.KeyPress
|
namespace Artemis.Profiles.Layers.Types.KeyPress
|
||||||
|
|||||||
@ -13,6 +13,7 @@ using Artemis.Profiles.Layers.Models;
|
|||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.KeyPress
|
namespace Artemis.Profiles.Layers.Types.KeyPress
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using System.Windows.Forms;
|
|||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Artemis.Profiles.Layers.Abstract;
|
|||||||
using Artemis.Profiles.Layers.Animations;
|
using Artemis.Profiles.Layers.Animations;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Keyboard
|
namespace Artemis.Profiles.Layers.Types.Keyboard
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using Artemis.Profiles.Layers.Models;
|
|||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
namespace Artemis.Profiles.Layers.Types.KeyboardGif
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Artemis.Profiles.Layers.Interfaces;
|
|||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Mouse
|
namespace Artemis.Profiles.Layers.Types.Mouse
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Profiles.Layers.Abstract;
|
using Artemis.Profiles.Layers.Abstract;
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Artemis.Profiles.Layers.Interfaces;
|
|||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels;
|
||||||
using Artemis.ViewModels.Profiles;
|
using Artemis.ViewModels.Profiles;
|
||||||
|
|
||||||
namespace Artemis.Profiles.Layers.Types.Mousemat
|
namespace Artemis.Profiles.Layers.Types.Mousemat
|
||||||
|
|||||||
@ -10,13 +10,14 @@ using Artemis.Profiles.Layers.Models;
|
|||||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||||
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
||||||
using Artemis.Services;
|
using Artemis.Services;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using Artemis.ViewModels.Profiles;
|
||||||
using Artemis.ViewModels.Profiles.Events;
|
using Artemis.ViewModels.Profiles.Events;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
using static Artemis.Utilities.GeneralHelpers;
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles
|
namespace Artemis.ViewModels
|
||||||
{
|
{
|
||||||
public sealed class LayerEditorViewModel : Screen
|
public sealed class LayerEditorViewModel : Screen
|
||||||
{
|
{
|
||||||
@ -30,13 +31,13 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
IEnumerable<ILayerAnimation> layerAnimations)
|
IEnumerable<ILayerAnimation> layerAnimations)
|
||||||
{
|
{
|
||||||
Layer = layer;
|
Layer = layer;
|
||||||
ProposedLayer = Clone(layer);
|
ProposedLayer = GeneralHelpers.Clone(layer);
|
||||||
ProposedLayer.Children.Clear();
|
ProposedLayer.Children.Clear();
|
||||||
DataModel = DataModel;
|
DataModel = DataModel;
|
||||||
LayerTypes = new BindableCollection<ILayerType>(types.OrderBy(t => t.Name));
|
LayerTypes = new BindableCollection<ILayerType>(types.OrderBy(t => t.Name));
|
||||||
LayerAnimations = layerAnimations.OrderBy(l => l.Name).ToList();
|
LayerAnimations = layerAnimations.OrderBy(l => l.Name).ToList();
|
||||||
|
|
||||||
DataModelProps = new BindableCollection<PropertyCollection>(GenerateTypeMap(dataModel));
|
DataModelProps = new BindableCollection<GeneralHelpers.PropertyCollection>(GeneralHelpers.GenerateTypeMap(dataModel));
|
||||||
|
|
||||||
if (Layer.Properties == null)
|
if (Layer.Properties == null)
|
||||||
Layer.SetupProperties();
|
Layer.SetupProperties();
|
||||||
@ -57,7 +58,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
public MetroDialogService DialogService { get; set; }
|
public MetroDialogService DialogService { get; set; }
|
||||||
|
|
||||||
public BindableCollection<ILayerType> LayerTypes { get; set; }
|
public BindableCollection<ILayerType> LayerTypes { get; set; }
|
||||||
public BindableCollection<PropertyCollection> DataModelProps { get; set; }
|
public BindableCollection<GeneralHelpers.PropertyCollection> DataModelProps { get; set; }
|
||||||
public BindableCollection<LayerConditionViewModel> LayerConditionVms { get; set; }
|
public BindableCollection<LayerConditionViewModel> LayerConditionVms { get; set; }
|
||||||
public bool KeyboardGridIsVisible => ProposedLayer.LayerType is KeyboardType;
|
public bool KeyboardGridIsVisible => ProposedLayer.LayerType is KeyboardType;
|
||||||
public bool GifGridIsVisible => ProposedLayer.LayerType is KeyboardGifType;
|
public bool GifGridIsVisible => ProposedLayer.LayerType is KeyboardGifType;
|
||||||
@ -215,7 +216,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
// Ignore the children, can't just temporarily add them to the proposed layer because
|
// Ignore the children, can't just temporarily add them to the proposed layer because
|
||||||
// that would upset the child layers' relations (sounds like Dr. Phil amirite?)
|
// that would upset the child layers' relations (sounds like Dr. Phil amirite?)
|
||||||
var currentObj = Clone(Layer);
|
var currentObj = GeneralHelpers.Clone(Layer);
|
||||||
currentObj.Children.Clear();
|
currentObj.Children.Clear();
|
||||||
|
|
||||||
// Apply the IsEvent boolean
|
// Apply the IsEvent boolean
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,382 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using Artemis.Events;
|
|
||||||
using Artemis.Managers;
|
|
||||||
using Artemis.Modules.Abstract;
|
|
||||||
using Artemis.Profiles;
|
|
||||||
using Artemis.Profiles.Layers.Interfaces;
|
|
||||||
using Artemis.Profiles.Layers.Models;
|
|
||||||
using Artemis.Profiles.Layers.Types.Folder;
|
|
||||||
using Artemis.Properties;
|
|
||||||
using Artemis.Utilities;
|
|
||||||
using Caliburn.Micro;
|
|
||||||
using Castle.Components.DictionaryAdapter;
|
|
||||||
using MahApps.Metro;
|
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Profiles
|
|
||||||
{
|
|
||||||
public class ProfileViewModel : PropertyChangedBase, IDisposable
|
|
||||||
{
|
|
||||||
private readonly DeviceManager _deviceManager;
|
|
||||||
private readonly LoopManager _loopManager;
|
|
||||||
private double _blurProgress;
|
|
||||||
private double _blurRadius;
|
|
||||||
private DateTime _downTime;
|
|
||||||
private LayerModel _draggingLayer;
|
|
||||||
private Point? _draggingLayerOffset;
|
|
||||||
private DrawingImage _keyboardPreview;
|
|
||||||
private Cursor _keyboardPreviewCursor;
|
|
||||||
private bool _resizing;
|
|
||||||
private bool _showAll;
|
|
||||||
|
|
||||||
public ProfileViewModel(DeviceManager deviceManager, LoopManager loopManager)
|
|
||||||
{
|
|
||||||
_deviceManager = deviceManager;
|
|
||||||
_loopManager = loopManager;
|
|
||||||
|
|
||||||
ShowAll = false;
|
|
||||||
|
|
||||||
_loopManager.RenderCompleted += LoopManagerOnRenderCompleted;
|
|
||||||
_deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModuleModel ModuleModel { get; set; }
|
|
||||||
public LayerModel SelectedLayer { get; set; }
|
|
||||||
|
|
||||||
public ProfileModel SelectedProfile => ModuleModel?.ProfileModel;
|
|
||||||
|
|
||||||
public DrawingImage KeyboardPreview
|
|
||||||
{
|
|
||||||
get { return _keyboardPreview; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, _keyboardPreview)) return;
|
|
||||||
_keyboardPreview = value;
|
|
||||||
NotifyOfPropertyChange(() => KeyboardPreview);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double BlurRadius
|
|
||||||
{
|
|
||||||
get { return _blurRadius; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value.Equals(_blurRadius)) return;
|
|
||||||
_blurRadius = value;
|
|
||||||
NotifyOfPropertyChange(() => BlurRadius);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShowAll
|
|
||||||
{
|
|
||||||
get { return _showAll; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _showAll) return;
|
|
||||||
_showAll = value;
|
|
||||||
NotifyOfPropertyChange(() => ShowAll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImageSource KeyboardImage => ImageUtilities
|
|
||||||
.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image ?? Resources.none);
|
|
||||||
|
|
||||||
private void LoopManagerOnRenderCompleted(object sender, EventArgs eventArgs)
|
|
||||||
{
|
|
||||||
// Update the glowing effect around the keyboard
|
|
||||||
if (_blurProgress > 2)
|
|
||||||
_blurProgress = 0;
|
|
||||||
_blurProgress = _blurProgress + 0.025;
|
|
||||||
BlurRadius = (Math.Sin(_blurProgress * Math.PI) + 1) * 10 + 10;
|
|
||||||
|
|
||||||
// Besides the usual checks, also check if the ActiveKeyboard isn't the NoneKeyboard
|
|
||||||
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null || _deviceManager.ActiveKeyboard.Slug == "none")
|
|
||||||
{
|
|
||||||
KeyboardPreview = null;
|
|
||||||
|
|
||||||
// Setup layers for the next frame
|
|
||||||
if (ModuleModel.IsInitialized && ActiveWindowHelper.MainWindowActive)
|
|
||||||
ModuleModel.PreviewLayers = new List<LayerModel>();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var renderLayers = GetRenderLayers();
|
|
||||||
// Draw the current frame to the preview
|
|
||||||
var keyboardRect = _deviceManager.ActiveKeyboard.KeyboardRectangle();
|
|
||||||
var visual = new DrawingVisual();
|
|
||||||
using (var drawingContext = visual.RenderOpen())
|
|
||||||
{
|
|
||||||
// Setup the DrawingVisual's size
|
|
||||||
drawingContext.PushClip(new RectangleGeometry(keyboardRect));
|
|
||||||
drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);
|
|
||||||
|
|
||||||
// Draw the layers
|
|
||||||
foreach (var layer in renderLayers)
|
|
||||||
{
|
|
||||||
layer.Update(null, true, false);
|
|
||||||
if (layer.LayerType.ShowInEdtor)
|
|
||||||
layer.Draw(null, drawingContext, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the selection color
|
|
||||||
var accentColor = ThemeManager.DetectAppStyle(Application.Current)?.Item2?.Resources["AccentColor"];
|
|
||||||
if (accentColor == null)
|
|
||||||
{
|
|
||||||
var preview = new DrawingImage();
|
|
||||||
preview.Freeze();
|
|
||||||
KeyboardPreview = preview;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pen = new Pen(new SolidColorBrush((Color) accentColor), 0.4);
|
|
||||||
|
|
||||||
// Draw the selection outline and resize indicator
|
|
||||||
if (SelectedLayer != null && SelectedLayer.MustDraw())
|
|
||||||
{
|
|
||||||
var layerRect = SelectedLayer.Properties.PropertiesRect();
|
|
||||||
// Deflate the rect so that the border is drawn on the inside
|
|
||||||
layerRect.Inflate(-0.2, -0.2);
|
|
||||||
|
|
||||||
// Draw an outline around the selected layer
|
|
||||||
drawingContext.DrawRectangle(null, pen, layerRect);
|
|
||||||
// Draw a resize indicator in the bottom-right
|
|
||||||
drawingContext.DrawLine(pen,
|
|
||||||
new Point(layerRect.BottomRight.X - 1, layerRect.BottomRight.Y - 0.5),
|
|
||||||
new Point(layerRect.BottomRight.X - 1.2, layerRect.BottomRight.Y - 0.7));
|
|
||||||
drawingContext.DrawLine(pen,
|
|
||||||
new Point(layerRect.BottomRight.X - 0.5, layerRect.BottomRight.Y - 1),
|
|
||||||
new Point(layerRect.BottomRight.X - 0.7, layerRect.BottomRight.Y - 1.2));
|
|
||||||
drawingContext.DrawLine(pen,
|
|
||||||
new Point(layerRect.BottomRight.X - 0.5, layerRect.BottomRight.Y - 0.5),
|
|
||||||
new Point(layerRect.BottomRight.X - 0.7, layerRect.BottomRight.Y - 0.7));
|
|
||||||
}
|
|
||||||
|
|
||||||
SelectedProfile?.RaiseDeviceDrawnEvent(new ProfileDeviceEventsArg(DrawType.Preview, null, true, drawingContext));
|
|
||||||
|
|
||||||
// Remove the clip
|
|
||||||
drawingContext.Pop();
|
|
||||||
}
|
|
||||||
var drawnPreview = new DrawingImage(visual.Drawing);
|
|
||||||
drawnPreview.Freeze();
|
|
||||||
KeyboardPreview = drawnPreview;
|
|
||||||
|
|
||||||
// Setup layers for the next frame
|
|
||||||
if (ModuleModel.IsInitialized && ActiveWindowHelper.MainWindowActive)
|
|
||||||
ModuleModel.PreviewLayers = renderLayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeviceManagerOnOnKeyboardChanged(object sender, KeyboardChangedEventArgs e)
|
|
||||||
{
|
|
||||||
NotifyOfPropertyChange(() => KeyboardImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Processing
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handler for clicking
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
public void MouseDownKeyboardPreview(MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
|
||||||
_downTime = DateTime.Now;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Second handler for clicking, selects a the layer the user clicked on.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
public void MouseUpKeyboardPreview(MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
if (SelectedProfile == null || SelectedProfile.IsDefault)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var timeSinceDown = DateTime.Now - _downTime;
|
|
||||||
if (!(timeSinceDown.TotalMilliseconds < 500))
|
|
||||||
return;
|
|
||||||
if (_draggingLayer != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var keyboard = _deviceManager.ActiveKeyboard;
|
|
||||||
var pos = e.GetPosition((Image) e.OriginalSource);
|
|
||||||
var x = pos.X / ((double) keyboard.PreviewSettings.Width / keyboard.Width);
|
|
||||||
var y = pos.Y / ((double) keyboard.PreviewSettings.Height / keyboard.Height);
|
|
||||||
|
|
||||||
var hoverLayer = GetLayers().Where(l => l.MustDraw())
|
|
||||||
.FirstOrDefault(l => l.Properties.PropertiesRect(1).Contains(x, y));
|
|
||||||
|
|
||||||
if (hoverLayer != null)
|
|
||||||
SelectedLayer = hoverLayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handler for resizing and moving the currently selected layer
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
public void MouseMoveKeyboardPreview(MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (SelectedProfile == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var pos = e.GetPosition((Image) e.OriginalSource);
|
|
||||||
var keyboard = _deviceManager.ActiveKeyboard;
|
|
||||||
var x = pos.X / ((double) keyboard.PreviewSettings.Width / keyboard.Width);
|
|
||||||
var y = pos.Y / ((double) keyboard.PreviewSettings.Height / keyboard.Height);
|
|
||||||
var hoverLayer = GetLayers().Where(l => l.MustDraw())
|
|
||||||
.FirstOrDefault(l => l.Properties.PropertiesRect(1).Contains(x, y));
|
|
||||||
|
|
||||||
HandleDragging(e, x, y, hoverLayer);
|
|
||||||
|
|
||||||
if (hoverLayer == null)
|
|
||||||
{
|
|
||||||
KeyboardPreviewCursor = Cursors.Arrow;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn the mouse pointer into a hand if hovering over an active layer
|
|
||||||
if (hoverLayer == SelectedLayer)
|
|
||||||
{
|
|
||||||
var rect = hoverLayer.Properties.PropertiesRect(1);
|
|
||||||
KeyboardPreviewCursor =
|
|
||||||
Math.Sqrt(Math.Pow(x - rect.BottomRight.X, 2) + Math.Pow(y - rect.BottomRight.Y, 2)) < 0.6
|
|
||||||
? Cursors.SizeNWSE
|
|
||||||
: Cursors.SizeAll;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KeyboardPreviewCursor = Cursors.Hand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Cursor KeyboardPreviewCursor
|
|
||||||
{
|
|
||||||
get { return _keyboardPreviewCursor; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, _keyboardPreviewCursor)) return;
|
|
||||||
_keyboardPreviewCursor = value;
|
|
||||||
NotifyOfPropertyChange(() => KeyboardPreviewCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles dragging the given layer
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
/// <param name="x"></param>
|
|
||||||
/// <param name="y"></param>
|
|
||||||
/// <param name="hoverLayer"></param>
|
|
||||||
private void HandleDragging(MouseEventArgs e, double x, double y, LayerModel hoverLayer)
|
|
||||||
{
|
|
||||||
// Reset the dragging state on mouse release
|
|
||||||
if (e.LeftButton == MouseButtonState.Released ||
|
|
||||||
_draggingLayer != null && SelectedLayer != _draggingLayer)
|
|
||||||
{
|
|
||||||
_draggingLayerOffset = null;
|
|
||||||
_draggingLayer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SelectedLayer == null || SelectedLayer.LayerType != null && !SelectedLayer.LayerType.ShowInEdtor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Setup the dragging state on mouse press
|
|
||||||
if (_draggingLayerOffset == null && hoverLayer != null && e.LeftButton == MouseButtonState.Pressed)
|
|
||||||
{
|
|
||||||
var layerRect = hoverLayer.Properties.PropertiesRect(1);
|
|
||||||
|
|
||||||
_draggingLayerOffset = new Point(x - SelectedLayer.Properties.X, y - SelectedLayer.Properties.Y);
|
|
||||||
_draggingLayer = hoverLayer;
|
|
||||||
// Detect dragging if cursor is in the bottom right
|
|
||||||
_resizing = Math.Sqrt(Math.Pow(x - layerRect.BottomRight.X, 2) +
|
|
||||||
Math.Pow(y - layerRect.BottomRight.Y, 2)) < 0.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_draggingLayerOffset == null || _draggingLayer == null || _draggingLayer != SelectedLayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var draggingProps = _draggingLayer.Properties;
|
|
||||||
// If no setup or reset was done, handle the actual dragging action
|
|
||||||
if (_resizing)
|
|
||||||
{
|
|
||||||
var newWidth = Math.Round(x - draggingProps.X);
|
|
||||||
var newHeight = Math.Round(y - draggingProps.Y);
|
|
||||||
|
|
||||||
// Ensure the layer doesn't leave the canvas
|
|
||||||
if (newWidth < 1 || draggingProps.X + newWidth <= 0)
|
|
||||||
newWidth = draggingProps.Width;
|
|
||||||
if (newHeight < 1 || draggingProps.Y + newHeight <= 0)
|
|
||||||
newHeight = draggingProps.Height;
|
|
||||||
|
|
||||||
draggingProps.Width = newWidth;
|
|
||||||
draggingProps.Height = newHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var newX = Math.Round(x - _draggingLayerOffset.Value.X);
|
|
||||||
var newY = Math.Round(y - _draggingLayerOffset.Value.Y);
|
|
||||||
|
|
||||||
// Ensure the layer doesn't leave the canvas
|
|
||||||
if (newX >= SelectedProfile.Width || newX + draggingProps.Width <= 0)
|
|
||||||
newX = draggingProps.X;
|
|
||||||
if (newY >= SelectedProfile.Height || newY + draggingProps.Height <= 0)
|
|
||||||
newY = draggingProps.Y;
|
|
||||||
|
|
||||||
draggingProps.X = newX;
|
|
||||||
draggingProps.Y = newY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LayerModel> GetRenderLayers()
|
|
||||||
{
|
|
||||||
// Get the layers that must be drawn
|
|
||||||
List<LayerModel> drawLayers;
|
|
||||||
if (ShowAll)
|
|
||||||
return SelectedProfile.GetRenderLayers(null, false, true);
|
|
||||||
|
|
||||||
if (SelectedLayer == null || !SelectedLayer.Enabled)
|
|
||||||
return new EditableList<LayerModel>();
|
|
||||||
|
|
||||||
if (SelectedLayer.LayerType is FolderType)
|
|
||||||
drawLayers = SelectedLayer.GetRenderLayers(null, false, true);
|
|
||||||
else
|
|
||||||
drawLayers = new List<LayerModel> {SelectedLayer};
|
|
||||||
|
|
||||||
return drawLayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<LayerModel> GetLayers()
|
|
||||||
{
|
|
||||||
if (ShowAll)
|
|
||||||
return SelectedProfile.GetLayers();
|
|
||||||
if (SelectedLayer == null)
|
|
||||||
return new List<LayerModel>();
|
|
||||||
|
|
||||||
lock (SelectedLayer)
|
|
||||||
{
|
|
||||||
// Get the layers that must be drawn
|
|
||||||
if (SelectedLayer.LayerType is FolderType)
|
|
||||||
return SelectedLayer.GetLayers().ToList();
|
|
||||||
return new List<LayerModel> {SelectedLayer};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Disposed = true;
|
|
||||||
_loopManager.RenderCompleted -= LoopManagerOnRenderCompleted;
|
|
||||||
_deviceManager.OnKeyboardChanged -= DeviceManagerOnOnKeyboardChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Disposed { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<controls:MetroWindow x:Class="Artemis.Views.Profiles.LayerEditorView"
|
<controls:MetroWindow x:Class="Artemis.Views.LayerEditorView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using MahApps.Metro.Controls;
|
using MahApps.Metro.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles
|
namespace Artemis.Views
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for LayerEditorView.xaml
|
/// Interaction logic for LayerEditorView.xaml
|
||||||
@ -1,288 +1,297 @@
|
|||||||
<UserControl x:Class="Artemis.Views.Profiles.ProfileEditorView"
|
<UserControl x:Class="Artemis.Views.ProfileEditorView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:cal="http://www.caliburnproject.org"
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
|
xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
|
||||||
xmlns:utilities="clr-namespace:Artemis.Utilities"
|
xmlns:dragDrop="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
|
||||||
xmlns:dragDrop="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
|
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
mc:Ignorable="d"
|
||||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
d:DesignHeight="510" Width="1055">
|
||||||
mc:Ignorable="d"
|
<UserControl.Resources>
|
||||||
d:DesignHeight="510" Width="1055">
|
<converters:LayerOrderConverter x:Key="LayerOrderConverter" />
|
||||||
<UserControl.Resources>
|
<Storyboard x:Key="Pulse" RepeatBehavior="Forever">
|
||||||
<converters:LayerOrderConverter x:Key="LayerOrderConverter" />
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="BlurRadius" Storyboard.TargetName="ShadowEffect">
|
||||||
</UserControl.Resources>
|
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="25"/>
|
||||||
<Grid Width="Auto" Height="Auto">
|
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="10"/>
|
||||||
<Grid.ColumnDefinitions>
|
<EasingDoubleKeyFrame KeyTime="0:0:4" Value="25"/>
|
||||||
<ColumnDefinition Width="Auto" />
|
</DoubleAnimationUsingKeyFrames>
|
||||||
<ColumnDefinition Width="Auto" />
|
</Storyboard>
|
||||||
</Grid.ColumnDefinitions>
|
</UserControl.Resources>
|
||||||
<Grid.RowDefinitions>
|
<UserControl.Triggers>
|
||||||
<RowDefinition Height="Auto" />
|
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
||||||
<RowDefinition Height="Auto" />
|
<BeginStoryboard Storyboard="{StaticResource Pulse}"/>
|
||||||
<RowDefinition Height="*" />
|
</EventTrigger>
|
||||||
<RowDefinition />
|
</UserControl.Triggers>
|
||||||
</Grid.RowDefinitions>
|
<Grid Width="Auto" Height="Auto">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
<!-- Preview Background="#FF232323" -->
|
<ColumnDefinition Width="Auto" />
|
||||||
<Label Grid.Column="0" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Preview" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
|
</Grid.ColumnDefinitions>
|
||||||
BorderThickness="3" Width="800" Height="400">
|
<Grid.RowDefinitions>
|
||||||
<Border>
|
<RowDefinition Height="Auto" />
|
||||||
<Border.Effect>
|
<RowDefinition Height="Auto" />
|
||||||
<DropShadowEffect ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1"
|
<RowDefinition Height="*" />
|
||||||
BlurRadius="{Binding Path=ProfileViewModel.BlurRadius, Mode=OneWay}" />
|
<RowDefinition />
|
||||||
</Border.Effect>
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
|
||||||
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardImage}"
|
<!-- Preview Background="#FF232323" -->
|
||||||
Margin="50" />
|
<Label Grid.Column="0" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Preview" />
|
||||||
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=ProfileViewModel.KeyboardPreview}"
|
<Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
|
||||||
Opacity="0.8"
|
BorderThickness="3" Width="800" Height="400">
|
||||||
Width="{Binding Path=PreviewSettings.Width}"
|
<Border>
|
||||||
Height="{Binding Path=PreviewSettings.Height}"
|
<Border.Effect>
|
||||||
Margin="{Binding Path=PreviewSettings.Margin}"
|
<DropShadowEffect x:Name="ShadowEffect" ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" />
|
||||||
Stretch="Fill" Cursor="{Binding Path=ProfileViewModel.KeyboardPreviewCursor}"
|
</Border.Effect>
|
||||||
cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
|
<Grid>
|
||||||
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
|
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=KeyboardImage}"
|
||||||
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]"
|
Margin="50" />
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" />
|
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Path=KeyboardPreview}"
|
||||||
</Grid>
|
Opacity="0.8"
|
||||||
</Border>
|
Width="{Binding Path=PreviewSettings.Width}"
|
||||||
</Border>
|
Height="{Binding Path=PreviewSettings.Height}"
|
||||||
<!-- Profile management -->
|
Margin="{Binding Path=PreviewSettings.Margin}"
|
||||||
<StackPanel Grid.Column="0" Grid.Row="2">
|
Stretch="Fill" Cursor="{Binding Path=KeyboardPreviewCursor}"
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
|
||||||
<Label Content="Active profile" />
|
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
|
||||||
<ComboBox Width="220" VerticalAlignment="Top" x:Name="ProfileNames" Margin="5,0,0,0" />
|
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]"
|
||||||
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" />
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile">
|
</Grid>
|
||||||
<Button.Content>
|
</Border>
|
||||||
<Rectangle
|
</Border>
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
<!-- Profile management -->
|
||||||
Width="12" Height="12">
|
<StackPanel Grid.Column="0" Grid.Row="2">
|
||||||
<Rectangle.OpacityMask>
|
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
||||||
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
|
<Label Content="Active profile" />
|
||||||
</Rectangle.OpacityMask>
|
<ComboBox Width="220" VerticalAlignment="Top" x:Name="ProfileNames" Margin="5,0,0,0" />
|
||||||
</Rectangle>
|
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Button.Content>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
ToolTip="Duplicate profile"
|
Width="12" Height="12">
|
||||||
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}">
|
<Rectangle.OpacityMask>
|
||||||
<Button.Content>
|
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
|
||||||
<Rectangle
|
</Rectangle.OpacityMask>
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle>
|
||||||
Width="12" Height="12">
|
</Button.Content>
|
||||||
<Rectangle.OpacityMask>
|
</Button>
|
||||||
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
|
<Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle.OpacityMask>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
</Rectangle>
|
ToolTip="Duplicate profile"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
</StackPanel>
|
<Rectangle
|
||||||
<TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold" />
|
Width="12" Height="12">
|
||||||
</StackPanel>
|
<Rectangle.OpacityMask>
|
||||||
|
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
|
||||||
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
</Rectangle.OpacityMask>
|
||||||
<Button x:Name="ImportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
</Rectangle>
|
||||||
Height="26" HorizontalAlignment="Right" ToolTip="Import profile">
|
</Button.Content>
|
||||||
<Button.Content>
|
</Button>
|
||||||
<StackPanel Orientation="Horizontal">
|
</StackPanel>
|
||||||
<Rectangle
|
<TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left"
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold" />
|
||||||
Width="12" Height="12" Margin="3,0">
|
</StackPanel>
|
||||||
<Rectangle.OpacityMask>
|
|
||||||
<VisualBrush Visual="{StaticResource appbar_cabinet_in}" Stretch="Fill" />
|
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="ImportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Height="26" HorizontalAlignment="Right" ToolTip="Import profile">
|
||||||
<TextBlock Margin="2,0,2,0">import profile</TextBlock>
|
<Button.Content>
|
||||||
</StackPanel>
|
<StackPanel Orientation="Horizontal">
|
||||||
</Button.Content>
|
<Rectangle
|
||||||
</Button>
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
<Button x:Name="ExportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
Width="12" Height="12" Margin="3,0">
|
||||||
Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" IsEnabled="{Binding ProfileSelected}">
|
<Rectangle.OpacityMask>
|
||||||
<Button.Content>
|
<VisualBrush Visual="{StaticResource appbar_cabinet_in}" Stretch="Fill" />
|
||||||
<StackPanel Orientation="Horizontal">
|
</Rectangle.OpacityMask>
|
||||||
<Rectangle
|
</Rectangle>
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
<TextBlock Margin="2,0,2,0">import profile</TextBlock>
|
||||||
Width="12" Height="12" Margin="3,0">
|
</StackPanel>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_cabinet_out}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="ExportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" IsEnabled="{Binding ProfileSelected}">
|
||||||
<TextBlock Margin="2,0,2,0">export profile</TextBlock>
|
<Button.Content>
|
||||||
</StackPanel>
|
<StackPanel Orientation="Horizontal">
|
||||||
</Button.Content>
|
<Rectangle
|
||||||
</Button>
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
<Button x:Name="EditLua" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
Width="12" Height="12" Margin="3,0">
|
||||||
Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Import profile"
|
<Rectangle.OpacityMask>
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
<VisualBrush Visual="{StaticResource appbar_cabinet_out}" Stretch="Fill" />
|
||||||
<Button.Content>
|
</Rectangle.OpacityMask>
|
||||||
<StackPanel Orientation="Horizontal">
|
</Rectangle>
|
||||||
<Rectangle
|
<TextBlock Margin="2,0,2,0">export profile</TextBlock>
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</StackPanel>
|
||||||
Width="12" Height="12" Margin="3,0">
|
</Button.Content>
|
||||||
<Rectangle.OpacityMask>
|
</Button>
|
||||||
<VisualBrush Visual="{StaticResource appbar_code_xml}" Stretch="Fill" />
|
<Button x:Name="EditLua" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle.OpacityMask>
|
Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Import profile"
|
||||||
</Rectangle>
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||||
<TextBlock Margin="2,0,2,0">edit lua</TextBlock>
|
<Button.Content>
|
||||||
</StackPanel>
|
<StackPanel Orientation="Horizontal">
|
||||||
</Button.Content>
|
<Rectangle
|
||||||
</Button>
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
</StackPanel>
|
Width="12" Height="12" Margin="3,0">
|
||||||
|
<Rectangle.OpacityMask>
|
||||||
<!-- Layer list -->
|
<VisualBrush Visual="{StaticResource appbar_code_xml}" Stretch="Fill" />
|
||||||
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal">
|
</Rectangle.OpacityMask>
|
||||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Layers" Margin="10,0,0,0" />
|
</Rectangle>
|
||||||
<Label HorizontalAlignment="Right" ToolTip="Show all layers instead of just the one you have selected"
|
<TextBlock Margin="2,0,2,0">edit lua</TextBlock>
|
||||||
Content="Show all" Margin="88,0,0,0" VerticalAlignment="Center" />
|
</StackPanel>
|
||||||
<ToggleButton x:Name="ShowAll" ToolTip="Show all layers instead of just the one you have selected"
|
</Button.Content>
|
||||||
Margin="0 3 0 0" Width="25" Height="25"
|
</Button>
|
||||||
IsChecked="{Binding Path=ProfileViewModel.ShowAll, Mode=TwoWay}"
|
</StackPanel>
|
||||||
Style="{DynamicResource MetroCircleToggleButtonStyle}" HorizontalAlignment="Right" />
|
|
||||||
</StackPanel>
|
<!-- Layer list -->
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal">
|
||||||
<Border Grid.Column="1" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
|
<Label FontSize="20" HorizontalAlignment="Left" Content="Layers" Margin="10,0,0,0" />
|
||||||
BorderThickness="3" Margin="10,0,0,0" Height="400" Width="233">
|
<Label HorizontalAlignment="Right" ToolTip="Show all layers instead of just the one you have selected"
|
||||||
<TreeView x:Name="ProfileTree"
|
Content="Show all" Margin="88,0,0,0" VerticalAlignment="Center" />
|
||||||
dragDrop:DragDrop.IsDragSource="True"
|
<ToggleButton x:Name="ShowAll" ToolTip="Show all layers instead of just the one you have selected"
|
||||||
dragDrop:DragDrop.IsDropTarget="True"
|
Margin="0 3 0 0" Width="25" Height="25"
|
||||||
dragDrop:DragDrop.DropHandler="{Binding}"
|
IsChecked="{Binding Path=ShowAll, Mode=TwoWay}"
|
||||||
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}"
|
Style="{DynamicResource MetroCircleToggleButtonStyle}" HorizontalAlignment="Right" />
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
</StackPanel>
|
||||||
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
|
||||||
<i:Interaction.Behaviors>
|
<Border Grid.Column="1" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
|
||||||
<itemBehaviours:BindableSelectedItemBehavior
|
BorderThickness="3" Margin="10,0,0,0" Height="400" Width="233">
|
||||||
SelectedItem="{Binding SelectedLayer, Mode=TwoWay}" />
|
<TreeView x:Name="ProfileTree"
|
||||||
</i:Interaction.Behaviors>
|
dragDrop:DragDrop.IsDragSource="True"
|
||||||
<TreeView.Resources>
|
dragDrop:DragDrop.IsDropTarget="True"
|
||||||
<ResourceDictionary
|
dragDrop:DragDrop.DropHandler="{Binding}"
|
||||||
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}"
|
||||||
</TreeView.Resources>
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
<TreeView.ItemTemplate>
|
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
||||||
<HierarchicalDataTemplate
|
<i:Interaction.Behaviors>
|
||||||
ItemsSource="{Binding Children, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}">
|
<itemBehaviours:BindableSelectedItemBehavior
|
||||||
<StackPanel Orientation="Horizontal" Tag="{Binding DataContext, ElementName=ProfileTree}">
|
SelectedItem="{Binding SelectedLayer, Mode=TwoWay}" />
|
||||||
<StackPanel.ContextMenu>
|
</i:Interaction.Behaviors>
|
||||||
<ContextMenu
|
<TreeView.Resources>
|
||||||
cal:Action.TargetWithoutContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
|
<ResourceDictionary
|
||||||
<MenuItem Header="Rename" cal:Message.Attach="RenameLayer($datacontext)" />
|
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||||
<MenuItem Header="Duplicate" cal:Message.Attach="CloneLayer($datacontext)" />
|
</TreeView.Resources>
|
||||||
<MenuItem Header="Delete" cal:Message.Attach="RemoveLayer($datacontext)" />
|
<TreeView.ItemTemplate>
|
||||||
<MenuItem Header="Properties" cal:Message.Attach="EditLayer($datacontext)" />
|
<HierarchicalDataTemplate
|
||||||
</ContextMenu>
|
ItemsSource="{Binding Children, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}">
|
||||||
</StackPanel.ContextMenu>
|
<StackPanel Orientation="Horizontal" Tag="{Binding DataContext, ElementName=ProfileTree}">
|
||||||
<CheckBox VerticalAlignment="Center" ToolTip="Layer enabled" IsChecked="{Binding Enabled}" />
|
<StackPanel.ContextMenu>
|
||||||
<Image Height="18" Width="18" Source="{Binding LayerImage}" />
|
<ContextMenu
|
||||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" VerticalAlignment="Center" />
|
cal:Action.TargetWithoutContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
|
||||||
</StackPanel>
|
<MenuItem Header="Rename" cal:Message.Attach="RenameLayer($datacontext)" />
|
||||||
</HierarchicalDataTemplate>
|
<MenuItem Header="Duplicate" cal:Message.Attach="CloneLayer($datacontext)" />
|
||||||
</TreeView.ItemTemplate>
|
<MenuItem Header="Delete" cal:Message.Attach="RemoveLayer($datacontext)" />
|
||||||
<TreeView.ItemContainerStyle>
|
<MenuItem Header="Properties" cal:Message.Attach="EditLayer($datacontext)" />
|
||||||
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
</ContextMenu>
|
||||||
<Setter Property="IsExpanded" Value="{Binding Path=Expanded, Mode=TwoWay}" />
|
</StackPanel.ContextMenu>
|
||||||
</Style>
|
<CheckBox VerticalAlignment="Center" ToolTip="Layer enabled" IsChecked="{Binding Enabled}" />
|
||||||
</TreeView.ItemContainerStyle>
|
<Image Height="18" Width="18" Source="{Binding LayerImage}" />
|
||||||
</TreeView>
|
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" VerticalAlignment="Center" />
|
||||||
</Border>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" Margin="10,5,0,0" HorizontalAlignment="Right">
|
</HierarchicalDataTemplate>
|
||||||
<Button x:Name="AddLayer" VerticalAlignment="Top"
|
</TreeView.ItemTemplate>
|
||||||
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
<TreeView.ItemContainerStyle>
|
||||||
Width="26" Height="26" ToolTip="Add layer" HorizontalAlignment="Left">
|
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
||||||
<Button.Content>
|
<Setter Property="IsExpanded" Value="{Binding Path=Expanded, Mode=TwoWay}" />
|
||||||
<Rectangle
|
</Style>
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</TreeView.ItemContainerStyle>
|
||||||
Width="12" Height="12">
|
</TreeView>
|
||||||
<Rectangle.OpacityMask>
|
</Border>
|
||||||
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
|
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" Margin="10,5,0,0" HorizontalAlignment="Right">
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="AddLayer" VerticalAlignment="Top"
|
||||||
</Rectangle>
|
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
</Button.Content>
|
Width="26" Height="26" ToolTip="Add layer" HorizontalAlignment="Left">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="AddFolder" VerticalAlignment="Top"
|
<Rectangle
|
||||||
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
Width="26" Height="26" ToolTip="Add folder" HorizontalAlignment="Left" Margin="10,0,0,0">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_folder}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="AddFolder" VerticalAlignment="Top"
|
||||||
</Rectangle>
|
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
</Button.Content>
|
Width="26" Height="26" ToolTip="Add folder" HorizontalAlignment="Left" Margin="10,0,0,0">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_folder}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=LayerSelected}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="CloneLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate layer"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="CloneLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate layer"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=LayerSelected}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
<Button x:Name="RemoveLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Rectangle
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete layer"
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
Width="12" Height="12">
|
||||||
<Button.Content>
|
<Rectangle.OpacityMask>
|
||||||
<Rectangle
|
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
</Rectangle.OpacityMask>
|
||||||
Width="12" Height="12">
|
</Rectangle>
|
||||||
<Rectangle.OpacityMask>
|
</Button.Content>
|
||||||
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
|
</Button>
|
||||||
</Rectangle.OpacityMask>
|
<Button x:Name="RemoveLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
||||||
</Rectangle>
|
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete layer"
|
||||||
</Button.Content>
|
IsEnabled="{Binding Path=LayerSelected}">
|
||||||
</Button>
|
<Button.Content>
|
||||||
</StackPanel>
|
<Rectangle
|
||||||
</Grid>
|
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
||||||
|
Width="12" Height="12">
|
||||||
|
<Rectangle.OpacityMask>
|
||||||
|
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
|
||||||
|
</Rectangle.OpacityMask>
|
||||||
|
</Rectangle>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Views.Profiles
|
namespace Artemis.Views
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for ProfileEditorView.xaml
|
/// Interaction logic for ProfileEditorView.xaml
|
||||||
Loading…
x
Reference in New Issue
Block a user