Skip to content

Commit

Permalink
Reverted project back to 1.2.0 and restarted the migration process, t…
Browse files Browse the repository at this point in the history
…his is the 2019 version, 1.3.3, added new Settings class to handle settings myself, especially for Colors which has been broken for years in Microsoft's SDK.
  • Loading branch information
korypostma committed Mar 31, 2023
1 parent 2473acb commit ef6411c
Show file tree
Hide file tree
Showing 36 changed files with 663 additions and 1,376 deletions.
42 changes: 3 additions & 39 deletions BlackSpace.sln
Original file line number Diff line number Diff line change
@@ -1,58 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33214.272
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlackSpace2022", "BlackSpace\BlackSpace2022.csproj", "{7AD2B41A-974B-4B31-91E7-3E137D8AD273}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BlackSpaceShared", "BlackSpaceShared\BlackSpaceShared.shproj", "{D171E5DB-D9DE-4B08-B24F-3B21056E779D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlackSpace2019", "BlackSpace2019\BlackSpace2019.csproj", "{D2A1455F-A0E8-4239-8368-782AFEEFBE65}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlackSpace", "BlackSpace\BlackSpace.csproj", "{7AD2B41A-974B-4B31-91E7-3E137D8AD273}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
BlackSpaceShared\BlackSpaceShared.projitems*{7ad2b41a-974b-4b31-91e7-3e137d8ad273}*SharedItemsImports = 4
BlackSpaceShared\BlackSpaceShared.projitems*{d171e5db-d9de-4b08-b24f-3b21056e779d}*SharedItemsImports = 13
BlackSpaceShared\BlackSpaceShared.projitems*{d2a1455f-a0e8-4239-8368-782afeefbe65}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|arm64 = Debug|arm64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|arm64 = Release|arm64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|arm64.ActiveCfg = Debug|arm64
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|arm64.Build.0 = Debug|arm64
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|x86.ActiveCfg = Debug|x86
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Debug|x86.Build.0 = Debug|x86
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|Any CPU.Build.0 = Release|Any CPU
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|arm64.ActiveCfg = Release|arm64
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|arm64.Build.0 = Release|arm64
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|x86.ActiveCfg = Release|x86
{7AD2B41A-974B-4B31-91E7-3E137D8AD273}.Release|x86.Build.0 = Release|x86
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|arm64.ActiveCfg = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|arm64.Build.0 = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|x86.ActiveCfg = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Debug|x86.Build.0 = Debug|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|Any CPU.Build.0 = Release|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|arm64.ActiveCfg = Release|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|arm64.Build.0 = Release|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|x86.ActiveCfg = Release|Any CPU
{D2A1455F-A0E8-4239-8368-782AFEEFBE65}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD56EC77-AB07-4C02-8EFE-2F08DC50EE8D}
EndGlobalSection
EndGlobal
99 changes: 70 additions & 29 deletions BlackSpace/BlackSpace2022.csproj → BlackSpace/BlackSpace.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,66 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="BlackSpaceOptionsPackage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BlackSpaceSettings.cs" />
<Compile Include="DeleteWhiteSpaceWhenSavingCommandHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BlackSpaceAdornment.cs" />
<Compile Include="BlackSpaceAdornmentTextViewCreationListener.cs" />
<Compile Include="DeleteWhiteSpaceWhenSaving.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Key.snk" />
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="BlackSpace.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="BlackSpaceDesat.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="BlackSpaceLarge.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="BlackSpacePreview.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="index.html" />
<Content Include="LICENSE-2.0.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="RELEASE-NOTES.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\BlackSpaceOptionsPackage.ico" />
<Content Include="stylesheet.css" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Editor, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Shell.Framework, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.UI, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
Expand All @@ -73,43 +124,33 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Editor">
<Version>17.4.255</Version>
<EmbeddedResource Include="VSPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.CommandBars">
<Version>16.10.31320.204</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK">
<Version>16.10.31321.278</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Interop">
<Version>17.4.33103.184</Version>
<PackageReference Include="Microsoft.VisualStudio.Threading">
<Version>16.10.56</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0">
<Version>17.4.33103.184</Version>
<PackageReference Include="Microsoft.VisualStudio.Validation">
<Version>16.10.35</Version>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools">
<Version>17.4.2120</Version>
<Version>16.11.69</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="LICENSE-2.0.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\BlackSpace.ico" />
<Content Include="Resources\BlackSpaceDesat.ico" />
<Content Include="Resources\BlackSpaceLarge.ico">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\BlackSpaceOptionsPackage.ico" />
<Content Include="Resources\BlackSpacePreview.png">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\LICENSE-2.0.txt">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\RELEASE-NOTES.txt">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<Import Project="..\BlackSpaceShared\BlackSpaceShared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <copyright file="BlackSpaceAdornment.cs" company="Kory Postma">
//
// Copyright 2016-2017 Kory Postma
// Copyright 2016-2023 Kory Postma
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,14 @@ namespace BlackSpace
/// </summary>
internal sealed class BlackSpaceAdornment
{
#region Static Functions
public static Color ToMediaColor(System.Drawing.Color inColor)
{
return Color.FromArgb(inColor.A, inColor.R, inColor.G, inColor.B);
}
#endregion

#region Member Variables
/// <summary>
/// The layer of the adornment.
/// </summary>
Expand All @@ -42,6 +50,13 @@ internal sealed class BlackSpaceAdornment
/// </summary>
private readonly IWpfTextView view;

[Import]
public ITextDocumentFactoryService TextDocumentFactoryService
{
get;
private set;
}

/// <summary>
/// Adornment brushs.
/// </summary>
Expand All @@ -50,28 +65,67 @@ internal sealed class BlackSpaceAdornment
private Brush tabsBrush;
private Pen tabsPen;

public static BlackSpaceOptionsPackage Package
public System.Windows.Media.Brush SpacesBrush
{
get;
private set;
get
{
if (spacesBrush == null)
{
spacesBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(0xa0, 0x2b, 0x00, 0x95));
spacesBrush.Freeze();
}

return spacesBrush;
}
}

