Datamodel - Added bool and enum support

Layer properties - Added bool support
Draggable float - Housekeeping 🙃
This commit is contained in:
Robert committed 2020-09-17 16:05:33 +02:00
1 parent e921aa2f79
commit 0ef871c337
14 files changed
+165 -9

No files matched your search

@@ -0,0 +1,21 @@
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.BoolDataModelInputView"
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:local="clr-namespace:Artemis.UI.DefaultTypes.DataModel.Input"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</UserControl.Resources>
<ComboBox Width="140"
materialDesign:ComboBoxAssist.ClassicMode="True"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left">
<ComboBoxItem Content="True" IsSelected="{Binding InputValue}" />
<ComboBoxItem Content="False" IsSelected="{Binding InputValue, Converter={StaticResource InverseBooleanConverter}}"/>
</ComboBox>
</UserControl>
@@ -0,0 +1,12 @@
using Artemis.Core.DataModelExpansions;
using Artemis.UI.Shared;
namespace Artemis.UI.DefaultTypes.DataModel.Input
{
public class BoolDataModelInputViewModel : DataModelInputViewModel<bool>
{
public BoolDataModelInputViewModel(DataModelPropertyAttribute targetDescription, bool initialValue) : base(targetDescription, initialValue)
{
}
}
}
@@ -0,0 +1,17 @@
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.EnumDataModelInputView"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ComboBox Width="140"
materialDesign:ComboBoxAssist.ClassicMode="True"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
ItemsSource="{Binding Path=EnumValues}"
SelectedValuePath="Value"
DisplayMemberPath="Description"
SelectedValue="{Binding Path=InputValue}" />
</UserControl>
@@ -0,0 +1,17 @@
using System;
using Artemis.Core.DataModelExpansions;
using Artemis.UI.Shared;
using Stylet;
namespace Artemis.UI.DefaultTypes.DataModel.Input
{
public class EnumDataModelInputViewModel : DataModelInputViewModel<Enum>
{
public EnumDataModelInputViewModel(DataModelPropertyAttribute targetDescription, Enum initialValue) : base(targetDescription, initialValue)
{
EnumValues = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(initialValue.GetType()));
}
public BindableCollection<ValueDescription> EnumValues { get; set; }
}
}
@@ -0,0 +1,27 @@
<UserControl x:Class="Artemis.UI.PropertyInput.BoolPropertyInputView"
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</UserControl.Resources>
<StackPanel Orientation="Horizontal">
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputPrefix}" />
<ComboBox Width="132"
Margin="0 2"
Padding="0 -1"
Height="15"
materialDesign:ComboBoxAssist.ClassicMode="True"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left">
<ComboBoxItem Content="True" IsSelected="{Binding InputValue}" />
<ComboBoxItem Content="False" IsSelected="{Binding InputValue, Converter={StaticResource InverseBooleanConverter}}" />
</ComboBox>
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputAffix}" />
</StackPanel>
</UserControl>
@@ -0,0 +1,15 @@
using Artemis.Core;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
namespace Artemis.UI.PropertyInput
{
public class BoolPropertyInputViewModel : PropertyInputViewModel<bool>
{
public BoolPropertyInputViewModel(LayerProperty<bool> layerProperty, IProfileEditorService profileEditorService) : base(layerProperty, profileEditorService)
{
}
public bool IsEnabled => true;
}
}
@@ -34,7 +34,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update();
profileEditorService.ProfilePreviewUpdated += (sender, args) => Update();
}
public SKPath ShapePath
{
get => _shapePath;
@@ -40,6 +40,8 @@ namespace Artemis.UI.Services
_dataModelUIService.RegisterDataModelInput<IntDataModelInputViewModel>(Constants.CorePluginInfo, Constants.IntegralNumberTypes);
_dataModelUIService.RegisterDataModelInput<SKColorDataModelInputViewModel>(Constants.CorePluginInfo, null);
_dataModelUIService.RegisterDataModelInput<StringDataModelInputViewModel>(Constants.CorePluginInfo, null);
_dataModelUIService.RegisterDataModelInput<EnumDataModelInputViewModel>(Constants.CorePluginInfo, null);
_dataModelUIService.RegisterDataModelInput<BoolDataModelInputViewModel>(Constants.CorePluginInfo, null);
_registeredBuiltInDataModelInputs = true;
}
@@ -57,6 +59,7 @@ namespace Artemis.UI.Services
_profileEditorService.RegisterPropertyInput<SKPointPropertyInputViewModel>(Constants.CorePluginInfo);
_profileEditorService.RegisterPropertyInput<SKSizePropertyInputViewModel>(Constants.CorePluginInfo);
_profileEditorService.RegisterPropertyInput(typeof(EnumPropertyInputViewModel<>), Constants.CorePluginInfo);
_profileEditorService.RegisterPropertyInput<BoolPropertyInputViewModel>(Constants.CorePluginInfo);
_registeredBuiltInPropertyEditors = true;
}