mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Profile editor - Add indicator for timeline editor- and normal-mode
This commit is contained in:
parent
8728599dcc
commit
472bcccdb6
@ -227,6 +227,12 @@ namespace Artemis.UI.Shared.Services
|
||||
/// </summary>
|
||||
event EventHandler PixelsPerSecondChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the suspend editing boolean is changed
|
||||
/// </summary>
|
||||
|
||||
event EventHandler SuspendEditingChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the profile preview has been updated
|
||||
/// </summary>
|
||||
|
||||
@ -112,6 +112,9 @@ namespace Artemis.UI.Shared.Services
|
||||
get => _suspendEditing;
|
||||
set
|
||||
{
|
||||
if (_suspendEditing == value)
|
||||
return;
|
||||
|
||||
_suspendEditing = value;
|
||||
if (value)
|
||||
{
|
||||
@ -123,6 +126,8 @@ namespace Artemis.UI.Shared.Services
|
||||
if (SelectedProfileConfiguration != null)
|
||||
_profileService.RenderForEditor = true;
|
||||
}
|
||||
|
||||
OnSuspendEditingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,6 +510,7 @@ namespace Artemis.UI.Shared.Services
|
||||
public event EventHandler? SelectedDataBindingChanged;
|
||||
public event EventHandler? CurrentTimeChanged;
|
||||
public event EventHandler? PixelsPerSecondChanged;
|
||||
public event EventHandler? SuspendEditingChanged;
|
||||
public event EventHandler? ProfilePreviewUpdated;
|
||||
|
||||
protected virtual void OnSelectedProfileChanged(ProfileConfigurationEventArgs e)
|
||||
@ -537,6 +543,11 @@ namespace Artemis.UI.Shared.Services
|
||||
PixelsPerSecondChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnSuspendEditingChanged()
|
||||
{
|
||||
SuspendEditingChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnProfilePreviewUpdated()
|
||||
{
|
||||
ProfilePreviewUpdated?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- Left side -->
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
@ -444,6 +444,28 @@
|
||||
Width="319" />
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Suspended overlay -->
|
||||
<Border Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.RowSpan="2"
|
||||
Panel.ZIndex="3"
|
||||
Background="#CD353535"
|
||||
Visibility="{Binding SuspendedEditing, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
|
||||
<materialDesign:PackIcon Kind="TimerOffOutline" Width="150" Height="150" HorizontalAlignment="Center" />
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="0 10">
|
||||
Timeline suspended
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center">
|
||||
The profile is currently running in normal mode and the timeline cannot be edited.
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody2TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" TextAlignment="Center">
|
||||
Press <Run Text="F5" FontWeight="Bold"/> to toggle between editor mode and normal mode. Auto-switching can be disabled in the options menu.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</UserControl>
|
||||
@ -122,6 +122,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
set => ProfileEditorService.CurrentTime = TimeSpan.FromSeconds(value / ProfileEditorService.PixelsPerSecond);
|
||||
}
|
||||
|
||||
public bool SuspendedEditing => ProfileEditorService.SuspendEditing;
|
||||
|
||||
public int PropertyTreeIndex
|
||||
{
|
||||
get => _propertyTreeIndex;
|
||||
@ -190,6 +192,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
|
||||
ProfileEditorService.SelectedProfileElementChanged += SelectedProfileEditorServiceOnSelectedProfileElementChanged;
|
||||
ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
|
||||
ProfileEditorService.SuspendEditingChanged += ProfileEditorServiceOnSuspendEditingChanged;
|
||||
ProfileEditorService.SelectedDataBindingChanged += ProfileEditorServiceOnSelectedDataBindingChanged;
|
||||
ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
|
||||
@ -200,6 +203,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
{
|
||||
ProfileEditorService.SelectedProfileElementChanged -= SelectedProfileEditorServiceOnSelectedProfileElementChanged;
|
||||
ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged;
|
||||
ProfileEditorService.SuspendEditingChanged -= ProfileEditorServiceOnSuspendEditingChanged;
|
||||
ProfileEditorService.SelectedDataBindingChanged -= ProfileEditorServiceOnSelectedDataBindingChanged;
|
||||
ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
|
||||
@ -230,6 +234,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnSuspendEditingChanged(object? sender, EventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(SuspendedEditing));
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||
|
||||
@ -326,7 +326,6 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
return;
|
||||
|
||||
_profileEditorService.SuspendEditing = !message.IsFocused;
|
||||
ProfileViewModel.SuspendedEditing = !message.IsFocused;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -34,7 +34,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
private PanZoomViewModel _panZoomViewModel;
|
||||
private Layer _previousSelectedLayer;
|
||||
private int _previousTool;
|
||||
private bool _suspendedEditing;
|
||||
|
||||
public ProfileViewModel(IProfileEditorService profileEditorService,
|
||||
IRgbService rgbService,
|
||||
@ -77,7 +76,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
get => _highlightedLeds;
|
||||
set => SetAndNotify(ref _highlightedLeds, value);
|
||||
}
|
||||
|
||||
|
||||
public VisualizationToolViewModel ActiveToolViewModel
|
||||
{
|
||||
get => _activeToolViewModel;
|
||||
@ -119,11 +118,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
set => SetAndNotify(ref _canApplyToLayer, value);
|
||||
}
|
||||
|
||||
public bool SuspendedEditing
|
||||
{
|
||||
get => _suspendedEditing;
|
||||
set => SetAndNotify(ref _suspendedEditing, value);
|
||||
}
|
||||
public bool SuspendedEditing => _profileEditorService.SuspendEditing;
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
@ -142,12 +137,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
ActivateToolByIndex(0);
|
||||
|
||||
ApplyActiveProfile();
|
||||
|
||||
|
||||
_lastUpdate = DateTime.Now;
|
||||
_coreService.FrameRendered += OnFrameRendered;
|
||||
|
||||
_rgbService.DeviceAdded += RgbServiceOnDevicesModified;
|
||||
_rgbService.DeviceRemoved += RgbServiceOnDevicesModified;
|
||||
_profileEditorService.SuspendEditingChanged += ProfileEditorServiceOnSuspendEditingChanged;
|
||||
_profileEditorService.SelectedProfileChanged += OnSelectedProfileChanged;
|
||||
_profileEditorService.SelectedProfileElementChanged += OnSelectedProfileElementChanged;
|
||||
_profileEditorService.SelectedProfileElementSaved += OnSelectedProfileElementSaved;
|
||||
@ -160,6 +156,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
_coreService.FrameRendered -= OnFrameRendered;
|
||||
_rgbService.DeviceAdded -= RgbServiceOnDevicesModified;
|
||||
_rgbService.DeviceRemoved -= RgbServiceOnDevicesModified;
|
||||
_profileEditorService.SuspendEditingChanged -= ProfileEditorServiceOnSuspendEditingChanged;
|
||||
_profileEditorService.SelectedProfileChanged -= OnSelectedProfileChanged;
|
||||
_profileEditorService.SelectedProfileElementChanged -= OnSelectedProfileElementChanged;
|
||||
_profileEditorService.SelectedProfileElementSaved -= OnSelectedProfileElementSaved;
|
||||
@ -172,7 +169,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
_settingsService.GetSetting("ProfileEditor.PanY", 0d).Save();
|
||||
_settingsService.GetSetting("ProfileEditor.Zoom", 0d).Value = PanZoomViewModel.Zoom;
|
||||
_settingsService.GetSetting("ProfileEditor.Zoom", 0d).Save();
|
||||
|
||||
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
@ -214,6 +211,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
|
||||
private void UpdateCanSelectEditTool()
|
||||
{
|
||||
if (SuspendedEditing)
|
||||
{
|
||||
CanApplyToLayer = false;
|
||||
CanSelectEditTool = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_profileEditorService.SelectedProfileElement is Layer layer)
|
||||
{
|
||||
CanApplyToLayer = true;
|
||||
@ -229,13 +233,18 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
ActivateToolByIndex(2);
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnSuspendEditingChanged(object? sender, EventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(SuspendedEditing));
|
||||
}
|
||||
|
||||
#region Buttons
|
||||
|
||||
private void ActivateToolByIndex(int value)
|
||||
{
|
||||
if (value == 1 && !CanSelectEditTool)
|
||||
return;
|
||||
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user