Combine GCode details/Speeds legend controls. Create Section widget
This commit is contained in:
parent
39ce8875ad
commit
e195d0154c
3 changed files with 64 additions and 18 deletions
34
PartPreviewWindow/SectionWidget.cs
Normal file
34
PartPreviewWindow/SectionWidget.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue