mirror of
https://github.com/DarthAffe/KeyboardAudioVisualizer.git
synced 2025-12-12 15:18:30 +00:00
Added setting to change the background-brush
This commit is contained in:
parent
7eac420a8e
commit
dde304b007
@ -8,6 +8,8 @@ using KeyboardAudioVisualizer.Configuration;
|
||||
using KeyboardAudioVisualizer.Helper;
|
||||
using KeyboardAudioVisualizer.Legacy;
|
||||
using Newtonsoft.Json;
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Core;
|
||||
using Settings = KeyboardAudioVisualizer.Configuration.Settings;
|
||||
|
||||
namespace KeyboardAudioVisualizer
|
||||
@ -53,7 +55,11 @@ namespace KeyboardAudioVisualizer
|
||||
|
||||
if (settings == null)
|
||||
{
|
||||
settings = new Settings { Version = Settings.CURRENT_VERSION };
|
||||
settings = new Settings
|
||||
{
|
||||
Version = Settings.CURRENT_VERSION,
|
||||
Background = new LinearGradient(new GradientStop(0.1, new Color(64, 0, 0, 0)))
|
||||
};
|
||||
_taskbarIcon.ShowBalloonTip("Keyboard Audio-Visualizer is starting in the tray!", "Click on the icon to open the configuration.", BalloonIcon.Info);
|
||||
}
|
||||
else if (settings.Version != Settings.CURRENT_VERSION)
|
||||
|
||||
@ -75,7 +75,7 @@ namespace KeyboardAudioVisualizer
|
||||
surface.AlignDevices();
|
||||
|
||||
ILedGroup background = new ListLedGroup(surface.Leds);
|
||||
background.Brush = new SolidColorBrush(new Color(64, 0, 0, 0)); //TODO DarthAffe 06.08.2017: A-Channel gives some kind of blur - settings!
|
||||
background.Brush = new LinearGradientBrush(Settings.Background);
|
||||
|
||||
LinearGradient primaryGradient = Settings[VisualizationIndex.Primary].Gradient;
|
||||
LinearGradient secondaryGradient = Settings[VisualizationIndex.Secondary].Gradient;
|
||||
|
||||
@ -22,7 +22,9 @@ namespace KeyboardAudioVisualizer.Configuration
|
||||
public double UpdateRate { get; set; } = 40.0;
|
||||
|
||||
public bool EnableAudioPrescale { get; set; } = false;
|
||||
|
||||
|
||||
public LinearGradient Background { get; set; }
|
||||
|
||||
public Dictionary<VisualizationIndex, VisualizationSettings> Visualizations { get; set; } = new Dictionary<VisualizationIndex, VisualizationSettings>();
|
||||
|
||||
public VisualizationSettings this[VisualizationIndex visualizationIndex]
|
||||
|
||||
@ -163,60 +163,70 @@
|
||||
|
||||
<TabItem Header="Settings">
|
||||
<AdornerDecorator>
|
||||
<GroupBox VerticalAlignment="Top">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style BasedOn="{StaticResource StyleLabelForm}" TargetType="Label" />
|
||||
<Style BasedOn="{StaticResource StyleTextBlockForm}" TargetType="TextBlock" />
|
||||
<Style BasedOn="{StaticResource StyleListBoxForm}" TargetType="ListBox" />
|
||||
</Grid.Resources>
|
||||
<DockPanel LastChildFill="False">
|
||||
<DockPanel.Resources>
|
||||
<Style BasedOn="{StaticResource StyleLabelForm}" TargetType="Label" />
|
||||
<Style BasedOn="{StaticResource StyleTextBlockForm}" TargetType="TextBlock" />
|
||||
<Style BasedOn="{StaticResource StyleListBoxForm}" TargetType="ListBox" />
|
||||
</DockPanel.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="8" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox DockPanel.Dock="Top">
|
||||
<controls:Form>
|
||||
<Label controls:Form.IsLabel="True" Content="Version" />
|
||||
<TextBlock Text="{Binding Version}" />
|
||||
|
||||
<controls:Form Grid.Column="0">
|
||||
<Label controls:Form.IsLabel="True" Content="Version:" />
|
||||
<TextBlock Text="{Binding Version}" />
|
||||
<Label controls:Form.IsLabel="True" Content="Update-Rate" />
|
||||
<Slider Minimum="1" Maximum="60" controls:Form.Fill="True" IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight"
|
||||
Value="{Binding UpdateRate}"
|
||||
attached:SliderValue.Unit="FPS"
|
||||
ToolTip="Defines how fast the data is updated.
Low values can reduce CPU-usage but will cause stuttering.
Values above 40 will only affect the internal calculations and wont make the keyboard update faster.
It's not recommended to select a value > 40." />
|
||||
|
||||
<Label controls:Form.IsLabel="True" Content="Update-Rate" />
|
||||
<Slider Minimum="1" Maximum="60" controls:Form.Fill="True" IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight"
|
||||
Value="{Binding UpdateRate}"
|
||||
attached:SliderValue.Unit="FPS"
|
||||
ToolTip="Defines how fast the data is updated.
Low values can reduce CPU-usage but will cause stuttering.
Values above 40 will only affect the internal calculations and wont make the keyboard update faster.
It's not recommended to select a value > 40." />
|
||||
<Label controls:Form.IsLabel="True" Content="Fix Volume" />
|
||||
<CheckBox VerticalAlignment="Center"
|
||||
IsChecked="{Binding EnableAudioPrescale}"
|
||||
ToolTip="Scales the audio signal inverse to the OS-master-volume.
This might (depending on the system) lead to decrased performance
 -> only activate it if you need it." />
