Skip to content

Commit

Permalink
Improvements Office2010 Black and first try Render Office 2013
Browse files Browse the repository at this point in the history
  • Loading branch information
Cocotteseb committed Nov 1, 2015
1 parent 8d529d7 commit f85b694
Show file tree
Hide file tree
Showing 28 changed files with 13,057 additions and 25 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<Compile Include="Ribbon\KryptonRibbonQATButtonCollectionEditor.cs" />
<Compile Include="Ribbon\KryptonRibbonRecentDocCollectionEditor.cs" />
<Compile Include="Ribbon\KryptonRibbonTabDesigner.cs" />
<Compile Include="Toolkit\KryptonDataGridViewDesigner.cs" />
<Compile Include="Toolkit\KryptonTreeViewActionList.cs" />
<Compile Include="Toolkit\KryptonTreeViewDesigner.cs" />
<Compile Include="Toolkit\KryptonBorderEdgeActionList.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void Recalculate()
_groupHeightModifier = 0;
_groupsHeightModifier = 0;
break;
case PaletteRibbonShape.Office2013:
case PaletteRibbonShape.Office2010:
_groupHeightModifier = -3;
_groupsHeightModifier = -3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override Color GetContentShortTextColor1(PaletteContentStyle style, Palet
if ((style == PaletteContentStyle.ButtonButtonSpec) && (state == PaletteState.Normal))
{
// If the ribbon is showing in office 2010 style and using glass
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
return LightBackground(base.GetContentShortTextColor1(style, state));
}

Expand All @@ -75,7 +75,7 @@ public override Color GetContentShortTextColor2(PaletteContentStyle style, Palet
if ((style == PaletteContentStyle.ButtonButtonSpec) && (state == PaletteState.Normal))
{
// If the ribbon is showing in office 2010 style and using glass
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
return LightBackground(base.GetContentShortTextColor2(style, state));
}

Expand All @@ -96,7 +96,7 @@ public override Color GetContentLongTextColor1(PaletteContentStyle style, Palett
if ((style == PaletteContentStyle.ButtonButtonSpec) && (state == PaletteState.Normal))
{
// If the ribbon is showing in office 2010 style and using glass
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
return LightBackground(base.GetContentLongTextColor1(style, state));
}

Expand All @@ -115,7 +115,7 @@ public override Color GetContentLongTextColor2(PaletteContentStyle style, Palett
if ((style == PaletteContentStyle.ButtonButtonSpec) && (state == PaletteState.Normal))
{
// If the ribbon is showing in office 2010 style and using glass
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
if (_ribbon.CaptionArea.DrawCaptionOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
return LightBackground(base.GetContentLongTextColor2(style, state));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ public Color GetImageTransparentColor(PaletteState state)
/// <returns>Title string.</returns>
public string GetShortText()
{
return _ribbon.RibbonAppButton.AppButtonText;
if (_ribbon.RibbonShape == PaletteRibbonShape.Office2013)
{
return _ribbon.RibbonAppButton.AppButtonText.ToUpper();
}
else
{
return _ribbon.RibbonAppButton.AppButtonText;
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,9 @@ private void OnFormChromeCheck(object sender, EventArgs e)
}

_kryptonForm.AllowComposition = _ribbon.AllowFormIntegrate && !_ribbon.InDesignMode;

bool newAllowIconDisplay = (!_integrated || !_ribbon.RibbonAppButton.AppButtonVisible);

//TODO call this function when palette is changing
bool newAllowIconDisplay = (!_integrated || !_ribbon.RibbonAppButton.AppButtonVisible || (_ribbon.RibbonAppButton.AppButtonVisible && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013)));
if (_kryptonForm.AllowIconDisplay != newAllowIconDisplay)
{
_kryptonForm.AllowIconDisplay = newAllowIconDisplay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public override void Layout(ViewLayoutContext context)
}

// Office 2010 draws a shadow effect of the text
if (_ribbon.RibbonShape == PaletteRibbonShape.Office2010)
if (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013)
{
Rectangle shadowTextRect1 = new Rectangle(_textRect.X - 1, _textRect.Y + 1, _textRect.Width, _textRect.Height);
Rectangle shadowTextRect2 = new Rectangle(_textRect.X + 1, _textRect.Y + 1, _textRect.Width, _textRect.Height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void ResetGroupItemSize()
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
bool drawNonTrackingAreas = (_ribbon.RibbonShape != PaletteRibbonShape.Office2010);
bool drawNonTrackingAreas = (_ribbon.RibbonShape != PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013);

// Update the views with the type of button being used
_viewLarge.ButtonType = _ribbonButton.ButtonType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void ResetGroupItemSize()
/// <param name="context">Layout context.</param>
public override Size GetPreferredSize(ViewLayoutContext context)
{
bool drawNonTrackingAreas = (_ribbon.RibbonShape != PaletteRibbonShape.Office2010);
bool drawNonTrackingAreas = (_ribbon.RibbonShape != PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013);

// Update the views with the type of button being used
_viewLarge.ButtonType = _ribbonColorButton.ButtonType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ internal class ViewDrawRibbonGroupsBorder : ViewComposite,
#region Static Fields
private static readonly Padding _borderPadding2007 = new Padding(3, 3, 3, 2);
private static readonly Padding _borderPadding2010 = new Padding(1, 1, 1, 3);
//TODO checkseb
private static readonly Padding _borderPadding2013 = new Padding(1, 1, 1, 0);
#endregion

#region Instance Fields
Expand Down Expand Up @@ -106,6 +108,8 @@ public Padding BorderPadding
return _borderPadding2007;
case PaletteRibbonShape.Office2010:
return _borderPadding2010;
case PaletteRibbonShape.Office2013 :
return _borderPadding2013;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ internal class ViewDrawRibbonPanel : ViewDrawPanel
_paintDelegate = paintDelegate;

_compBlend = new Blend();
_compBlend.Positions = new float[] { 0.0f, 0.4f, 1.0f };
_compBlend.Factors = new float[] { 0.0f, 0.87f, 1.0f };
//_compBlend.Positions = new float[] { 0.0f, 0.4f, 1.0f };
//_compBlend.Factors = new float[] { 0.0f, 0.87f, 1.0f };
_compBlend.Positions = new float[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f };
_compBlend.Factors = new float[] { 0.0f, 0.10f, 0.25f, 0.50f, 0.70f, 0.80f };
}
#endregion

Expand All @@ -65,14 +67,15 @@ public override void RenderBefore(RenderContext context)
{
// If we are rendering using desktop window composition and using the Office 2010 shape
// of ribbon then we need to draw the tabs area as part of the window chromw
if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
{
int tabsHeight = _ribbon.TabsArea.ClientHeight;

// Clip to prevent drawing over the tabs area
using (Clipping clip = new Clipping(context.Graphics, new Rectangle(ClientLocation.X, ClientLocation.Y + tabsHeight, ClientWidth, ClientHeight - tabsHeight)))
base.RenderBefore(context);

//context.Graphics.DrawRectangle(new Pen(Color.Blue), new Rectangle(ClientLocation.X, ClientLocation.Y, ClientWidth, tabsHeight));
PaintRectangle(context.Graphics, new Rectangle(ClientLocation.X, ClientLocation.Y, ClientWidth, tabsHeight), true, null);
}
else
Expand All @@ -89,8 +92,9 @@ public override void RenderBefore(RenderContext context)
public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sender)
{
// If we are rendering using desktop window composition and using the Office 2010 shape
// of ribbon then we need to draw the tabs area as part of the window chromw
if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
// of ribbon then we need to draw the tabs area as part of the window chrome
// Not for 2013
if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013))
{
if (edges)
{
Expand All @@ -107,10 +111,31 @@ public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sende
}
}

using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, Color.White, 90f))
if (_ribbon.RibbonShape == PaletteRibbonShape.Office2010)
{
//Adjust Color of the gradient
Color gradientColor;
if (KryptonManager.CurrentGlobalPalette == KryptonManager.PaletteOffice2010Black)
{
gradientColor = Color.FromArgb(39, 39, 39);
}
else
{
gradientColor = Color.White;
}

using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, gradientColor, 90f))
{
backBrush.Blend = _compBlend;
g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1));
}
}
else if (_ribbon.RibbonShape == PaletteRibbonShape.Office2013)
{
backBrush.Blend = _compBlend;
g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1));
using (SolidBrush backBrush = new SolidBrush(Color.White))
{
g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ public Padding PreferredBorder
return _preferredBorder2007;
case PaletteRibbonShape.Office2010:
return _preferredBorder2010;
case PaletteRibbonShape.Office2013:
return _preferredBorder2010;
}
}
}
Expand All @@ -316,6 +318,8 @@ public Padding LayoutBorder
return _layoutBorder2007;
case PaletteRibbonShape.Office2010:
return _layoutBorder2010;
case PaletteRibbonShape.Office2013:
return _layoutBorder2010;
}
}
}
Expand Down Expand Up @@ -417,6 +421,7 @@ public override void RenderBefore(RenderContext context)
switch (_ribbon.RibbonShape)
{
default:
case PaletteRibbonShape.Office2013:
case PaletteRibbonShape.Office2007:
if (cts != null)
RenderBefore2007ContextTab(context, cts);
Expand All @@ -427,7 +432,8 @@ public override void RenderBefore(RenderContext context)
if (cts != null)
RenderBefore2010ContextTab(context, cts);

_paletteContextCurrent.LightBackground = _ribbon.CaptionArea.DrawCaptionOnComposition;
//_paletteContextCurrent.LightBackground = _ribbon.CaptionArea.DrawCaptionOnComposition;
_paletteContextCurrent.LightBackground = _ribbon.CaptionArea.DrawCaptionOnComposition && (KryptonManager.CurrentGlobalPalette != KryptonManager.PaletteOffice2010Black);
break;
}

