Skip to content

Commit

Permalink
Prepare for version 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
harborsiem committed Nov 10, 2022
1 parent 1992b89 commit 3b6b33e
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 38 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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.13.0, RibbonTools V1.5.0

#### Changed (Ribbon)

- Bugfix RibbonDropDownColorPicker.StandardColors.
- Free unmanaged memory as soon as possible.
- Support for .NET7

#### Changed (RibbonTools)

- Correct usage of TActions
- delete unnecessary namespace in CodeBuilder for RibbonItems


### Ribbon V2.12.0, RibbonTools V1.4.0

#### Changed (Ribbon)
Expand Down
44 changes: 36 additions & 8 deletions Ribbon/Controls/Properties/ColorPickerPropertiesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ public string AutomaticColorLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.AutomaticColorLabel, out automaticColorLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)automaticColorLabel.Value;
string result = (string)automaticColorLabel.Value;
PropVariant.Clear(ref automaticColorLabel);
return result;
}
}

Expand All @@ -256,6 +258,7 @@ public string AutomaticColorLabel
automaticColorLabel = PropVariant.FromObject(_automaticColorLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.AutomaticColorLabel, ref automaticColorLabel);
PropVariant.Clear(ref automaticColorLabel);
}
}
}
Expand Down Expand Up @@ -333,7 +336,9 @@ public string MoreColorsLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.MoreColorsLabel, out moreColorsLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)moreColorsLabel.Value;
string result = (string)moreColorsLabel.Value;
PropVariant.Clear(ref moreColorsLabel);
return result;
}
}

Expand All @@ -354,6 +359,7 @@ public string MoreColorsLabel
moreColorsLabel = PropVariant.FromObject(_moreColorsLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.MoreColorsLabel, ref moreColorsLabel);
PropVariant.Clear(ref moreColorsLabel);
}
}
}
Expand All @@ -371,7 +377,9 @@ public string NoColorLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.NoColorLabel, out noColorLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)noColorLabel.Value;
string result = (string)noColorLabel.Value;
PropVariant.Clear(ref noColorLabel);
return result;
}
}

Expand All @@ -392,6 +400,7 @@ public string NoColorLabel
noColorLabel = PropVariant.FromObject(_noColorLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.NoColorLabel, ref noColorLabel);
PropVariant.Clear(ref noColorLabel);
}
}
}
Expand All @@ -409,7 +418,9 @@ public string RecentColorsCategoryLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.RecentColorsCategoryLabel, out recentColorsCategoryLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)recentColorsCategoryLabel.Value;
string result = (string)recentColorsCategoryLabel.Value;
PropVariant.Clear(ref recentColorsCategoryLabel);
return result;
}
}

Expand All @@ -430,6 +441,7 @@ public string RecentColorsCategoryLabel
recentColorsCategoryLabel = PropVariant.FromObject(_recentColorsCategoryLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.RecentColorsCategoryLabel, ref recentColorsCategoryLabel);
PropVariant.Clear(ref recentColorsCategoryLabel);
}
}
}
Expand All @@ -450,6 +462,7 @@ public Color[] StandardColors
uint[] uintStandardColors = (uint[])standardColors.Value;
int[] intStandardColors = Array.ConvertAll<uint, int>(uintStandardColors, new Converter<uint, int>(Convert.ToInt32));
Color[] colorStandardColors = Array.ConvertAll<int, Color>(intStandardColors, new Converter<int, Color>(ColorTranslator.FromWin32));
PropVariant.Clear(ref standardColors);
return colorStandardColors;
}
}
Expand All @@ -466,6 +479,7 @@ public Color[] StandardColors

PropVariant standardColors = PropVariant.FromObject(uintStandardColors);
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.StandardColors, ref standardColors);
PropVariant.Clear(ref standardColors);
}
}
}
Expand All @@ -483,7 +497,9 @@ public string StandardColorsCategoryLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.StandardColorsCategoryLabel, out standardColorsCategoryLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)standardColorsCategoryLabel.Value;
string result = (string)standardColorsCategoryLabel.Value;
PropVariant.Clear(ref standardColorsCategoryLabel);
return result;
}
}

Expand All @@ -504,6 +520,7 @@ public string StandardColorsCategoryLabel
standardColorsCategoryLabel = PropVariant.FromObject(_standardColorsCategoryLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.StandardColorsCategoryLabel, ref standardColorsCategoryLabel);
PropVariant.Clear(ref standardColorsCategoryLabel);
}
}
}
Expand All @@ -521,7 +538,9 @@ public string[] StandardColorsTooltips
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.StandardColorsTooltips, out standardColorsTooltips);
if (NativeMethods.Succeeded(hr))
{
return (string[])standardColorsTooltips.Value;
string[] result = (string[])standardColorsTooltips.Value;
PropVariant.Clear(ref standardColorsTooltips);
return result;
}
}