[Import]
public ITextDocumentFactoryService TextDocumentFactoryService
public System.Windows.Media.Pen SpacesPen
{
get;
private set;
get
{
if (spacesPen == null)
{
var spacesPenBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(0xff, 0x2b, 0x00, 0xb5));
spacesPenBrush.Freeze();
spacesPen = new System.Windows.Media.Pen(spacesPenBrush, 1.0);
spacesPen.Freeze();
}

return spacesPen;
}
}

/// <summary>
/// Initializes the singleton instance of the command.
/// </summary>
/// <param name="inPackage">Owner package, not null.</param>
public static void Initialize(BlackSpaceOptionsPackage inPackage)
public System.Windows.Media.Brush TabsBrush
{
Package = inPackage;
get
{
if (tabsBrush == null)
{
tabsBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(0xa0, 0x2b, 0x00, 0x65));
tabsBrush.Freeze();
}

return tabsBrush;
}
}

public System.Windows.Media.Pen TabsPen
{
get
{
if (tabsPen == null)
{
var tabsPenBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(0xff, 0x3b, 0x00, 0x85));
tabsPenBrush.Freeze();
tabsPen = new System.Windows.Media.Pen(tabsPenBrush, 1.0);
tabsPen.Freeze();
}

return tabsPen;
}
}
#endregion

/// <summary>
/// Initializes a new instance of the <see cref="BlackSpaceAdornment"/> class.
/// </summary>
Expand All @@ -83,33 +137,13 @@ public BlackSpaceAdornment(IWpfTextView view)
throw new ArgumentNullException("view");
}

this.layer = view.GetAdornmentLayer("BlackSpaceTextAdornment");
layer = view.GetAdornmentLayer("BlackSpaceTextAdornment");

this.view = view;
this.view.LayoutChanged += this.OnLayoutChanged;
this.view.LayoutChanged += OnLayoutChanged;

if (Package != null)
{
//This will also update all of the brushes
Package.RegisterAdornment(this);
}
else
{
// Create the pen and brush to color the boxes around the end-of-line whitespace
spacesBrush = new SolidColorBrush(Color.FromArgb(0xa0, 0x2b, 0x00, 0x95));
spacesBrush.Freeze();
var spacesPenBrush = new SolidColorBrush(Color.FromArgb(0xff, 0x2b, 0x00, 0xb5));
spacesPenBrush.Freeze();
spacesPen = new Pen(spacesPenBrush, 1.0);
spacesPen.Freeze();

tabsBrush = new SolidColorBrush(Color.FromArgb(0xa0, 0x2b, 0x00, 0x65));
tabsBrush.Freeze();
var tabsPenBrush = new SolidColorBrush(Color.FromArgb(0xff, 0x3b, 0x00, 0x85));
tabsPenBrush.Freeze();
tabsPen = new Pen(tabsPenBrush, 1.0);
tabsPen.Freeze();
}
//Register this adornment, will cause it to load user settings and LoadSettings will update brushes
BlackSpaceSettings.Instance.RegisterAdornment(this);
}

/// <summary>
Expand Down Expand Up @@ -178,6 +212,27 @@ private void CreateVisuals(ITextViewLine line)
}
}

public void UpdateBrushesAndPens(Settings settings)
{
//Create the brushes and pens to color the end-of-line white-spaces
var spacesBrush = new SolidColorBrush(ToMediaColor(settings.Spaces.BackgroundColor));
spacesBrush.Freeze();
var spacesPenBrush = new SolidColorBrush(ToMediaColor(settings.Spaces.BorderColor));
spacesPenBrush.Freeze();
var spacesPen = new Pen(spacesPenBrush, settings.Spaces.BorderThickness);
spacesPen.Freeze();

var tabsBrush = new SolidColorBrush(ToMediaColor(settings.Tabs.BackgroundColor));
tabsBrush.Freeze();
var tabsPenBrush = new SolidColorBrush(ToMediaColor(settings.Tabs.BorderColor));
tabsPenBrush.Freeze();
var tabsPen = new Pen(tabsPenBrush, settings.Tabs.BorderThickness);
tabsPen.Freeze();

//Generate the brushes and pens
UpdateBrushesAndPens(spacesBrush, spacesPen, tabsBrush, tabsPen);
}

public void UpdateBrushesAndPens(Brush inSpacesBrush, Pen inSpacesPen, Brush inTabsBrush, Pen inTabsPen)
{
spacesBrush = inSpacesBrush;
Expand Down
Loading

0 comments on commit ef6411c

Please sign in to comment.