Profile editor - Added F5 hotkey to toggle normal profile playback

Profile editor - Disable toolbar and tools during normal profile playback
Layer conditions - Properly apply Skip To End stop-mode on profile start
This commit is contained in:
Robert committed 2021-07-02 23:18:50 +02:00
1 parent 472bcccdb6
commit 51a5724adf
14 files changed
+110 -37

No files matched your search

@@ -1,4 +1,4 @@
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.Visualization.ProfileView"
<UserControl
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"
@@ -7,9 +7,13 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:visualization="clr-namespace:Artemis.UI.Screens.ProfileEditor.Visualization"
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
xmlns:Converters="clr-namespace:Artemis.UI.Converters" x:Class="Artemis.UI.Screens.ProfileEditor.Visualization.ProfileView"
mc:Ignorable="d"
d:DesignHeight="510.9" d:DesignWidth="800"
d:DataContext="{d:DesignInstance {x:Type visualization:ProfileViewModel}}">
<UserControl.Resources>
<Converters:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
@@ -27,13 +31,16 @@
<ListBoxItem ToolTip="Pan over different parts of the surface - Ctrl">
<materialDesign:PackIcon Kind="HandLeft" />
</ListBoxItem>
<ListBoxItem ToolTip="Transform layer shape (hold SHIFT for incremental changes and X/Y snapping) - Ctrl+T" IsEnabled="{Binding CanSelectEditTool}">
<ListBoxItem ToolTip="Transform layer shape (hold SHIFT for incremental changes and X/Y snapping) - Ctrl+T"
IsEnabled="{Binding CanSelectEditTool}">
<materialDesign:PackIcon Kind="TransitConnectionVariant" />
</ListBoxItem>
<ListBoxItem ToolTip="Change layer selection (hold SHIFT to add to existing selection) - Ctrl+Q">
<ListBoxItem ToolTip="Change layer selection (hold SHIFT to add to existing selection) - Ctrl+Q"
IsEnabled="{Binding SuspendedEditing, Converter={StaticResource InverseBooleanConverter}, Mode=OneWay}">
<materialDesign:PackIcon Kind="SelectionDrag" />
</ListBoxItem>
<ListBoxItem ToolTip="Remove from layer selection - Ctrl+W">
<ListBoxItem ToolTip="Remove from layer selection - Ctrl+W"
IsEnabled="{Binding SuspendedEditing, Converter={StaticResource InverseBooleanConverter}, Mode=OneWay}">
<materialDesign:PackIcon Kind="SelectOff" />
</ListBoxItem>
</ListBox>
@@ -71,7 +78,7 @@
</VisualBrush>
</Grid.Background>
<Grid Name="DeviceDisplayGrid">
<Grid x:Name="DeviceDisplayGrid">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding PanZoomViewModel.Zoom}" ScaleY="{Binding PanZoomViewModel.Zoom}" />
@@ -85,7 +92,7 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Style TargetType="{x:Type ContentPresenter}">
<Setter Property="Canvas.Left" Value="{Binding X}" />
<Setter Property="Canvas.Top" Value="{Binding Y}" />
</Style>
@@ -94,13 +101,13 @@
<DataTemplate>
<shared:DeviceVisualizer Device="{Binding}"
ShowColors="True"
HighlightedLeds="{Binding DataContext.HighlightedLeds, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Mode=OneWay}" />
HighlightedLeds="{Binding DataContext.HighlightedLeds, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
<Grid Name="EditorDisplayGrid"
<Grid x:Name="EditorDisplayGrid"
Visibility="{Binding SuspendedEditing, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}"
shared:SizeObserver.Observe="True"
shared:SizeObserver.ObservedHeight="{Binding PanZoomViewModel.CanvasHeight}"
@@ -118,7 +125,7 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Style TargetType="{x:Type ContentPresenter}">
<Setter Property="Canvas.Left" Value="{Binding X}" />
<Setter Property="Canvas.Top" Value="{Binding Y}" />
</Style>
@@ -130,9 +137,9 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
<StackPanel Orientation="Vertical" VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="10" ZIndex="1">
Margin="10" Panel.ZIndex="1">
<Slider Orientation="Vertical"
HorizontalAlignment="Center"
Margin="0 10"
@@ -232,12 +232,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
if (CanSelectEditTool == false && ActiveToolIndex == 1)
ActivateToolByIndex(2);
}
private void ProfileEditorServiceOnSuspendEditingChanged(object? sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(SuspendedEditing));
}
#region Buttons
private void ActivateToolByIndex(int value)
@@ -315,7 +310,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
TimeSpan delta = DateTime.Now - _lastUpdate;
_lastUpdate = DateTime.Now;
if (!_settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", true).Value || _profileEditorService.SelectedProfile == null)
if (SuspendedEditing || !_settingsService.GetSetting("ProfileEditor.AlwaysApplyDataBindings", true).Value || _profileEditorService.SelectedProfile == null)
return;
foreach (IDataBindingRegistration dataBindingRegistration in _profileEditorService.SelectedProfile.GetAllFolders()
@@ -396,6 +391,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
ActivateToolByIndex(2);
}
private void ProfileEditorServiceOnSuspendEditingChanged(object? sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(SuspendedEditing));
UpdateCanSelectEditTool();
}
public void Handle(MainWindowKeyEvent message)
{
if (message.KeyDown)
@@ -32,6 +32,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
{
base.MouseUp(sender, e);
if (ProfileEditorService.SuspendEditing)
return;
Point position = PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new(MouseDownStartPosition, position);
@@ -37,6 +37,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
{
base.MouseUp(sender, e);
if (ProfileEditorService.SuspendEditing)
return;
Point position = PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new(MouseDownStartPosition, position);