Signitifantly reduced build size

Updated project folder names
Show only selected layer in visualization
Added rectangle support
This commit is contained in:
Robert committed 2019-12-18 13:05:46 +01:00
1 parent b74a1b2871
commit 04bc8f013a
52 files changed
+373 -633

No files matched your search

+12 -23
View File
@@ -18,26 +18,6 @@
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@@ -490,9 +470,6 @@
<ItemGroup>
<None Include="Resources\bow.svg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\tile.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="FodyWeavers.xml" />
</ItemGroup>
@@ -530,6 +507,11 @@
<None Include="Resources\aero_fill.cur" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<FluentValidationExcludedCultures Include="be;cs;cs-CZ;da;de;es;fa;fi;fr;ja;it;ko;mk;nl;pl;pt;ru;sv;tr;uk;zh-CN;zh-CHS;zh-CHT;uz-Latn-UZ">
<InProject>false</InProject>
</FluentValidationExcludedCultures>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
@@ -545,4 +527,11 @@
<Error Condition="!Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets'))" />
</Target>
<Import Project="..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" />
<!-- The above copies OSX binaries we dont want, clean them up -->
<Target Name="SkiaCleanUpAfterBuild" AfterTargets="AfterBuild">
<Delete Files="$(OutputPath)\libSkiaSharp.dylib" />
</Target>
<Target Name="RemoveTranslationsAfterBuild" AfterTargets="AfterBuild">
<RemoveDir Directories="@(FluentValidationExcludedCultures->'$(OutputPath)%(Filename)')" />
</Target>
</Project>
@@ -4,6 +4,7 @@ using Artemis.Core.Plugins.Abstract;
using Artemis.UI.Screens.Module;
using Artemis.UI.Screens.Module.ProfileEditor;
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
using Artemis.UI.Screens.Settings.Tabs.Devices;
namespace Artemis.UI.Ninject.Factories
@@ -37,4 +38,9 @@ namespace Artemis.UI.Ninject.Factories
{
LayerViewModel Create(TreeItemViewModel parent, ProfileElement folder);
}
public interface IProfileLayerViewModelFactory : IViewModelFactory
{
ProfileLayerViewModel Create(Layer layer);
}
}
-10
View File
@@ -179,15 +179,5 @@ namespace Artemis.UI.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap tile {
get {
object obj = ResourceManager.GetObject("tile", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
-3
View File
@@ -154,7 +154,4 @@
<data name="logo_512" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="tile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

@@ -6,7 +6,29 @@
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.Visualization"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Canvas>
<UserControl.Resources>
<Style TargetType="{x:Type Canvas}" x:Key="SelectedStyle">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="False">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Canvas.Opacity)" To="0" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Canvas.Opacity)" To="1" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Canvas Style="{StaticResource SelectedStyle}">
<!-- The part of the layer's shape that falls outside the layer -->
<Path Data="{Binding ShapeGeometry, Mode=OneWay}" >
<Path.Fill>
@@ -6,20 +6,24 @@ using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerShapes;
using Artemis.Core.Models.Surface;
using Artemis.UI.Extensions;
using Artemis.UI.Services.Interfaces;
using RGB.NET.Core;
using SkiaSharp.Views.WPF;
using Rectangle = Artemis.Core.Models.Profile.LayerShapes.Rectangle;
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
{
public class ProfileLayerViewModel : CanvasViewModel
{
public ProfileLayerViewModel(Layer layer)
private readonly IProfileEditorService _profileEditorService;
public ProfileLayerViewModel(Layer layer, IProfileEditorService profileEditorService)
{
_profileEditorService = profileEditorService;
Layer = layer;
Update();
Layer.RenderPropertiesUpdated += LayerOnRenderPropertiesUpdated;
_profileEditorService.SelectedProfileElementChanged += OnSelectedProfileElementChanged;
}
public Layer Layer { get; }
@@ -28,9 +32,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
public Geometry OpacityGeometry { get; set; }
public Geometry ShapeGeometry { get; set; }
public Rect ViewportRectangle { get; set; }
public bool IsSelected { get; set; }
private void Update()
{
IsSelected = _profileEditorService.SelectedProfileElement == Layer;
CreateLayerGeometry();
CreateShapeGeometry();
CreateViewportRectangle();
@@ -118,8 +124,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
ViewportRectangle = Rect.Empty;
return;
}
var x = Layer.Leds.Min(l => l.RgbLed.AbsoluteLedRectangle.Location.X);
var y = Layer.Leds.Min(l => l.RgbLed.AbsoluteLedRectangle.Location.Y);
var width = Layer.Leds.Max(l => l.RgbLed.AbsoluteLedRectangle.Location.X + l.RgbLed.AbsoluteLedRectangle.Size.Width) - x;
@@ -176,6 +181,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
Update();
}
private void OnSelectedProfileElementChanged(object sender, EventArgs e)
{
IsSelected = _profileEditorService.SelectedProfileElement == Layer;
}
public void Dispose()
{
Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated;
@@ -11,6 +11,7 @@ using Artemis.Core.Plugins.Models;
using Artemis.Core.Services;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.UI.Events;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
using Artemis.UI.Screens.Shared;
using Artemis.UI.Services.Interfaces;
@@ -23,17 +24,23 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
{
private readonly IProfileEditorService _profileEditorService;
private readonly ISettingsService _settingsService;
private readonly IProfileLayerViewModelFactory _profileLayerViewModelFactory;
private readonly ISurfaceService _surfaceService;
private int _activeToolIndex;
private VisualizationToolViewModel _activeToolViewModel;
private int _previousTool;
private TimerUpdateTrigger _updateTrigger;
public ProfileViewModel(IProfileEditorService profileEditorService, ISurfaceService surfaceService, ISettingsService settingsService, IEventAggregator eventAggregator)
public ProfileViewModel(IProfileEditorService profileEditorService,
ISurfaceService surfaceService,
ISettingsService settingsService,
IEventAggregator eventAggregator,
IProfileLayerViewModelFactory profileLayerViewModelFactory)
{
_profileEditorService = profileEditorService;
_surfaceService = surfaceService;
_settingsService = settingsService;
_profileLayerViewModelFactory = profileLayerViewModelFactory;
Execute.OnUIThreadSync(() =>
{
@@ -133,7 +140,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
foreach (var layer in layers)
{
if (layerViewModels.All(vm => vm.Layer != layer))
CanvasViewModels.Add(new ProfileLayerViewModel(layer));
CanvasViewModels.Add(_profileLayerViewModelFactory.Create(layer));
}
// Remove layers that no longer exist
@@ -45,8 +45,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
if (ProfileEditorService.SelectedProfileElement is Layer layer)
{
// Ensure the shape is an ellipse, we're all about ellipses up here
if (!(layer.LayerShape is Ellipse))
layer.LayerShape = new Ellipse(layer);
// Apply the drag rectangle
layer.LayerShape.SetFromUnscaledRectangle(DragRectangle.ToSKRect());
ProfileEditorService.UpdateSelectedProfileElement();
}
@@ -25,15 +25,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
// Find out if the click is inside a layer and if so, fill it
var position = e.GetPosition((IInputElement) sender);
var panZoomVm = ProfileViewModel.PanZoomViewModel;
var layer = ProfileEditorService.SelectedProfile
.GetAllLayers()
.FirstOrDefault(l => l.Leds.Any(
led => panZoomVm.TransformContainingRect(led.RgbLed.AbsoluteLedRectangle).Contains(position))
);
if (layer != null)
layer.LayerShape = new Fill(layer);
if (layer == null)
return;
layer.LayerShape = new Fill(layer);
ProfileEditorService.UpdateSelectedProfileElement();
}
}
}
@@ -1,8 +1,11 @@
using System.IO;
using System.Windows;
using System.Windows.Input;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerShapes;
using Artemis.UI.Properties;
using Artemis.UI.Services.Interfaces;
using SkiaSharp.Views.WPF;
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
{
@@ -34,6 +37,22 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
DragRectangle = GetSquareRectBetweenPoints(MouseDownStartPosition, position);
}
public override void MouseUp(object sender, MouseButtonEventArgs e)
{
base.MouseUp(sender, e);
if (ProfileEditorService.SelectedProfileElement is Layer layer)
{
// Ensure the shape is a rectangle
if (!(layer.LayerShape is Rectangle))
layer.LayerShape = new Rectangle(layer);
// Apply the drag rectangle
layer.LayerShape.SetFromUnscaledRectangle(DragRectangle.ToSKRect());
ProfileEditorService.UpdateSelectedProfileElement();
}
}
public override void KeyUp(KeyEventArgs e)
{
base.KeyUp(e);
+3
View File
@@ -60,7 +60,10 @@ namespace Artemis.UI.Screens
paletteHelper.SetTheme(theme);
var extensionsPaletteHelper = new MaterialDesignExtensions.Themes.PaletteHelper();
// That's nice, then don't use it in your own examples and provide a working alternative
#pragma warning disable 612
extensionsPaletteHelper.SetLightDark(windowsTheme == ThemeWatcher.WindowsTheme.Dark);
#pragma warning restore 612
}
public void WindowDeactivated()
@@ -41,7 +41,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
Session.Close(true);
}
public async Task Cancel()
public void Cancel()
{
Session.Close(false);
}