diff --git a/MatterControl.csproj b/MatterControl.csproj index 736f9ff03..c9203d4be 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -163,6 +163,7 @@ + diff --git a/PartPreviewWindow/ColorGradientWidget.cs b/PartPreviewWindow/ColorGradientWidget.cs new file mode 100644 index 000000000..f72330f82 --- /dev/null +++ b/PartPreviewWindow/ColorGradientWidget.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MatterHackers.Agg; +using MatterHackers.Agg.UI; +using MatterHackers.MeshVisualizer; +using MatterHackers.VectorMath; +using System.IO; +using MatterHackers.Agg.PlatformAbstract; + +namespace MatterHackers.MatterControl.PartPreviewWindow +{ + + public class ColorGradientWidget : FlowLayoutWidget + { + + List allColorToSpeedWidgets; + + public ColorGradientWidget() + : base(FlowDirection.TopToBottom) + { + + this.VAnchor = VAnchor.FitToChildren; + + BackgroundColor = new RGBA_Bytes(0, 0, 0, 120); + + ColorToSpeedWidget blue = new ColorToSpeedWidget("blue.png", "BLUE"); + ColorToSpeedWidget red = new ColorToSpeedWidget("red.png", "RED"); + ColorToSpeedWidget teal = new ColorToSpeedWidget("teal.png", "TEAL"); + ColorToSpeedWidget yellow = new ColorToSpeedWidget("yellow.png", "YELLOW"); + ColorToSpeedWidget green = new ColorToSpeedWidget("green.png", "GREEN"); + ColorToSpeedWidget orange = new ColorToSpeedWidget("orange.png", "ORANGE"); + ColorToSpeedWidget lightBlue = new ColorToSpeedWidget("lightblue.png", "LIGHT-BLUE"); + + this.AddChild(blue); + this.AddChild(red); + this.AddChild(teal); + this.AddChild(yellow); + this.AddChild(green); + this.AddChild(orange); + this.AddChild(lightBlue); + + Margin = new BorderDouble(75); + + } + + } + + public class ColorToSpeedWidget : FlowLayoutWidget + { + + public ColorToSpeedWidget(String imageFileName, String layerSpeed) + : base(FlowDirection.LeftToRight) + { + Margin = new BorderDouble(2); + + Agg.Image.ImageBuffer color = StaticData.Instance.LoadIcon(Path.Combine("ColorGradient", imageFileName)); + + ImageWidget colorWidget = new ImageWidget(color); + colorWidget.Margin = new BorderDouble(left:2); + + TextWidget speedTextBox = new TextWidget(layerSpeed, pointSize: 12); + speedTextBox.TextColor = RGBA_Bytes.White; + speedTextBox.VAnchor = VAnchor.ParentCenter; + speedTextBox.Margin = new BorderDouble(left: 2); + + this.AddChild(colorWidget); + this.AddChild(speedTextBox); + + } + + } + +} \ No newline at end of file diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index d54cf3034..2c1e0ed4b 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -256,6 +256,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow viewControls2D = new ViewControls2D(); AddChild(viewControls2D); + + ColorGradientWidget gradient = new ColorGradientWidget(); + gradient.VAnchor = Agg.UI.VAnchor.ParentTop; + AddChild(gradient); + viewControls3D = new ViewControls3D(meshViewerWidget); viewControls3D.PartSelectVisible = false; AddChild(viewControls3D); diff --git a/StaticData/Icons/ColorGradient/blue.png b/StaticData/Icons/ColorGradient/blue.png new file mode 100644 index 000000000..dd29c4a91 Binary files /dev/null and b/StaticData/Icons/ColorGradient/blue.png differ diff --git a/StaticData/Icons/ColorGradient/green.png b/StaticData/Icons/ColorGradient/green.png new file mode 100644 index 000000000..8689bf6f2 Binary files /dev/null and b/StaticData/Icons/ColorGradient/green.png differ diff --git a/StaticData/Icons/ColorGradient/lightblue.png b/StaticData/Icons/ColorGradient/lightblue.png new file mode 100644 index 000000000..897b0d239 Binary files /dev/null and b/StaticData/Icons/ColorGradient/lightblue.png differ diff --git a/StaticData/Icons/ColorGradient/orange.png b/StaticData/Icons/ColorGradient/orange.png new file mode 100644 index 000000000..8508a697e Binary files /dev/null and b/StaticData/Icons/ColorGradient/orange.png differ diff --git a/StaticData/Icons/ColorGradient/red.png b/StaticData/Icons/ColorGradient/red.png new file mode 100644 index 000000000..37d259436 Binary files /dev/null and b/StaticData/Icons/ColorGradient/red.png differ diff --git a/StaticData/Icons/ColorGradient/teal.png b/StaticData/Icons/ColorGradient/teal.png new file mode 100644 index 000000000..dee745d43 Binary files /dev/null and b/StaticData/Icons/ColorGradient/teal.png differ diff --git a/StaticData/Icons/ColorGradient/yellow.png b/StaticData/Icons/ColorGradient/yellow.png new file mode 100644 index 000000000..f9a96034b Binary files /dev/null and b/StaticData/Icons/ColorGradient/yellow.png differ