Expand All @@ -534,6 +553,7 @@ public string[] StandardColorsTooltips
{
PropVariant standardColorsTooltips = PropVariant.FromObject(value);
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.StandardColorsTooltips, ref standardColorsTooltips);
PropVariant.Clear(ref standardColorsTooltips);
}
}
}
Expand All @@ -554,6 +574,7 @@ public Color[] ThemeColors
uint[] uintThemeColors = (uint[])themeColors.Value;
int[] intThemeColors = Array.ConvertAll<uint, int>(uintThemeColors, new Converter<uint, int>(Convert.ToInt32));
Color[] colorThemeColors = Array.ConvertAll<int, Color>(intThemeColors, new Converter<int, Color>(ColorTranslator.FromWin32));
PropVariant.Clear(ref themeColors);
return colorThemeColors;
}
}
Expand All @@ -570,6 +591,7 @@ public Color[] ThemeColors

PropVariant themeColors = PropVariant.FromObject(uintThemeColors);
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.ThemeColors, ref themeColors);
PropVariant.Clear(ref themeColors);
}
}
}
Expand All @@ -587,7 +609,9 @@ public string ThemeColorsCategoryLabel
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.ThemeColorsCategoryLabel, out themeColorsCategoryLabel);
if (NativeMethods.Succeeded(hr))
{
return (string)themeColorsCategoryLabel.Value;
string result = (string)themeColorsCategoryLabel.Value;
PropVariant.Clear(ref themeColorsCategoryLabel);
return result;
}
}

Expand All @@ -608,6 +632,7 @@ public string ThemeColorsCategoryLabel
themeColorsCategoryLabel = PropVariant.FromObject(_themeColorsCategoryLabel);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.ThemeColorsCategoryLabel, ref themeColorsCategoryLabel);
PropVariant.Clear(ref themeColorsCategoryLabel);
}
}
}
Expand All @@ -625,7 +650,9 @@ public string[] ThemeColorsTooltips
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.ThemeColorsTooltips, out themeColorsTooltips);
if (NativeMethods.Succeeded(hr))
{
return (string[])themeColorsTooltips.Value;
string[] result = (string[])themeColorsTooltips.Value;
PropVariant.Clear(ref themeColorsTooltips);
return result;
}
}

Expand All @@ -638,6 +665,7 @@ public string[] ThemeColorsTooltips
{
PropVariant themeColorsTooltips = PropVariant.FromObject(value);
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.ThemeColorsTooltips, ref themeColorsTooltips);
PropVariant.Clear(ref themeColorsTooltips);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion Ribbon/Controls/Properties/FontControlPropertiesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef curre
{
PropVariant propFamily = PropVariant.FromObject(_family);
fontProperties.SetValue(ref RibbonProperties.FontProperties_Family, ref propFamily);
PropVariant.Clear(ref propFamily);
}

// set size
Expand Down Expand Up @@ -233,7 +234,9 @@ public string Family
IPropertyStore propertyStore = FontProperties;
PropVariant propFamily;
HRESULT hr = propertyStore.GetValue(ref RibbonProperties.FontProperties_Family, out propFamily);
return (string)propFamily.Value;
string result = (string)propFamily.Value;
PropVariant.Clear(ref propFamily);
return result;
}

return _family;
Expand Down
5 changes: 4 additions & 1 deletion Ribbon/Controls/Properties/StringValueProperiesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public string StringValue
HRESULT hr = _ribbon.Framework.GetUICommandProperty(_commandID, ref RibbonProperties.StringValue, out stringValue);
if (NativeMethods.Succeeded(hr))
{
return (string)stringValue.Value;
string result = (string)stringValue.Value;
PropVariant.Clear(ref stringValue);
return result;
}
}

Expand All @@ -97,6 +99,7 @@ public string StringValue
stringValue = PropVariant.FromObject(_stringValue);
}
HRESULT hr = _ribbon.Framework.SetUICommandProperty(_commandID, ref RibbonProperties.StringValue, ref stringValue);
PropVariant.Clear(ref stringValue);
}
}
}
Expand Down
Loading

0 comments on commit 3b6b33e

Please sign in to comment.