mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed volume bar colors and implemented color settings
This commit is contained in:
parent
85c725f1ea
commit
a331bbae91
@ -4,6 +4,7 @@
|
|||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="userSettings"
|
<sectionGroup name="userSettings"
|
||||||
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="Artemis.Settings.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
<section name="Artemis.Settings.AudioVisualization"
|
<section name="Artemis.Settings.AudioVisualization"
|
||||||
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
@ -25,6 +26,17 @@
|
|||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<userSettings>
|
<userSettings>
|
||||||
|
<Artemis.Settings.VolumeDisplay>
|
||||||
|
<setting name="MainColor" serializeAs="String">
|
||||||
|
<value>#FFFF2900</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="SecondaryColor" serializeAs="String">
|
||||||
|
<value>#FF26F600</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="Enabled" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
|
</Artemis.Settings.VolumeDisplay>
|
||||||
<Artemis.Settings.AudioVisualization>
|
<Artemis.Settings.AudioVisualization>
|
||||||
<setting name="Sensitivity" serializeAs="String">
|
<setting name="Sensitivity" serializeAs="String">
|
||||||
<value>4</value>
|
<value>4</value>
|
||||||
|
|||||||
@ -207,6 +207,11 @@
|
|||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
<DependentUpon>TypeWave.settings</DependentUpon>
|
<DependentUpon>TypeWave.settings</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Settings\VolumeDisplay.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<DependentUpon>VolumeDisplay.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Utilities\Audio\FftEventArgs.cs" />
|
<Compile Include="Utilities\Audio\FftEventArgs.cs" />
|
||||||
<Compile Include="Utilities\Audio\SampleAggregator.cs" />
|
<Compile Include="Utilities\Audio\SampleAggregator.cs" />
|
||||||
<Compile Include="Utilities\ColorHelpers.cs" />
|
<Compile Include="Utilities\ColorHelpers.cs" />
|
||||||
@ -286,6 +291,10 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<AppDesigner Include="Properties\" />
|
<AppDesigner Include="Properties\" />
|
||||||
|
<None Include="Settings\VolumeDisplay.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
<Resource Include="Resources\Entypo.ttf" />
|
<Resource Include="Resources\Entypo.ttf" />
|
||||||
<None Include="Settings\AudioVisualization.settings">
|
<None Include="Settings\AudioVisualization.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
|||||||
@ -2,18 +2,22 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
public class VolumeDisplay
|
public class VolumeDisplay
|
||||||
{
|
{
|
||||||
public VolumeDisplay()
|
public VolumeDisplay(VolumeDisplaySettings settings)
|
||||||
{
|
{
|
||||||
|
Settings = settings;
|
||||||
Transparancy = 255;
|
Transparancy = 255;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VolumeDisplaySettings Settings { get; set; }
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public int Ttl { get; set; }
|
public int Ttl { get; set; }
|
||||||
@ -23,10 +27,12 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
|
|
||||||
public void Draw(Graphics g)
|
public void Draw(Graphics g)
|
||||||
{
|
{
|
||||||
var mainColor = Color.FromArgb(Transparancy, 0, 191, 255);
|
var volumeRect = new KeyboardRectangle(Scale, 0, 0, (int) Math.Ceiling(((Scale*21)/100.00)*Volume), 8*Scale,
|
||||||
var secondaryColor = Color.FromArgb(Transparancy, 255, 0, 0);
|
new List<Color>
|
||||||
var volumeRect = new KeyboardRectangle(Scale, 0, 0, (int) Math.Ceiling(((Scale*21)/100.00)*Volume),
|
{
|
||||||
8*Scale, new List<Color> {mainColor, secondaryColor}, LinearGradientMode.Horizontal);
|
ColorHelpers.MediaColorToDrawingColor(Settings.MainColor),
|
||||||
|
ColorHelpers.MediaColorToDrawingColor(Settings.SecondaryColor)
|
||||||
|
}, LinearGradientMode.Horizontal);
|
||||||
volumeRect.Draw(g);
|
volumeRect.Draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
|
|
||||||
Enabled = Settings.Enabled;
|
Enabled = Settings.Enabled;
|
||||||
|
|
||||||
VolumeDisplay = new VolumeDisplay();
|
VolumeDisplay = new VolumeDisplay(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeDisplay VolumeDisplay { get; set; }
|
public VolumeDisplay VolumeDisplay { get; set; }
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Models;
|
using System.Windows.Media;
|
||||||
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
@ -10,27 +11,30 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool DisplayVolume { get; set; }
|
public Color MainColor { get; set; }
|
||||||
public bool DisplayPlayPause { get; set; }
|
public Color SecondaryColor { get; set; }
|
||||||
public bool DisplayPreviousNext { get; set; }
|
|
||||||
public bool DisplayStop { get; set; }
|
|
||||||
|
|
||||||
public override sealed void Load()
|
public override sealed void Load()
|
||||||
{
|
{
|
||||||
ToDefault();
|
Enabled = Settings.VolumeDisplay.Default.Enabled;
|
||||||
|
MainColor = Settings.VolumeDisplay.Default.MainColor;
|
||||||
|
SecondaryColor = Settings.VolumeDisplay.Default.SecondaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override sealed void Save()
|
public override sealed void Save()
|
||||||
{
|
{
|
||||||
|
Settings.VolumeDisplay.Default.Enabled = Enabled;
|
||||||
|
Settings.VolumeDisplay.Default.MainColor = MainColor;
|
||||||
|
Settings.VolumeDisplay.Default.SecondaryColor = SecondaryColor;
|
||||||
|
|
||||||
|
Settings.VolumeDisplay.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override sealed void ToDefault()
|
public override sealed void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
DisplayVolume = true;
|
MainColor = Color.FromArgb(255, 38, 246, 0);
|
||||||
DisplayPlayPause = true;
|
SecondaryColor = Color.FromArgb(255, 255, 41, 0);
|
||||||
DisplayPreviousNext = true;
|
|
||||||
DisplayStop = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,16 +40,18 @@
|
|||||||
<StackPanel Grid.Row="1"
|
<StackPanel Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left">
|
||||||
<Label FontSize="16" Content="Volume bar color" Style="{DynamicResource DescriptionHeaderStyle}"
|
<Label FontSize="16" Content="Main color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||||
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="134" HorizontalAlignment="Left" />
|
FontFamily="Segoe UI Semibold" Foreground="#535353" Width="134" HorizontalAlignment="Left" />
|
||||||
<xctk:ColorPicker x:Name="VolumeBarColor" Width="178" />
|
<xctk:ColorPicker x:Name="MainColor"
|
||||||
|
SelectedColor="{Binding Path=VolumeDisplaySettings.MainColor, Mode=TwoWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="1"
|
<StackPanel Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Left">
|
HorizontalAlignment="Left">
|
||||||
<Label FontSize="16" Content="Volume bar border color" Style="{DynamicResource DescriptionHeaderStyle}"
|
<Label FontSize="16" Content="Secondary color" Style="{DynamicResource DescriptionHeaderStyle}"
|
||||||
FontFamily="Segoe UI Semibold" Foreground="#535353" />
|
FontFamily="Segoe UI Semibold" Foreground="#535353" />
|
||||||
<xctk:ColorPicker x:Name="VolumeBarBorderColor" Width="178" HorizontalAlignment="Left" />
|
<xctk:ColorPicker x:Name="SecondaryColor"
|
||||||
|
SelectedColor="{Binding Path=VolumeDisplaySettings.SecondaryColor, Mode=TwoWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
|||||||
62
Artemis/Artemis/Settings/VolumeDisplay.Designer.cs
generated
Normal file
62
Artemis/Artemis/Settings/VolumeDisplay.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Artemis.Settings {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||||
|
internal sealed partial class VolumeDisplay : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static VolumeDisplay defaultInstance = ((VolumeDisplay)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new VolumeDisplay())));
|
||||||
|
|
||||||
|
public static VolumeDisplay Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
|
||||||
|
public global::System.Windows.Media.Color MainColor {
|
||||||
|
get {
|
||||||
|
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["MainColor"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
|
||||||
|
public global::System.Windows.Media.Color SecondaryColor {
|
||||||
|
get {
|
||||||
|
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["SecondaryColor"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
|
public bool Enabled {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["Enabled"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["Enabled"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Artemis/Artemis/Settings/VolumeDisplay.settings
Normal file
15
Artemis/Artemis/Settings/VolumeDisplay.settings
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="VolumeDisplay">
|
||||||
|
<Profiles />
|
||||||
|
<Settings>
|
||||||
|
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||||
|
<Value Profile="(Default)">#FFFF2900</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||||
|
<Value Profile="(Default)">#FF26F600</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
|
</Settings>
|
||||||
|
</SettingsFile>
|
||||||
@ -130,10 +130,14 @@ namespace Artemis.Utilities.Keyboard
|
|||||||
|
|
||||||
var baseRect = new Rectangle(X, Y, Width, Height);
|
var baseRect = new Rectangle(X, Y, Width, Height);
|
||||||
var brushRect = new Rectangle((int) _rotationProgress, Y, baseRect.Width*2, baseRect.Height*2);
|
var brushRect = new Rectangle((int) _rotationProgress, Y, baseRect.Width*2, baseRect.Height*2);
|
||||||
var baseBrush = new LinearGradientBrush(brushRect, Colors.First(), Colors.Last(), GradientMode)
|
LinearGradientBrush baseBrush;
|
||||||
{InterpolationColors = colorBlend};
|
if (Colors.Count > 5)
|
||||||
g.FillRectangle(baseBrush, baseRect);
|
baseBrush = new LinearGradientBrush(brushRect, Colors.First(), Colors.Skip(1).FirstOrDefault(),
|
||||||
|
GradientMode) {InterpolationColors = colorBlend};
|
||||||
|
else
|
||||||
|
baseBrush = new LinearGradientBrush(baseRect, Colors[0], Colors[1], GradientMode);
|
||||||
|
|
||||||
|
g.FillRectangle(baseBrush, baseRect);
|
||||||
if (!Rotate)
|
if (!Rotate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user