mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Surface editor - Auto-arrange new configs by default
This commit is contained in:
1 parent
8c42c916e8
commit
dcd4a85e37
2 files changed
+15
-5
No files matched your search
@@ -45,9 +45,13 @@ namespace Artemis.Core.Services
|
|||||||
void DeleteSurfaceConfiguration(ArtemisSurface surface);
|
void DeleteSurfaceConfiguration(ArtemisSurface surface);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies auto-arranging logic to the current active surface
|
/// Applies auto-arranging logic to a surface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void AutoArrange();
|
/// <param name="artemisSurface">
|
||||||
|
/// The surface to apply auto-arrange to. If <see langword="null" /> the
|
||||||
|
/// <see cref="ActiveSurface" /> is used.
|
||||||
|
/// </param>
|
||||||
|
void AutoArrange(ArtemisSurface? artemisSurface = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the active device entity has been changed
|
/// Occurs when the active device entity has been changed
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ namespace Artemis.Core.Services
|
|||||||
configuration.Devices.Add(new ArtemisDevice(rgbDevice, deviceProvider, configuration));
|
configuration.Devices.Add(new ArtemisDevice(rgbDevice, deviceProvider, configuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-arrange the new config
|
||||||
|
AutoArrange(configuration);
|
||||||
|
|
||||||
lock (_surfaceConfigurations)
|
lock (_surfaceConfigurations)
|
||||||
{
|
{
|
||||||
_surfaceRepository.Add(configuration.SurfaceEntity);
|
_surfaceRepository.Add(configuration.SurfaceEntity);
|
||||||
@@ -102,6 +105,7 @@ namespace Artemis.Core.Services
|
|||||||
deviceConfiguration.ApplyToRgbDevice();
|
deviceConfiguration.ApplyToRgbDevice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface.UpdateLedMap();
|
surface.UpdateLedMap();
|
||||||
|
|
||||||
_surfaceRepository.Save(surface.SurfaceEntity);
|
_surfaceRepository.Save(surface.SurfaceEntity);
|
||||||
@@ -200,11 +204,13 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
#region AutoLayout
|
#region AutoLayout
|
||||||
|
|
||||||
public void AutoArrange()
|
public void AutoArrange(ArtemisSurface? artemisSurface = null)
|
||||||
{
|
{
|
||||||
|
artemisSurface ??= ActiveSurface;
|
||||||
|
|
||||||
SurfaceArrangement surfaceArrangement = SurfaceArrangement.GetDefaultArrangement();
|
SurfaceArrangement surfaceArrangement = SurfaceArrangement.GetDefaultArrangement();
|
||||||
surfaceArrangement.Arrange(ActiveSurface);
|
surfaceArrangement.Arrange(artemisSurface);
|
||||||
UpdateSurfaceConfiguration(ActiveSurface, true);
|
UpdateSurfaceConfiguration(artemisSurface, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in new issue
Block a user