Merge branch 'development' of https://github.com/MatterHackers/MatterControl into development

This commit is contained in:
Kevin Pope 2014-12-28 17:29:56 -08:00
commit 6993a6541e
10 changed files with 358 additions and 47 deletions

View file

@ -31,10 +31,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.Agg.VertexSource;
using MatterHackers.Agg.Transform;
namespace MatterHackers.MatterControl.PrinterControls
{
@ -76,7 +80,7 @@ namespace MatterHackers.MatterControl.PrinterControls
}
TextWidget subheader = new TextWidget("Fine-tune adjustment while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
subheader.Margin = new BorderDouble(bottom:6);
subheader.Margin = new BorderDouble(bottom: 6);
tuningRatiosLayout.AddChild(subheader);
TextWidget feedRateDescription;
{
@ -167,11 +171,85 @@ namespace MatterHackers.MatterControl.PrinterControls
}
adjustmentControlsGroupBox.AddChild(tuningRatiosLayout);
if(false)
{
HorizontalLine line = new HorizontalLine();
line.Margin = new BorderDouble(0, 10);
tuningRatiosLayout.AddChild(line);
TextWidget subheader2 = new TextWidget("Fine-tune z-height, while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
subheader2.Margin = new BorderDouble(bottom: 6);
tuningRatiosLayout.AddChild(subheader2);
ImageBuffer togetherBig;
ImageBuffer appartBig;
CreateButtonImages(out togetherBig, out appartBig);
textImageButtonFactory.FixedHeight = 0;
Button togetherALot = textImageButtonFactory.GenerateFromImages("", togetherBig);
Button appartALot = textImageButtonFactory.GenerateFromImages("", appartBig);
FlowLayoutWidget leftToRigth = new FlowLayoutWidget();
leftToRigth.AddChild(togetherALot);
leftToRigth.AddChild(appartALot);
tuningRatiosLayout.AddChild(leftToRigth);
}
}
this.AddChild(adjustmentControlsGroupBox);
}
private static void CreateButtonImages(out ImageBuffer togetherBig, out ImageBuffer appartBig)
{
PathStorage upArrow = new PathStorage();
upArrow.MoveTo(0, 0);
upArrow.LineTo(.5, -.5);
upArrow.LineTo(.25, -.5);
upArrow.LineTo(.25, -1);
upArrow.LineTo(-.25, -1);
upArrow.LineTo(-.25, -.5);
upArrow.LineTo(-.5, -.5);
int buttonSize = 32;
int arrowSize = buttonSize / 3;
togetherBig = new ImageBuffer(buttonSize, buttonSize, 32, new BlenderBGRA());
Graphics2D togetherBigGraphics = togetherBig.NewGraphics2D();
togetherBigGraphics.Clear(RGBA_Bytes.White);
int margin = buttonSize / 16;
int lineWidth = buttonSize / 16;
togetherBigGraphics.FillRectangle(margin, buttonSize / 2 + margin, buttonSize - margin, buttonSize / 2 + margin + lineWidth, RGBA_Bytes.Black);
togetherBigGraphics.FillRectangle(margin, buttonSize / 2 - margin, buttonSize - margin, buttonSize / 2 - margin - lineWidth, RGBA_Bytes.Black);
appartBig = new ImageBuffer(togetherBig);
// point up
Affine totalTransform = Affine.NewScaling(arrowSize, arrowSize);
totalTransform *= Affine.NewTranslation(buttonSize / 2, buttonSize / 2 - margin - lineWidth);
togetherBigGraphics.Render(new VertexSourceApplyTransform(upArrow, totalTransform), RGBA_Bytes.Black);
// point down
totalTransform = Affine.NewRotation(MathHelper.Tau / 2);
totalTransform *= Affine.NewScaling(arrowSize, arrowSize);
totalTransform *= Affine.NewTranslation(buttonSize / 2, buttonSize / 2 + margin + lineWidth);
togetherBigGraphics.Render(new VertexSourceApplyTransform(upArrow, totalTransform), RGBA_Bytes.Black);
Graphics2D appartBigGraphics = appartBig.NewGraphics2D();
// point up
totalTransform = Affine.NewScaling(arrowSize, arrowSize);
totalTransform *= Affine.NewTranslation(buttonSize / 2, buttonSize / 2 + margin + lineWidth + arrowSize + 1);
appartBigGraphics.Render(new VertexSourceApplyTransform(upArrow, totalTransform), RGBA_Bytes.Black);
// point down
totalTransform = Affine.NewRotation(MathHelper.Tau / 2);
totalTransform *= Affine.NewScaling(arrowSize, arrowSize);
totalTransform *= Affine.NewTranslation(buttonSize / 2, buttonSize / 2 - margin - lineWidth - arrowSize - 1);
appartBigGraphics.Render(new VertexSourceApplyTransform(upArrow, totalTransform), RGBA_Bytes.Black);
}
public override void OnClosed(EventArgs e)
{
if (unregisterEvents != null)