Skip to content

Commit

Permalink
Ribbon with new AssemblyVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
harborsiem committed Jun 28, 2022
1 parent 134e9a1 commit 573b4ef
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 23 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### Ribbon V2.11.1, RibbonTools V1.3.7+
### Ribbon V2.12.0, RibbonTools V1.4.0

#### Changed (Ribbon)

- AssemblyVersion is now 1.0.0.0 for .NET Framework 3.5. This version is installed to the GAC. For all other (.NET Framework 4.0 and higher, .NET Core) the AssemblyVersion is 4.0.0.0. These changes are done for easier handling with different .Net versions, mainly for .NET Framework 4.x.

#### Changed (RibbonTools)

- Added functions (and small changes) to AlphaBitmap, NativeMethods
- Project files changes to the Ribbon with Assembly version 4.0.0.0
- So we don't need to activate the .NET Framework 3.5 in the Windows System

#### Changed Setup files


### Ribbon V2.11.1, RibbonTools V1.3.7

Expand Down
8 changes: 6 additions & 2 deletions Ribbon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RibbonLib")]
[assembly: AssemblyProduct("Ribbon")]
[assembly: AssemblyCopyright("Copyright © 2009, 2021")]
[assembly: AssemblyCopyright("Copyright © 2009, 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,6 +32,10 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
#if NET || NET40 || NETCOREAPP3_1
[assembly: AssemblyVersion("4.0.0.0")]
#else
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("2.11.1.0")]
#endif
[assembly: AssemblyFileVersion("2.12.0.0")]

2 changes: 1 addition & 1 deletion Ribbon/RecentItemsPropertySet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace RibbonLib
/// <summary>
/// Helper class that wraps a recent items simple property set.
/// </summary>
public class RecentItemsPropertySet : IUISimplePropertySet
public sealed class RecentItemsPropertySet : IUISimplePropertySet
{
private string _label;
private string _labelDescription;
Expand Down
4 changes: 2 additions & 2 deletions Ribbon/Ribbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,9 @@ public RibbonColors GetColors()
}

/// <summary>
/// Wraps a bitmap object with IUIImage interface
/// Wraps a Bitmap object with IUIImage interface
/// </summary>
/// <param name="bitmap">bitmap object to wrap</param>
/// <param name="bitmap">Bitmap object to wrap</param>
/// <returns>IUIImage wrapper</returns>
public IUIImage ConvertToUIImage(Bitmap bitmap)
{
Expand Down
2 changes: 1 addition & 1 deletion Ribbon/RibbonCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<PackageId>WindowsRibbon</PackageId>
<Product>Windows Ribbon Control</Product>
<Version>2.11.1</Version>
<Version>2.12.0</Version>
<Authors>Hartmut Borkenhagen</Authors>
<Company>RibbonLib</Company>
<PackageIcon>Ribbon64.png</PackageIcon>
Expand Down
30 changes: 24 additions & 6 deletions RibbonTools/Misc/AlphaBitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private static bool IsAnyAlpha(int[] bmpScan)

public static Bitmap TryCreateAlphaBitmap(Stream stream)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
Bitmap bmp = new Bitmap(stream);
return TryConvertToAlphaBitmap(bmp);
}
Expand All @@ -61,9 +63,13 @@ public static Bitmap TryCreateAlphaBitmap(Stream stream)
/// </summary>
/// <param name="fileName"></param>
/// <returns>The Bitmap with fully transparency if available</returns>
public static Bitmap TryCreateAlphaBitmap(string filename)
public static Bitmap TryCreateAlphaBitmap(string fileName)
{
Bitmap bmp = new Bitmap(filename);
if (string.IsNullOrEmpty(fileName))
throw new ArgumentNullException(nameof(fileName));
if (!File.Exists(fileName))
throw new ArgumentException("File does not exist", nameof(fileName));
Bitmap bmp = new Bitmap(fileName);
return TryConvertToAlphaBitmap(bmp);
}

Expand Down Expand Up @@ -167,10 +173,21 @@ public static Bitmap BitmapFromFile(string fileName, bool highContrast = false)
/// <returns>The Bitmap with fully transparency if available</returns>
public static Bitmap FromHbitmap(IntPtr hBitmap)
{
if (hBitmap == IntPtr.Zero)
throw new ArgumentNullException(nameof(hBitmap));
// Create the BITMAP structure and get info from our nativeHBitmap
NativeMethods.BITMAP bitmapStruct = new NativeMethods.BITMAP();
NativeMethods.GetObjectBitmap(hBitmap, Marshal.SizeOf(bitmapStruct), ref bitmapStruct);

try
{
int bitmapSize = Marshal.SizeOf(bitmapStruct);
int size = NativeMethods.GetObjectBitmap(hBitmap, bitmapSize, ref bitmapStruct);
if (size != bitmapSize)
return null;
}
catch (Exception)
{
return null;
}
Bitmap managedBitmap;
if (bitmapStruct.bmBitsPixel == 32)
{
Expand All @@ -183,7 +200,6 @@ public static Bitmap FromHbitmap(IntPtr hBitmap)
else
{
managedBitmap = Bitmap.FromHbitmap(hBitmap);
//managedBitmap.MakeTransparent();
}
return managedBitmap;
}
Expand Down Expand Up @@ -211,7 +227,7 @@ public static Bitmap ImageFromFile(string path)
(uint)(NativeMethods.ImageLoad.LR_LOADFROMFILE | NativeMethods.ImageLoad.LR_CREATEDIBSECTION));
if (handle != IntPtr.Zero)
return FromHbitmap(handle);
return null;
//A V5 Bitmap is not supported by LoadImage, so we try with a Bitmap Ctor
}
try
{
Expand Down Expand Up @@ -270,6 +286,8 @@ public static Bitmap ImageFromResource(IntPtr resourceHandle, uint id)
/// <returns>The converted Bitmap</returns>
public static Bitmap SetTransparentRGB(Bitmap bitmap, int transparentRGB)
{
if (bitmap == null)
throw new ArgumentNullException(nameof(bitmap));
int x, y;
IntPtr p;
if (bitmap.PixelFormat != PixelFormat.Format32bppArgb)
Expand Down
2 changes: 1 addition & 1 deletion RibbonTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.3.7.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
5 changes: 2 additions & 3 deletions RibbonTools/RibbonTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Ribbon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a850abcb1bad68b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Ribbon\bin\Release\Ribbon.dll</HintPath>
<Reference Include="Ribbon">
<HintPath>..\Ribbon\bin\Release\net40\Ribbon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
8 changes: 5 additions & 3 deletions Setup/Ribbon.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:WixUI="http://schemas.microsoft.com/wix/UIExtension">
<Product Id="{8D6EB941-6AB0-4452-B721-AE4B4FD35704}" Name="Ribbon" Language="1033" Version="2.11.1.0" Manufacturer="RibbonLib" UpgradeCode="FA403F70-F169-497E-8DC2-CCA0609A1E30">
<Product Id="{7EC3451D-AEF4-406B-9170-84B2839849A5}" Name="Ribbon" Language="1033" Version="2.12.0.0" Manufacturer="RibbonLib" UpgradeCode="FA403F70-F169-497E-8DC2-CCA0609A1E30">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x86" Description="Windows Ribbon Library for .NET" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
Expand Down Expand Up @@ -37,6 +37,8 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="Di.INSTALLFOLDER" Name="RibbonLib">
<Directory Id="Di.GAC_CLONE" Name="GacClone">
</Directory>
</Directory>
</Directory>
</Directory>
Expand All @@ -49,7 +51,7 @@
.NET2.0, 3.5 GAC Assembly
-->
<RegistryKey Root="HKLM" Key="Software\Microsoft\.NETFramework\AssemblyFolders\[ProductName]" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes" Id="R.AssemblyRef">
<RegistryValue Type="string" Value="[ProgramFilesFolder]RibbonLib\" />
<RegistryValue Type="string" Value="[ProgramFilesFolder]RibbonLib\GacClone" />
</RegistryKey>
<!--
.NET4.x GAC Assembly
Expand All @@ -65,7 +67,7 @@
</Fragment>

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="Di.INSTALLFOLDER">
<ComponentGroup Id="ProductComponents" Directory="Di.GAC_CLONE">
<Component Id="C.RibbonBin" Guid="D0AB8E49-9794-429B-888B-C591AF0B1E84">
<File Id="Fi.RibbonDllClone" Name="Ribbon.dll" Source="..\Ribbon\bin\Release\Ribbon.dll" KeyPath="yes" />
<File Id="Fi.RibbonPdb" Name="Ribbon.pdb" Source="..\Ribbon\bin\Release\Ribbon.pdb" />
Expand Down
8 changes: 5 additions & 3 deletions Setup/RibbonTools.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:WixUI="http://schemas.microsoft.com/wix/UIExtension">
<Product Id="{E59212B1-80DF-48BF-B004-E38B9F7D05E4}" Name="RibbonTools" Language="1033" Version="1.3.7.0" Manufacturer="RibbonLib" UpgradeCode="8D7B31EC-7EA5-4A82-A4AB-31E2B98A3D21">
<Product Id="{BE272E8E-DB22-460C-98A2-F2EF94E9AA4C}" Name="RibbonTools" Language="1033" Version="1.4.0.0" Manufacturer="RibbonLib" UpgradeCode="8D7B31EC-7EA5-4A82-A4AB-31E2B98A3D21">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x86" Description="Design, Build and Preview the Ribbon" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
Expand Down Expand Up @@ -44,15 +44,17 @@
</Directory>
</Fragment>


<Fragment>
<ComponentGroup Id="ProductComponents" Directory="Di.INSTALLFOLDER">
<Component Id="C.RibbonBin4" Guid="D0AB8E49-9794-429B-888B-C591AF0B1E84">
<Environment Id="PATH" Name="Path" Value="[Di.INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" />
<File Id="Fi.RibbonExe" Name="RibbonTools.exe" Source="..\RibbonTools\bin\Release\RibbonTools.exe" KeyPath="yes" />
<File Id="Fi.RibbonExeConfig" Name="RibbonTools.exe.config" Source="..\RibbonTools\bin\Release\RibbonTools.exe.config" Checksum="yes" />
<File Id="Fi.RibbonPdb" Name="RibbonTools.pdb" Source="..\RibbonTools\bin\Release\RibbonTools.pdb" />
</Component>
<File Id="Fi.RibbonDll" Name="Ribbon.dll" Source="..\Ribbon\bin\Release\net40\Ribbon.dll" Checksum="yes" />
<File Id="Fi.RibbonDllXml" Name="Ribbon.xml" Source="..\Ribbon\bin\Release\net40\Ribbon.xml" />
<File Id="Fi.RibbonDllPdb" Name="Ribbon.pdb" Source="..\Ribbon\bin\Release\net40\Ribbon.pdb" />
</Component>
</ComponentGroup>
</Fragment>

Expand Down

0 comments on commit 573b4ef

Please sign in to comment.