Combine GCode details/Speeds legend controls. Create Section widget

This commit is contained in:
John Lewin 2017-10-22 19:42:41 -07:00
parent 39ce8875ad
commit e195d0154c
3 changed files with 64 additions and 18 deletions

View file

@ -0,0 +1,34 @@
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public class SectionWidget : FlowLayoutWidget
{
public SectionWidget(string sectionTitle, RGBA_Bytes textColor, GuiWidget sectionContent)
: base (FlowDirection.TopToBottom)
{
this.HAnchor = HAnchor.Stretch;
this.VAnchor = VAnchor.Fit;
// Add heading
this.AddChild(
new TextWidget(sectionTitle, textColor: textColor)
{
Margin = new BorderDouble(0, 3, 0, 6)
});
// Add heading separator
this.AddChild(new HorizontalLine(25)
{
Margin = new BorderDouble(0)
});
// Force padding and add content widget
sectionContent.Padding = 8;
sectionContent.HAnchor = HAnchor.Stretch;
this.AddChild(sectionContent);
}
}
}

View file

@ -85,25 +85,36 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (sceneContext.LoadedGCode?.LineCount > 0)
{
this.AddChild(
new ColorGradientWidget(sceneContext.LoadedGCode)
{
Margin = new BorderDouble(top: 55, left: 11),
HAnchor = HAnchor.Fit | HAnchor.Left,
VAnchor = VAnchor.Top,
Visible = sceneContext.RendererOptions.RenderSpeeds
});
var gcodeResultsPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
Margin = new BorderDouble(0, 0, 35, 60),
Padding = new BorderDouble(10, 10, 10, 8),
BackgroundColor = new RGBA_Bytes(0, 0, 0, theme.OverlayAlpha),
HAnchor = HAnchor.Absolute | HAnchor.Right,
VAnchor = VAnchor.Top | VAnchor.Fit,
Width = 175
};
this.AddChild(gcodeResultsPanel);
this.AddChild(
new GCodeDetailsView(new GCodeDetails(printer, printer.Bed.LoadedGCode))
{
Margin = new BorderDouble(0, 0, 35, 5),
Padding = new BorderDouble(10),
BackgroundColor = new RGBA_Bytes(0, 0, 0, theme.OverlayAlpha),
HAnchor = HAnchor.Right | HAnchor.Absolute,
VAnchor = VAnchor.Top | VAnchor.Fit,
Width = 150
});
gcodeResultsPanel.AddChild(
new SectionWidget(
"Details".Localize(),
ActiveTheme.Instance.PrimaryTextColor,
new GCodeDetailsView(new GCodeDetails(printer, printer.Bed.LoadedGCode), 12, 9)
{
HAnchor = HAnchor.Fit,
Margin = new BorderDouble(bottom: 3)
}));
gcodeResultsPanel.AddChild(
new SectionWidget(
"Speeds".Localize(),
ActiveTheme.Instance.PrimaryTextColor,
new ColorGradientWidget(sceneContext.LoadedGCode, theme, pointSize: 12)
{
HAnchor = HAnchor.Stretch,
Visible = sceneContext.RendererOptions.RenderSpeeds,
}));
}
}