|
||||
|
||||
<Label controls:Form.IsLabel="True" Content="Fix Volume" />
|
||||
<CheckBox VerticalAlignment="Center"
|
||||
IsChecked="{Binding EnableAudioPrescale}"
|
||||
ToolTip="Scales the audio signal inverse to the OS-master-volume.
This might (depending on the system) lead to decrased performance
 -> only activate it if you need it." />
|
||||
</controls:Form>
|
||||
</GroupBox>
|
||||
|
||||
<Label controls:Form.LineBreaks="1" controls:Form.IsLabel="True" Content="Devices:" />
|
||||
</controls:Form>
|
||||
</Grid>
|
||||
<GroupBox Margin="0,8,0,0" DockPanel.Dock="Top">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Border HorizontalAlignment="Left" Width="111">
|
||||
<Label HorizontalAlignment="Right"
|
||||
Content="Background" />
|
||||
</Border>
|
||||
|
||||
<!-- TODO DarthAffe 05.08.2017: Fix the formular to support that use-case -->
|
||||
<ItemsControl VerticalAlignment="Top" HorizontalAlignment="Left" Margin="120,-22,0,0" ItemsSource="{Binding Source={x:Static core:RGBSurface.Instance}, Path=Devices}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Style="{StaticResource StyleTextBlockForm}">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="> {0} {1} ({2})">
|
||||
<Binding Path="DeviceInfo.Manufacturer" />
|
||||
<Binding Path="DeviceInfo.Model" />
|
||||
<Binding Path="DeviceInfo.DeviceType" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<controls:GradientEditor Margin="120,-18,0,0"
|
||||
Gradient="{Binding Source={x:Static keyboardAudioVisualizer:ApplicationManager.Instance}, Path=Settings.Background}"
|
||||
ToolTip="Defines the gradient used as the background. Use transparency to create some kind of blur. Usage:
 Left click inside the preview to add a new stop.
 Left-click stop to change the color or move it.
 Right-click stop to remove it.
" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Margin="0,8,0,0" DockPanel.Dock="Top">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Border HorizontalAlignment="Left" Width="111">
|
||||
<Label HorizontalAlignment="Right"
|
||||
Content="Devices" />
|
||||
</Border>
|
||||
|
||||
<ItemsControl VerticalAlignment="Top" HorizontalAlignment="Left" Margin="120,-18,0,0" ItemsSource="{Binding Source={x:Static core:RGBSurface.Instance}, Path=Devices}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Style="{StaticResource StyleTextBlockForm}">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="> {0} {1} ({2})">
|
||||
<Binding Path="DeviceInfo.Manufacturer" />
|
||||
<Binding Path="DeviceInfo.Model" />
|
||||
<Binding Path="DeviceInfo.DeviceType" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</DockPanel>
|
||||
</AdornerDecorator>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user