Profile tree - Fixed dragging while renaming

Profile tree - Fixed dragging folders onto themselves
Profile tree - Suspend keybinds while renaming
Brushes - Added brush presets UI
Numberbox - Removed double validation error
This commit is contained in:
Robert committed 2022-07-23 21:21:57 +02:00
1 parent a23af68a12
commit 29ef160975
16 files changed
+211 -103

No files matched your search

@@ -50,6 +50,11 @@ public interface IProfileEditorService : IArtemisSharedUIService
/// Gets an observable of the suspended state.
/// </summary>
IObservable<bool> SuspendedEditing { get; }
/// <summary>
/// Gets an observable of the suspended keybindings state.
/// </summary>
IObservable<bool> SuspendedKeybindings { get; }
/// <summary>
/// Gets an observable read only collection of all available editor tools.
@@ -96,6 +101,12 @@ public interface IProfileEditorService : IArtemisSharedUIService
/// </summary>
/// <param name="suspend">The new suspended state.</param>
void ChangeSuspendedEditing(bool suspend);
/// <summary>
/// Changes the current suspended keybindings state.
/// </summary>
/// <param name="suspend">The new suspended state.</param>
void ChangeSuspendedKeybindings(bool suspend);
/// <summary>
/// Selects the provided keyframe.
@@ -30,6 +30,7 @@ internal class ProfileEditorService : IProfileEditorService
private readonly BehaviorSubject<RenderProfileElement?> _profileElementSubject = new(null);
private readonly IProfileService _profileService;
private readonly BehaviorSubject<bool> _suspendedEditingSubject = new(false);
private readonly BehaviorSubject<bool> _suspendedKeybindingsSubject = new(false);
private readonly BehaviorSubject<TimeSpan> _timeSubject = new(TimeSpan.Zero);
private readonly SourceList<IToolViewModel> _tools;
private readonly SourceList<ILayerPropertyKeyframe> _selectedKeyframes;
@@ -64,6 +65,7 @@ internal class ProfileEditorService : IProfileEditorService
Time = _timeSubject.AsObservable();
Playing = _playingSubject.AsObservable();
SuspendedEditing = _suspendedEditingSubject.AsObservable();
SuspendedKeybindings = _suspendedKeybindingsSubject.AsObservable();
PixelsPerSecond = _pixelsPerSecondSubject.AsObservable();
Tools = tools;
SelectedKeyframes = selectedKeyframes;
@@ -80,7 +82,7 @@ internal class ProfileEditorService : IProfileEditorService
.Throttle(TimeSpan.FromSeconds(1))
.SelectMany(async _ => await AutoSaveProfileAsync())
.Subscribe();
// When the main window closes, stop editing
mainWindowService.MainWindowClosed += (_, _) => ChangeCurrentProfileConfiguration(null);
}
@@ -90,6 +92,7 @@ internal class ProfileEditorService : IProfileEditorService
public IObservable<ILayerProperty?> LayerProperty { get; }
public IObservable<ProfileEditorHistory?> History { get; }
public IObservable<bool> SuspendedEditing { get; }
public IObservable<bool> SuspendedKeybindings { get; }
public IObservable<TimeSpan> Time { get; }
public IObservable<bool> Playing { get; }
public IObservable<int> PixelsPerSecond { get; }
@@ -138,6 +141,7 @@ internal class ProfileEditorService : IProfileEditorService
_profileConfigurationSubject.OnNext(profileConfiguration);
ChangeTime(TimeSpan.Zero);
ChangeSuspendedKeybindings(false);
}
public void ChangeCurrentProfileElement(RenderProfileElement? renderProfileElement)
@@ -178,6 +182,14 @@ internal class ProfileEditorService : IProfileEditorService
}
}
public void ChangeSuspendedKeybindings(bool suspend)
{
if (_suspendedKeybindingsSubject.Value == suspend)
return;
_suspendedKeybindingsSubject.OnNext(suspend);
}
public void SelectKeyframe(ILayerPropertyKeyframe? keyframe, bool expand, bool toggle)
{
if (keyframe == null)
@@ -24,83 +24,6 @@
</Design.PreviewWith>
<!-- Add Styles Here -->
<Style Selector="TextBox.NumberBoxTextBoxStyle">
<Setter Property="Template">
<ControlTemplate>
<DataValidationErrors>
<Panel>
<Border Name="PART_BorderElement"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
RenderTransform="scaleY(-1)"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border Margin="{TemplateBinding BorderThickness}">
<Grid ColumnDefinitions="Auto,*,Auto" >
<TextBlock Name="PART_Prefix"
Text="{TemplateBinding attachedProperties:TextBoxAssist.PrefixText}"
Padding="{TemplateBinding Padding}"
IsHitTestVisible="False"/>
<DockPanel x:Name="PART_InnerDockPanel"
Grid.Column="1"
Grid.ColumnSpan="1"
Margin="{TemplateBinding Padding}">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel>
<TextBlock Name="PART_Watermark"
Text="{TemplateBinding Watermark}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsHitTestVisible="False"/>
<TextPresenter Name="PART_TextPresenter"
Text="{TemplateBinding Text, Mode=TwoWay}"
CaretIndex="{TemplateBinding CaretIndex}"
SelectionStart="{TemplateBinding SelectionStart}"
SelectionEnd="{TemplateBinding SelectionEnd}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
CaretBrush="{TemplateBinding CaretBrush}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Panel>
</ScrollViewer>
</DockPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.ColumnSpan="1">
<TextBlock Name="PART_Suffix"
Text="{TemplateBinding attachedProperties:TextBoxAssist.SuffixText}"
Padding="{TemplateBinding Padding}"
IsHitTestVisible="False"/>
<ContentPresenter Content="{TemplateBinding InnerRightContent}"
Name="InnerRightContent"/>
<Viewbox Margin="{DynamicResource NumberBoxPopupIndicatorMargin}"
VerticalAlignment="Center" HorizontalAlignment="Center"
Width="18" Height="18"
Name="PopupIndicator">
<controls:FontIcon Glyph="&#xEC8F;"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="24"
Foreground="{DynamicResource NumberBoxPopupIndicatorForeground}" />
</Viewbox>
</StackPanel>
</Grid>
</Border>
</Panel>
</DataValidationErrors>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="controls|NumberBox /template/ TextBox.NumberBoxTextBoxStyle /template/ TextBlock#PART_Prefix">
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}"></Setter>
<Setter Property="Margin" Value="-4 0 -12 0"></Setter>
@@ -122,8 +45,4 @@
<Setter Property="attachedProperties:TextBoxAssist.PrefixText" Value="{TemplateBinding attachedProperties:NumberBoxAssist.PrefixText}"></Setter>
<Setter Property="attachedProperties:TextBoxAssist.SuffixText" Value="{TemplateBinding attachedProperties:NumberBoxAssist.SuffixText}"></Setter>
</Style>
<Style Selector="controls|NumberBox /template/ TextBox.NumberBoxTextBoxStyle">
<Setter Property="DataValidationErrors.Errors" Value="{TemplateBinding DataValidationErrors.Errors}" />
</Style>
</Styles>