Skip to content

Commit

Permalink
Merge pull request #34 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.6.1
  • Loading branch information
ricaun authored Dec 18, 2023
2 parents 4893462 + a128f75 commit 977d73d
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 21 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.6.1] / 2023-12-08 - 2023-12-18
### Features
- `SetLargeImage` always set small image when `ico`.
### Updated
- Update `SetLargeImage` to change small image when `BitmapFrame`.
- Update `RibbonDescription` images to `object` to support `string`.
### Tests
- Add Test to `ReSetImage` when `ico`.

## [0.6.0] / 2023-11-19 - 2023-11-29
### Features
- Update to support `net7.0-windows` and `net8.0-windows`
Expand Down Expand Up @@ -320,6 +329,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[0.6.1]: ../../compare/0.6.0...0.6.1
[0.6.0]: ../../compare/0.5.7...0.6.0
[0.5.7]: ../../compare/0.5.6...0.5.7
[0.5.6]: ../../compare/0.5.5...0.5.6
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.6.0</Version>
<Version>0.6.1</Version>
</PropertyGroup>
</Project>
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# ricaun.Revit.UI

`ricaun.Revit.UI` package makes it easier to work with UI and RevitApi, especially with RibbonPanel, RibbonTab, RibbonButton, and RibbonItem in general.

