Merge pull request #2886 from jlewin/design_tools

Disable View GCode buttons in the non-printer case
This commit is contained in:
Lars Brubaker 2018-01-13 12:25:26 -08:00 committed by GitHub
commit f3c8177203
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 12 deletions

View file

@ -285,21 +285,22 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
SiblingRadioButtonList = buttonGroupB,
Name = "Model View Button",
Checked = printer?.ViewState.ViewMode == PartViewMode.Model || printer == null,
ToolTipText = "Model".Localize(),
ToolTipText = "Model View".Localize(),
Margin = commonMargin
};
modelViewButton.Click += SwitchModes_Click;
buttonGroupB.Add(modelViewButton);
AddChild(modelViewButton);
iconPath = Path.Combine("ViewTransformControls", "3d.png");
iconPath = Path.Combine("ViewTransformControls", "gcode_3d.png");
layers3DButton = new RadioIconButton(AggContext.StaticData.LoadIcon(iconPath, IconColor.Theme), theme)
{
SiblingRadioButtonList = buttonGroupB,
Name = "Layers3D Button",
Checked = printer?.ViewState.ViewMode == PartViewMode.Layers3D,
ToolTipText = "3D Layers".Localize(),
Margin = commonMargin
ToolTipText = "3D Layer View".Localize(),
Margin = commonMargin,
Enabled = isPrinterType
};
layers3DButton.Click += SwitchModes_Click;
buttonGroupB.Add(layers3DButton);
@ -309,14 +310,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.AddChild(layers3DButton);
}
iconPath = Path.Combine("ViewTransformControls", "2d.png");
iconPath = Path.Combine("ViewTransformControls", "gcode_2d.png");
layers2DButton = new RadioIconButton(AggContext.StaticData.LoadIcon(iconPath, IconColor.Theme), theme)
{
SiblingRadioButtonList = buttonGroupB,
Name = "Layers2D Button",
Checked = printer?.ViewState.ViewMode == PartViewMode.Layers2D,
ToolTipText = "2D Layers".Localize(),
Margin = commonMargin
ToolTipText = "2D Layer View".Localize(),
Margin = commonMargin,
Enabled = isPrinterType
};
layers2DButton.Click += SwitchModes_Click;
buttonGroupB.Add(layers2DButton);
@ -434,7 +436,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
BackgroundColor = theme.MinimalShade,
GradientDistance = -1,
DrawArrow = true,
AlignToRightEdge = true,
Margin = theme.ButtonSpacing,
};
@ -443,6 +444,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void SwitchModes_Click(object sender, MouseEventArgs e)
{
if (!IsPrinterMode)
{
return;
}
if (sender is GuiWidget widget)
{
if (widget.Name == "Layers2D Button")

View file

@ -469,7 +469,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
switch (settingData.DataEditType)
{
case SliceSettingData.DataEditTypes.INT:
uiField = new IntField();
var intField = new IntField();
uiField = intField;
if (settingData.SlicerConfigName == "extruder_count")
{
intField.MaxValue = 4;
intField.MinValue = 0;
}
break;
case SliceSettingData.DataEditTypes.DOUBLE:

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2017, Lars Brubaker, John Lewin
Copyright (c) 2018, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
@ -34,10 +35,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
private int intValue;
public int MinValue { get; set; } = int.MinValue;
public int MaxValue { get; set; } = int.MaxValue;
protected override string ConvertValue(string newValue)
{
decimal.TryParse(newValue, out decimal currentValue);
intValue = (int)currentValue;
// Clamp to range
intValue = Math.Min((int)currentValue, this.MaxValue);
intValue = Math.Max(intValue, this.MinValue);
return intValue.ToString();
}

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

@ -1 +1 @@
Subproject commit 62ffc915f217c8a2232810fb4f567f9b4b1009f3
Subproject commit e28826c49a73ed885dd459b4631f021d6d26406c