Expand Down Expand Up @@ -489,7 +495,16 @@ public string GetShortText()
// reference and the text is not zero length. We try and prevent
// an empty string because it makes the tab useless!
if ((_ribbonTab != null) && (_ribbonTab.Text.Length > 0))
return _ribbonTab.Text;
{
if (_ribbon.RibbonShape == PaletteRibbonShape.Office2013)
{
return _ribbonTab.Text.ToUpper();
}
else
{
return _ribbonTab.Text;
}
}

return _empty;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ViewLayoutRibbonAppTab(KryptonRibbon ribbon)
}

/// <summary>
/// Obtains the String representation of this instance.
/// Obtains t+he String representation of this instance.
/// </summary>
/// <returns>User readable name of the instance.</returns>
public override string ToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public void TestForAppButtonDoubleClick()
if (elapsed.TotalMilliseconds < SystemInformation.DoubleClickTime)
{
// Office 2010 does not close on a double click
if (_ribbon.RibbonShape != PaletteRibbonShape.Office2010)
if (_ribbon.RibbonShape != PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013)
{
// Close down the associated application window
Form ownerForm = _ribbon.FindForm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@
<Compile Include="Palette Base\PaletteRedirect\PaletteRedirectBorderEdge.cs" />
<Compile Include="Palette Base\PaletteRedirect\PaletteRedirectBorder.cs" />
<Compile Include="Palette Base\PaletteElementColor\PaletteElementColor.cs" />
<Compile Include="Palette Builtin\PaletteOffice2013.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Palette Builtin\PaletteOffice2013Base.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Palette Builtin\PaletteOffice2013White.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Palette Controls\KryptonColorTable2013.cs" />
<Compile Include="Palette Controls\PaletteBackInheritNode.cs" />
<Compile Include="Palette Controls\PaletteContentInheritNode.cs" />
<Compile Include="Palette Controls\PaletteNodeOverride.cs" />
Expand Down Expand Up @@ -410,6 +420,7 @@
<Compile Include="Palette Controls\PaletteDataGridViewTripleCommon.cs" />
<Compile Include="Palette Controls\PaletteDataGridViewTripleRedirect.cs" />
<Compile Include="Palette Controls\PaletteColorButtonStrings.cs" />
<Compile Include="Rendering\KryptonOffice2013Renderer.cs" />
<Compile Include="Rendering\RenderExpertHelpers.cs" />
<Compile Include="Rendering\RenderOffice2007.cs">
<SubType>Component</SubType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ public sealed class KryptonManager : Component
private static PaletteSparkleBlue _paletteSparkleBlue;
private static PaletteSparkleOrange _paletteSparkleOrange;
private static PaletteSparklePurple _paletteSparklePurple;
private static PaletteOffice2013White _paletteOffice2013White;
private static RenderStandard _renderStandard;
private static RenderProfessional _renderProfessional;
private static RenderOffice2007 _renderOffice2007;
private static RenderOffice2010 _renderOffice2010;
private static RenderOffice2013 _renderOffice2013;
private static RenderSparkle _renderSparkle;
#endregion

Expand Down Expand Up @@ -435,6 +437,8 @@ public static IPalette CurrentGlobalPalette
return PaletteSparkleOrange;
case PaletteModeManager.SparklePurple:
return PaletteSparklePurple;
case PaletteModeManager.Office2013White:
return PaletteOffice2013White;
case PaletteModeManager.Custom:
return _globalPalette;
default:
Expand Down Expand Up @@ -475,6 +479,8 @@ public static IPalette GetPaletteForMode(PaletteMode mode)
return PaletteSparkleOrange;
case PaletteMode.SparklePurple:
return PaletteSparklePurple;
case PaletteMode.Office2013White:
return PaletteOffice2013White;
case PaletteMode.Global:
return CurrentGlobalPalette;
case PaletteMode.Custom:
Expand Down Expand Up @@ -638,6 +644,20 @@ public static PaletteSparklePurple PaletteSparklePurple
}
}

/// <summary>
/// Gets the single instance of the Office 2013 palette.
/// </summary>
public static PaletteOffice2013White PaletteOffice2013White
{
get
{
if (_paletteOffice2013White == null)
_paletteOffice2013White = new PaletteOffice2013White();

return _paletteOffice2013White;
}
}

/// <summary>
/// Gets the implementation for the requested renderer mode.
/// </summary>
Expand Down Expand Up @@ -706,6 +726,20 @@ public static RenderOffice2010 RenderOffice2010
}
}

/// <summary>
/// Gets the single instance of the Office 2013 renderer.
/// </summary>
public static RenderOffice2013 RenderOffice2013
{
get
{
if (_renderOffice2013 == null)
_renderOffice2013 = new RenderOffice2013();

return _renderOffice2013;
}
}

/// <summary>
/// Gets the single instance of the professional renderer.
/// </summary>
Expand Down Expand Up @@ -832,6 +866,9 @@ private static void OnUserPreferenceChanged(object sender, UserPreferenceChanged
if (_paletteSparklePurple != null)
_paletteSparklePurple.UserPreferenceChanged();

if (_paletteOffice2013White != null)
_paletteOffice2013White.UserPreferenceChanged();

UpdateToolStripManager();
}

Expand Down
Loading

0 comments on commit f85b694

Please sign in to comment.