mattercontrol/MatterControlLib/Utilities/MarkdigAgg/AggCodeBlockRenderer.cs

46 lines
1.2 KiB
C#
Raw Normal View History

// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved.
// This file is licensed under the MIT license.
// See the LICENSE.md file in the project root for more information.
using Markdig.Syntax;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl;
namespace Markdig.Renderers.Agg
{
public class CodeBlockX : FlowLeftRightWithWrapping
{
2018-07-12 09:22:28 -07:00
private ThemeConfig theme;
public CodeBlockX(ThemeConfig theme)
{
2018-07-12 09:22:28 -07:00
this.theme = theme;
this.HAnchor = HAnchor.Stretch;
this.VAnchor = VAnchor.Fit;
this.Margin = 12;
this.Padding = 6;
this.BackgroundColor = theme.MinimalShade;
}
}
public class AggCodeBlockRenderer : AggObjectRenderer<CodeBlock>
{
2018-07-12 09:22:28 -07:00
private ThemeConfig theme;
public AggCodeBlockRenderer(ThemeConfig theme)
{
this.theme = theme;
}
protected override void Write(AggRenderer renderer, CodeBlock obj)
{
//var paragraph = new Paragraph();
//paragraph.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.CodeBlockStyleKey);
2018-07-12 09:22:28 -07:00
renderer.Push(new CodeBlockX(theme));
renderer.WriteLeafRawLines(obj);
renderer.Pop();
}
}
}