mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-03-24 02:08:47 +00:00
Added functionality to disable brush types in ColorBox
This commit is contained in:
parent
481f1aab3b
commit
edd9cf5332
@ -1,9 +1,10 @@
|
||||
<UserControl x:Class="Artemis.Profiles.Layers.Types.Generic.GenericPropertiesView"
|
||||
<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"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
xmlns:ObjectModel="clr-namespace:System.Collections.ObjectModel;assembly=System" x:Class="Artemis.Profiles.Layers.Types.Generic.GenericPropertiesView"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="500">
|
||||
<Grid>
|
||||
@ -23,54 +24,46 @@
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Animation -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
VerticalAlignment="Center"
|
||||
Height="18" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10,10,10,0" x:Name="LayerAnimations" VerticalAlignment="Top"
|
||||
Height="22">
|
||||
Height="22">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- Animation Speed -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Margin="10" FontSize="13.333" Text="Animation speed:"
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
VerticalAlignment="Center" Height="18" />
|
||||
<Slider x:Name="RotationSpeed" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding Path=LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
TickPlacement="None" TickFrequency="0.05"
|
||||
Value="{Binding LayerModel.Properties.AnimationSpeed, Mode=TwoWay}" Minimum="0.05" Maximum="3"
|
||||
SmallChange="0" IsSnapToTickEnabled="True" Margin="10,12,10,2" Height="24" />
|
||||
|
||||
<!-- Colors -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Brush, Mode=TwoWay}" Height="24" Width="134"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Dynamic -->
|
||||
<Label Grid.Row="3" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
Content="Dynamic" Width="97" VerticalAlignment="Bottom" />
|
||||
|
||||
<!-- Dynamic property views -->
|
||||
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
|
||||
|
||||
<!-- Note -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap">
|
||||
<Run Text="Note: Generic devices are devices over which Artemis has limited control." /><LineBreak />
|
||||
<Run /><LineBreak />
|
||||
<Run Text="You can use this layer type to assign a color to all generic devices at once." /><LineBreak />
|
||||
<Run
|
||||
Text="Should your generic device have multiple LEDs, Artemis will try to take the colors from the Brush and spread them over the LEDs." />
|
||||
<LineBreak /><Run /><LineBreak /><Run Text="Examples of supported generic devices:" /><LineBreak />
|
||||
<Run Text="- Logitech mice and headsets" /><LineBreak /><Run Text="- Logitech G19" /><LineBreak />
|
||||
<Run Text="- Logitech G510" /><LineBreak /><Run />
|
||||
</TextBlock>
|
||||
Foreground="{DynamicResource HighlightBrush}"
|
||||
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap"><Run Text="Note: Generic devices are devices over which Artemis has limited control." /><LineBreak /><Run /><LineBreak /><Run Text="You can use this layer type to assign a color to all generic devices at once." /><LineBreak /><Run
|
||||
Text="Should your generic device have multiple LEDs, Artemis will try to take the colors from the Brush and spread them over the LEDs." /><LineBreak /><Run /><LineBreak /><Run Text="Examples of supported generic devices:" /><LineBreak /><Run Text="- Logitech mice and headsets" /><LineBreak /><Run Text="- Logitech G19" /><LineBreak /><Run Text="- Logitech G510" /><LineBreak /><Run /></TextBlock>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@ -1,13 +1,16 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Profiles.Layers.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Caliburn.Micro;
|
||||
using ColorBox;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Types.Generic
|
||||
{
|
||||
public class GenericPropertiesViewModel : LayerPropertiesViewModel
|
||||
{
|
||||
private IEnumerable<BrushTypes> _availableBrushTypes;
|
||||
private ILayerAnimation _selectedLayerAnimation;
|
||||
|
||||
public GenericPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm)
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
VerticalAlignment="Top" Height="18" Width="130" />
|
||||
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||
<ncore:ColorBox Brush="{Binding Path=Brush, Mode=TwoWay}" Height="24" Width="134" ShowSolid="False"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@
|
||||
<!-- Available brush types -->
|
||||
<ListBox x:Name="listAvailableBrushType" HorizontalContentAlignment="Center"
|
||||
SelectedItem="{Binding BrushType, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
ItemsSource="{Binding AvailableBrushTypes, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
ItemsSource="{Binding AvailableBrushTypes, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Rows="1" Columns="4" />
|
||||
@ -219,7 +219,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Border x:Name="Border" Background="Transparent"
|
||||
Padding="0,3">
|
||||
Padding="0,3" Margin="3,0">
|
||||
<Path x:Name="Icon" Height="12" Width="20"
|
||||
Stretch="Fill" Fill="#FF403C3C"
|
||||
StrokeThickness="1"
|
||||
|
||||
@ -9,9 +9,12 @@
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace ColorBox
|
||||
{
|
||||
internal enum BrushTypes
|
||||
[Flags]
|
||||
public enum BrushTypes
|
||||
{
|
||||
None,
|
||||
Solid,
|
||||
|
||||
@ -655,10 +655,14 @@ namespace ColorBox
|
||||
{
|
||||
get
|
||||
{
|
||||
var temp = BrushTypes.None | BrushTypes.Solid | BrushTypes.Linear | BrushTypes.Radial;
|
||||
foreach (Enum value in Enum.GetValues(temp.GetType()))
|
||||
if (temp.HasFlag(value))
|
||||
yield return value;
|
||||
if (ShowNone)
|
||||
yield return BrushTypes.None;
|
||||
if (ShowSolid)
|
||||
yield return BrushTypes.Solid;
|
||||
if (ShowLinear)
|
||||
yield return BrushTypes.Linear;
|
||||
if (ShowRadial)
|
||||
yield return BrushTypes.Radial;
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,9 +672,44 @@ namespace ColorBox
|
||||
set { SetValue(BrushProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty BrushProperty =
|
||||
DependencyProperty.Register("Brush", typeof(Brush), typeof(ColorBox)
|
||||
, new FrameworkPropertyMetadata(null, BrushChanged));
|
||||
public bool ShowNone
|
||||
{
|
||||
get { return (bool) GetValue(ShowNoneProperty); }
|
||||
set { SetValue(ShowNoneProperty, value); }
|
||||
}
|
||||
|
||||
public bool ShowSolid
|
||||
{
|
||||
get { return (bool) GetValue(ShowSolidProperty); }
|
||||
set { SetValue(ShowSolidProperty, value); }
|
||||
}
|
||||
|
||||
public bool ShowLinear
|
||||
{
|
||||
get { return (bool) GetValue(ShowLinearProperty); }
|
||||
set { SetValue(ShowLinearProperty, value); }
|
||||
}
|
||||
|
||||
public bool ShowRadial
|
||||
{
|
||||
get { return (bool) GetValue(ShowRadialProperty); }
|
||||
set { SetValue(ShowRadialProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowNoneProperty = DependencyProperty.Register("ShowNone",
|
||||
typeof(bool), typeof(ColorBox), new FrameworkPropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty ShowSolidProperty = DependencyProperty.Register("ShowSolid",
|
||||
typeof(bool), typeof(ColorBox), new FrameworkPropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty ShowLinearProperty = DependencyProperty.Register("ShowLinear",
|
||||
typeof(bool), typeof(ColorBox), new FrameworkPropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty ShowRadialProperty = DependencyProperty.Register("ShowRadial",
|
||||
typeof(bool), typeof(ColorBox), new FrameworkPropertyMetadata(true));
|
||||
|
||||
public static readonly DependencyProperty BrushProperty = DependencyProperty.Register("Brush", typeof(Brush),
|
||||
typeof(ColorBox), new FrameworkPropertyMetadata(null, BrushChanged));
|
||||
|
||||
private static void BrushChanged(DependencyObject property, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user