Revise theme support

This commit is contained in:
John Lewin 2018-10-13 17:58:54 -07:00
parent 7ba684ef8d
commit ee936efb8a
57 changed files with 1562 additions and 458 deletions

View file

@ -66,6 +66,8 @@ namespace MatterHackers.GCodeVisualizer
public ExtrusionColors ExtrusionColors { get; } = null;
public Color Gray { get; set; }
public GCodeRenderer(GCodeFile gCodeFileToDraw)
{
if (gCodeFileToDraw != null)
@ -133,11 +135,26 @@ namespace MatterHackers.GCodeVisualizer
double layerThickness = gCodeFileToDraw.GetLayerHeight(layerToCreate);
Color extrusionColor = ExtrusionColors.GetColorForSpeed((float)currentInstruction.FeedRate);
renderFeaturesForLayer.Add(new RenderFeatureExtrusion(previousInstruction.Position, currentInstruction.Position, currentInstruction.ExtruderIndex, currentInstruction.FeedRate, currentInstruction.EPosition - previousInstruction.EPosition, gCodeFileToDraw.GetFilamentDiameter(), layerThickness, extrusionColor));
renderFeaturesForLayer.Add(
new RenderFeatureExtrusion(
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ExtruderIndex,
currentInstruction.FeedRate,
currentInstruction.EPosition - previousInstruction.EPosition,
gCodeFileToDraw.GetFilamentDiameter(),
layerThickness,
extrusionColor,
this.Gray));
}
else
{
renderFeaturesForLayer.Add(new RenderFeatureTravel(previousInstruction.Position, currentInstruction.Position, currentInstruction.ExtruderIndex, currentInstruction.FeedRate));
renderFeaturesForLayer.Add(
new RenderFeatureTravel(
previousInstruction.Position,
currentInstruction.Position,
currentInstruction.ExtruderIndex,
currentInstruction.FeedRate));
}
}
}

View file

@ -41,11 +41,13 @@ namespace MatterHackers.GCodeVisualizer
private float extrusionVolumeMm3;
private float layerHeight;
private Color color;
private Color gray;
public RenderFeatureExtrusion(Vector3 start, Vector3 end, int extruderIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color)
public RenderFeatureExtrusion(Vector3 start, Vector3 end, int extruderIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, Color color, Color gray)
: base(start, end, extruderIndex, travelSpeed)
{
this.color = color;
this.gray = gray;
double filamentRadius = filamentDiameterMm / 2;
double areaSquareMm = (filamentRadius * filamentRadius) * Math.PI;
@ -98,7 +100,7 @@ namespace MatterHackers.GCodeVisualizer
}
else if (renderInfo.CurrentRenderType.HasFlag(RenderType.GrayColors))
{
lineColor = ActiveTheme.Instance.IsDarkTheme ? Color.DarkGray : Color.Gray;
lineColor = this.gray;
}
else
{