[![Revit 2017](https://img.shields.io/badge/Revit-2017+-blue.svg)](https://github.com/ricaun-io/ricaun.Revit.UI)
[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](https://github.com/ricaun-io/ricaun.Revit.UI)
[![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/)
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Build](https://github.com/ricaun-io/ricaun.Revit.UI/actions/workflows/Build.yml/badge.svg)](https://github.com/ricaun-io/ricaun.Revit.UI/actions)
[![Release](https://img.shields.io/nuget/v/ricaun.Revit.UI?logo=nuget&label=release&color=blue)](https://www.nuget.org/packages/ricaun.Revit.UI)

[![ricaun Revit UI](https://github.com/ricaun-io/ricaun.Revit.UI/assets/12437519/802f17be-a452-46bf-9171-f0eb21e83c96)](https://github.com/ricaun-io/ricaun.Revit.UI)

`ricaun.Revit.UI` package makes it easier to work with UI and RevitApi, especially with RibbonPanel, RibbonTab, RibbonButton, and RibbonItem in general.

This project was generated by the [ricaun.AppLoader](https://ricaun.com/AppLoader/) Revit plugin, the test project use the [ricaun.RevitTest](https://ricaun.com/RevitTest) test framework.

## Features
Expand Down
4 changes: 2 additions & 2 deletions ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ricaun.Revit.UI.Example.Revit
{
//[AppLoader]
[AppLoader]
//[Obsolete]
public class App : IExternalApplication
{
Expand Down Expand Up @@ -328,7 +328,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.AddDefault(
new RibbonDescription()
{
Help = "https://ricaun.com"
Help = "https://ricaun.com",
}
);

Expand Down
3 changes: 3 additions & 0 deletions ricaun.Revit.UI.Example/Revit/AppExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public Result OnStartup(UIControlledApplication application)
.SetLongDescription("Esta é uma descrição.");
}

ribbonItem.SetLargeImage("/Resources/revit.ico");
//ribbonPanel.RowStackedItems(ribbonItem);

ribbonPanel.MoveToRibbonTab();

return Result.Succeeded;
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Example/ricaun.Revit.UI.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<PackageReference Include="Newtonsoft.Json" Version="9.*" IncludeAssets="build; compile" PrivateAssets="All">
<NoWarn>NU1903</NoWarn>
</PackageReference>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void SetLargeImage_Should_SetImage()
}

[Test]
public void SetLargeImage_Should_NotSetImage()
public void SetLargeImage_Should_ReSetImage()
{
var image = Base64Image;
var largeImage = ComponentImage;
Expand All @@ -87,6 +87,22 @@ public void SetLargeImage_Should_NotSetImage()
var lastImageSource = pushButton.Image;
pushButton.SetLargeImage(largeImage);

Assert.AreNotEqual(lastImageSource, pushButton.Image);

Assert.AreEqual(16, pushButton.Image.Width);
Assert.AreEqual(32, pushButton.LargeImage.Width);
}

[Test]
public void SetLargeImage_Should_NotSetImage()
{
var image = ComponentImage;
var largeImage = Base64Image;
pushButton.SetImage(image);

var lastImageSource = pushButton.Image;
pushButton.SetLargeImage(largeImage);

Assert.AreEqual(lastImageSource, pushButton.Image);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void SetLargeImage_Should_SetImage()
}

[Test]
public void SetLargeImage_Should_NotSetImage()
public void SetLargeImage_Should_ReSetImage()
{
var image = Base64Image;
var largeImage = ComponentImage;
Expand All @@ -90,6 +90,22 @@ public void SetLargeImage_Should_NotSetImage()
var lastImageSource = pushButton.Image;
pushButton.SetLargeImage(largeImage);

Assert.AreNotEqual(lastImageSource, pushButton.Image);

Assert.AreEqual(16, pushButton.Image.Width);
Assert.AreEqual(32, pushButton.LargeImage.Width);
}

[Test]
public void SetLargeImage_Should_NotSetImage()
{
var image = ComponentImage;
var largeImage = Base64Image;
pushButton.SetImage(image);

var lastImageSource = pushButton.Image;
pushButton.SetLargeImage(largeImage);

Assert.AreEqual(lastImageSource, pushButton.Image);
}

Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Tests/ricaun.Revit.UI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>
<!-- Release -->
<ItemGroup Condition="!$(Configuration.Contains('Debug'))">
Expand Down
33 changes: 24 additions & 9 deletions ricaun.Revit.UI/RibbonDescriptionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ public RibbonDescription(LanguageType LanguageType = LanguageType.Unknown)
/// <summary>
/// Image
/// </summary>
public ImageSource Image { get; set; }
public object Image { get; set; }
/// <summary>
/// LargeImage
/// </summary>
public ImageSource LargeImage { get; set; }
public object LargeImage { get; set; }
/// <summary>
/// ToolTipImage
/// </summary>
public ImageSource ToolTipImage { get; set; }
public object ToolTipImage { get; set; }
/// <summary>
/// Action
/// </summary>
Expand Down Expand Up @@ -239,14 +239,29 @@ public static TRibbonItem UpdateRibbonDescription<TRibbonItem>(this TRibbonItem
ribbonItem.SetLongDescription(description.LongDescription);
ribbonItem.SetContextualHelp(description.Help);

if (description.ToolTipImage is not null)
ribbonItem.SetToolTipImage(description.ToolTipImage);
//if (description.ToolTipImage is not null)
// ribbonItem.SetToolTipImage(description.ToolTipImage);

if (description.LargeImage is not null)
ribbonItem.SetLargeImage(description.LargeImage);
//if (description.LargeImage is not null)
// ribbonItem.SetLargeImage(description.LargeImage);

if (description.Image is not null)
ribbonItem.SetImage(description.Image);
//if (description.Image is not null)
// ribbonItem.SetImage(description.Image);

if (description.ToolTipImage is string stringToolTipImage)
ribbonItem.SetToolTipImage(stringToolTipImage);
if (description.ToolTipImage is ImageSource sourceToolTipImage)
ribbonItem.SetToolTipImage(sourceToolTipImage);

if (description.LargeImage is string stringLargeImage)
ribbonItem.SetLargeImage(stringLargeImage);
if (description.LargeImage is ImageSource sourceLargeImage)
ribbonItem.SetLargeImage(sourceLargeImage);

if (description.Image is string stringImage)
ribbonItem.SetImage(stringImage);
if (description.Image is ImageSource sourceImage)
ribbonItem.SetImage(sourceImage);

description.Action?.Invoke(ribbonItem);

Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/RibbonItemDataExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static TRibbonItem SetLargeImage<TRibbonItem>(this TRibbonItem ribbonItem
if (ribbonItem is ButtonData ribbonButton)
{
ribbonButton.LargeImage = largeImage?.GetBitmapFrame(32, (frame) => { ribbonButton.LargeImage = frame; });
if (ribbonButton.Image == null || ribbonButton.LargeImage == null)
if (ribbonButton.Image == null || ribbonButton.LargeImage == null || ribbonButton.LargeImage is System.Windows.Media.Imaging.BitmapFrame)
ribbonButton.SetImage(ribbonButton.LargeImage);
}

Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/RibbonItemExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public static TRibbonItem SetLargeImage<TRibbonItem>(this TRibbonItem ribbonItem
if (ribbonItem is RibbonButton ribbonButton)
{
ribbonButton.LargeImage = largeImage?.GetBitmapFrame(32, (frame) => { ribbonButton.LargeImage = frame; });
if (ribbonButton.Image == null || ribbonButton.LargeImage == null)
if (ribbonButton.Image == null || ribbonButton.LargeImage == null || ribbonButton.LargeImage is System.Windows.Media.Imaging.BitmapFrame)
ribbonButton.SetImage(ribbonButton.LargeImage);
}

Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/ricaun.Revit.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
Expand Down

0 comments on commit 977d73d

Please sign in to comment.