mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
Added editor buttons to LUA API
This commit is contained in:
parent
ccf8360875
commit
5d138bf7ac
@ -568,6 +568,7 @@
|
|||||||
<Compile Include="Profiles\Lua\Modules\Events\LuaKeyPressEventArgs.cs" />
|
<Compile Include="Profiles\Lua\Modules\Events\LuaKeyPressEventArgs.cs" />
|
||||||
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceDrawingEventArgs.cs" />
|
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceDrawingEventArgs.cs" />
|
||||||
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceUpdatingEventArgs.cs" />
|
<Compile Include="Profiles\Lua\Modules\Events\LuaDeviceUpdatingEventArgs.cs" />
|
||||||
|
<Compile Include="Profiles\Lua\Modules\Gui\EditorButton.cs" />
|
||||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaButton.cs" />
|
<Compile Include="Profiles\Lua\Modules\Gui\LuaButton.cs" />
|
||||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaCheckBox.cs" />
|
<Compile Include="Profiles\Lua\Modules\Gui\LuaCheckBox.cs" />
|
||||||
<Compile Include="Profiles\Lua\Modules\Gui\LuaComboBox.cs" />
|
<Compile Include="Profiles\Lua\Modules\Gui\LuaComboBox.cs" />
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.DeviceProviders;
|
using Artemis.DeviceProviders;
|
||||||
using Artemis.Profiles;
|
using Artemis.Profiles;
|
||||||
using Artemis.Profiles.Lua;
|
using Artemis.Profiles.Lua;
|
||||||
using Artemis.Profiles.Lua.Modules;
|
using Artemis.Profiles.Lua.Modules;
|
||||||
|
using Artemis.Profiles.Lua.Modules.Gui;
|
||||||
using Castle.Core.Internal;
|
using Castle.Core.Internal;
|
||||||
using MoonSharp.Interpreter;
|
using MoonSharp.Interpreter;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
@ -24,6 +26,8 @@ namespace Artemis.Managers
|
|||||||
_kernel = kernel;
|
_kernel = kernel;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_deviceManager = deviceManager;
|
_deviceManager = deviceManager;
|
||||||
|
|
||||||
|
EditorButtons = new ObservableCollection<EditorButton>();
|
||||||
LuaScript = new Script(CoreModules.Preset_SoftSandbox);
|
LuaScript = new Script(CoreModules.Preset_SoftSandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +36,7 @@ namespace Artemis.Managers
|
|||||||
public LuaProfileModule ProfileModule { get; private set; }
|
public LuaProfileModule ProfileModule { get; private set; }
|
||||||
public LuaEventsModule EventsModule { get; private set; }
|
public LuaEventsModule EventsModule { get; private set; }
|
||||||
public Script LuaScript { get; }
|
public Script LuaScript { get; }
|
||||||
|
public ObservableCollection<EditorButton> EditorButtons { get; set; }
|
||||||
|
|
||||||
public void SetupLua(ProfileModel profileModel)
|
public void SetupLua(ProfileModel profileModel)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,8 +27,7 @@ namespace Artemis.Models
|
|||||||
private FileSystemWatcher _watcher;
|
private FileSystemWatcher _watcher;
|
||||||
private ModuleModel _luaModule;
|
private ModuleModel _luaModule;
|
||||||
|
|
||||||
public ProfileEditorModel(WindowService windowService, MetroDialogService dialogService,
|
public ProfileEditorModel(WindowService windowService, MetroDialogService dialogService, DeviceManager deviceManager, LuaManager luaManager)
|
||||||
DeviceManager deviceManager, LuaManager luaManager)
|
|
||||||
{
|
{
|
||||||
_windowService = windowService;
|
_windowService = windowService;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
@ -345,7 +344,8 @@ namespace Artemis.Models
|
|||||||
|
|
||||||
private void DisposeLuaWatcher()
|
private void DisposeLuaWatcher()
|
||||||
{
|
{
|
||||||
if (_watcher == null) return;
|
if (_watcher == null)
|
||||||
|
return;
|
||||||
_watcher.Changed -= LuaFileChanged;
|
_watcher.Changed -= LuaFileChanged;
|
||||||
_watcher.Dispose();
|
_watcher.Dispose();
|
||||||
_watcher = null;
|
_watcher = null;
|
||||||
@ -360,8 +360,6 @@ namespace Artemis.Models
|
|||||||
|
|
||||||
#region Rendering
|
#region Rendering
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
<UserControl x:Class="Artemis.Modules.General.GeneralProfile.GeneralProfileView"
|
<UserControl x:Class="Artemis.Modules.General.GeneralProfile.GeneralProfileView" 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:cal="http://www.caliburnproject.org" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" mc:Ignorable="d" d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:cal="http://www.caliburnproject.org"
|
|
||||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
|
|||||||
25
Artemis/Artemis/Profiles/Lua/Modules/Gui/EditorButton.cs
Normal file
25
Artemis/Artemis/Profiles/Lua/Modules/Gui/EditorButton.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Artemis.Managers;
|
||||||
|
using MoonSharp.Interpreter;
|
||||||
|
|
||||||
|
namespace Artemis.Profiles.Lua.Modules.Gui
|
||||||
|
{
|
||||||
|
public class EditorButton
|
||||||
|
{
|
||||||
|
private readonly LuaManager _luaManager;
|
||||||
|
|
||||||
|
public EditorButton(LuaManager luaManager, string text, DynValue action)
|
||||||
|
{
|
||||||
|
_luaManager = luaManager;
|
||||||
|
Text = text;
|
||||||
|
Action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Invoke()
|
||||||
|
{
|
||||||
|
_luaManager.Call(Action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text { get; }
|
||||||
|
public DynValue Action { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -41,10 +41,24 @@ namespace Artemis.Profiles.Lua.Modules
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddEditorButton(string name, DynValue action)
|
||||||
|
{
|
||||||
|
Execute.OnUIThread(() => LuaManager.EditorButtons.Add(new EditorButton(LuaManager, name, action)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveEditorButton(string name)
|
||||||
|
{
|
||||||
|
var button = LuaManager.EditorButtons.FirstOrDefault(b => b.Text == name);
|
||||||
|
if (button != null)
|
||||||
|
Execute.OnUIThread(() => LuaManager.EditorButtons.Remove(button));
|
||||||
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
foreach (var window in _windows)
|
foreach (var window in _windows)
|
||||||
window.TryClose();
|
window.TryClose();
|
||||||
|
|
||||||
|
Execute.OnUIThread(() => LuaManager.EditorButtons.Clear());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ using Artemis.Profiles;
|
|||||||
using Artemis.Profiles.Layers.Interfaces;
|
using Artemis.Profiles.Layers.Interfaces;
|
||||||
using Artemis.Profiles.Layers.Models;
|
using Artemis.Profiles.Layers.Models;
|
||||||
using Artemis.Profiles.Layers.Types.Folder;
|
using Artemis.Profiles.Layers.Types.Folder;
|
||||||
|
using Artemis.Profiles.Lua.Modules.Gui;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.Services;
|
using Artemis.Services;
|
||||||
using Artemis.Styles.DropTargetAdorners;
|
using Artemis.Styles.DropTargetAdorners;
|
||||||
@ -58,8 +59,7 @@ namespace Artemis.ViewModels
|
|||||||
private LayerModel _selectedLayer;
|
private LayerModel _selectedLayer;
|
||||||
private bool _showAll;
|
private bool _showAll;
|
||||||
|
|
||||||
public ProfileEditorViewModel(ProfileEditorModel profileEditorModel, DeviceManager deviceManager,
|
public ProfileEditorViewModel(ProfileEditorModel profileEditorModel, DeviceManager deviceManager, LoopManager loopManager, LuaManager luaManager, ModuleModel moduleModel, MetroDialogService dialogService)
|
||||||
LoopManager loopManager, ModuleModel moduleModel, MetroDialogService dialogService)
|
|
||||||
{
|
{
|
||||||
_deviceManager = deviceManager;
|
_deviceManager = deviceManager;
|
||||||
_loopManager = loopManager;
|
_loopManager = loopManager;
|
||||||
@ -71,6 +71,7 @@ namespace Artemis.ViewModels
|
|||||||
ProfileNames = new ObservableCollection<string>();
|
ProfileNames = new ObservableCollection<string>();
|
||||||
Layers = new ObservableCollection<LayerModel>();
|
Layers = new ObservableCollection<LayerModel>();
|
||||||
ProfileEditorModel = profileEditorModel;
|
ProfileEditorModel = profileEditorModel;
|
||||||
|
LuaManager = luaManager;
|
||||||
ShowAll = true;
|
ShowAll = true;
|
||||||
|
|
||||||
PropertyChanged += EditorStateHandler;
|
PropertyChanged += EditorStateHandler;
|
||||||
@ -101,6 +102,11 @@ namespace Artemis.ViewModels
|
|||||||
|
|
||||||
#region LUA
|
#region LUA
|
||||||
|
|
||||||
|
public void ClickedLuaButton(EditorButton button)
|
||||||
|
{
|
||||||
|
button.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
public void EditLua()
|
public void EditLua()
|
||||||
{
|
{
|
||||||
if (SelectedProfile == null)
|
if (SelectedProfile == null)
|
||||||
@ -122,6 +128,7 @@ namespace Artemis.ViewModels
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public ProfileEditorModel ProfileEditorModel { get; }
|
public ProfileEditorModel ProfileEditorModel { get; }
|
||||||
|
public LuaManager LuaManager { get; }
|
||||||
|
|
||||||
public ObservableCollection<string> ProfileNames
|
public ObservableCollection<string> ProfileNames
|
||||||
{
|
{
|
||||||
@ -711,7 +718,6 @@ namespace Artemis.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Point GetScaledPosition(MouseEventArgs e)
|
private Point GetScaledPosition(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var previewSettings = _deviceManager.ActiveKeyboard.PreviewSettings;
|
var previewSettings = _deviceManager.ActiveKeyboard.PreviewSettings;
|
||||||
|
|||||||
@ -1,16 +1,8 @@
|
|||||||
<UserControl x:Class="Artemis.Views.ProfileEditorView"
|
<UserControl x:Class="Artemis.Views.ProfileEditorView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:dragDrop="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="1060">
|
||||||
xmlns:cal="http://www.caliburnproject.org"
|
|
||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
|
||||||
xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
|
|
||||||
xmlns:dragDrop="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
|
|
||||||
xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
|
|
||||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="400" d:DesignWidth="1060">
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:LayerOrderConverter x:Key="LayerOrderConverter" />
|
<converters:LayerOrderConverter x:Key="LayerOrderConverter" />
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
@ -22,7 +14,8 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="60" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Preview -->
|
<!-- Preview -->
|
||||||
@ -32,7 +25,9 @@
|
|||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect x:Name="ShadowEffect" ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" BlurRadius="25" />
|
<DropShadowEffect x:Name="ShadowEffect" ShadowDepth="0" Color="{DynamicResource HighlightColor}" Opacity="1" BlurRadius="25" />
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
<Image Source="{Binding Path=KeyboardPreview}" MinHeight="10" MinWidth="10" Stretch="Uniform" Cursor="{Binding Path=KeyboardPreviewCursor}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" cal:Message.Attach="
|
<Image Source="{Binding Path=KeyboardPreview}" MinHeight="10" MinWidth="10" Stretch="Uniform" Cursor="{Binding Path=KeyboardPreviewCursor}"
|
||||||
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
|
cal:Message.Attach="
|
||||||
[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
|
[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
|
||||||
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
|
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
|
||||||
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]" />
|
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]" />
|
||||||
@ -43,8 +38,8 @@
|
|||||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
|
||||||
<Label Content="Active profile" />
|
<Label Content="Active profile" />
|
||||||
<ComboBox Width="220" VerticalAlignment="Top" x:Name="ProfileNames" Margin="5,0,0,0" />
|
<ComboBox Width="220" VerticalAlignment="Top" x:Name="ProfileNames" Margin="5,0,0,0" />
|
||||||
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile">
|
ToolTip="Add profile">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -53,9 +48,8 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile"
|
ToolTip="Rename profile" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||||
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -74,7 +68,8 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
|
ToolTip="Delete profile" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -84,17 +79,12 @@
|
|||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left" Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
||||||
<Button x:Name="ImportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="ImportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Height="26" HorizontalAlignment="Right">
|
||||||
Height="26" HorizontalAlignment="Right">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Rectangle
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12" Margin="3,0">
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
|
||||||
Width="12" Height="12" Margin="3,0">
|
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
<VisualBrush Visual="{StaticResource appbar_cabinet_in}" Stretch="Fill" />
|
<VisualBrush Visual="{StaticResource appbar_cabinet_in}" Stretch="Fill" />
|
||||||
</Rectangle.OpacityMask>
|
</Rectangle.OpacityMask>
|
||||||
@ -103,13 +93,11 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="ExportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="ExportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" IsEnabled="{Binding ProfileSelected}">
|
IsEnabled="{Binding ProfileSelected}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Rectangle
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12" Margin="3,0">
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
|
||||||
Width="12" Height="12" Margin="3,0">
|
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
<VisualBrush Visual="{StaticResource appbar_cabinet_out}" Stretch="Fill" />
|
<VisualBrush Visual="{StaticResource appbar_cabinet_out}" Stretch="Fill" />
|
||||||
</Rectangle.OpacityMask>
|
</Rectangle.OpacityMask>
|
||||||
@ -118,14 +106,11 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="EditLua" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Height="26"
|
<Button x:Name="EditLua" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
HorizontalAlignment="Right" Margin="10,0,0,0" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" Visibility="{Binding Path=LuaButtonVisible, Converter={StaticResource BoolToVis} }">
|
||||||
Visibility="{Binding Path=LuaButtonVisible, Converter={StaticResource BoolToVis} }">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Rectangle
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12" Margin="3,0">
|
||||||
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
|
|
||||||
Width="12" Height="12" Margin="3,0">
|
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
<VisualBrush Visual="{StaticResource appbar_code_xml}" Stretch="Fill" />
|
<VisualBrush Visual="{StaticResource appbar_code_xml}" Stretch="Fill" />
|
||||||
</Rectangle.OpacityMask>
|
</Rectangle.OpacityMask>
|
||||||
@ -154,8 +139,7 @@
|
|||||||
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
||||||
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
||||||
<i:Interaction.Behaviors>
|
<i:Interaction.Behaviors>
|
||||||
<itemBehaviours:BindableSelectedItemBehavior
|
<itemBehaviours:BindableSelectedItemBehavior SelectedItem="{Binding SelectedLayer, Mode=TwoWay}" />
|
||||||
SelectedItem="{Binding SelectedLayer, Mode=TwoWay}" />
|
|
||||||
</i:Interaction.Behaviors>
|
</i:Interaction.Behaviors>
|
||||||
<TreeView.Resources>
|
<TreeView.Resources>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||||
@ -185,9 +169,8 @@
|
|||||||
</TreeView>
|
</TreeView>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
|
||||||
<Button x:Name="AddLayer" VerticalAlignment="Top"
|
<Button x:Name="AddLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" Width="26" Height="26"
|
||||||
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
ToolTip="Add layer" HorizontalAlignment="Left">
|
||||||
Width="26" Height="26" ToolTip="Add layer" HorizontalAlignment="Left">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -196,9 +179,8 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="AddFolder" VerticalAlignment="Top"
|
<Button x:Name="AddFolder" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}" Width="26" Height="26"
|
||||||
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
|
ToolTip="Add folder" HorizontalAlignment="Left" Margin="10,0,0,0">
|
||||||
Width="26" Height="26" ToolTip="Add folder" HorizontalAlignment="Left" Margin="10,0,0,0">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -207,8 +189,7 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="EditLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Edit layer"
|
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
IsEnabled="{Binding Path=LayerSelected}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
@ -218,9 +199,8 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="CloneLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="CloneLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate layer"
|
ToolTip="Duplicate layer" IsEnabled="{Binding Path=LayerSelected}">
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -229,9 +209,8 @@
|
|||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="RemoveLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
|
<Button x:Name="RemoveLayer" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}" Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0"
|
||||||
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete layer"
|
ToolTip="Delete layer" IsEnabled="{Binding Path=LayerSelected}">
|
||||||
IsEnabled="{Binding Path=LayerSelected}">
|
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
<Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" Width="12" Height="12">
|
||||||
<Rectangle.OpacityMask>
|
<Rectangle.OpacityMask>
|
||||||
@ -241,5 +220,21 @@
|
|||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock VerticalAlignment="Top" Grid.Column="0" Grid.Row="3" Foreground="{DynamicResource HighlightBrush}" Margin="0,5" HorizontalAlignment="Left"
|
||||||
|
Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold" />
|
||||||
|
|
||||||
|
<ItemsControl ItemsSource="{Binding Path=LuaManager.EditorButtons}" Grid.Column="1" Grid.Row="3" Margin="0,5" HorizontalAlignment="Right">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Content="{Binding Text}" cal:Message.Attach="ClickedLuaButton($dataContext)" Style="{DynamicResource SquareButtonStyle}" Height="26" Margin="5,0,0,0" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Loading…
x
Reference in New Issue
Block a user