Making tab indexes better
This commit is contained in:
parent
9f6b6133ac
commit
d5d5652c85
36 changed files with 124 additions and 99 deletions
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
|
|
@ -58,7 +59,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
private ImageWidget imageWidget;
|
||||
private Object3D object3D;
|
||||
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context)
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context, ref int tabIndex)
|
||||
{
|
||||
if (property.Source is Object3D object3D)
|
||||
{
|
||||
|
|
@ -98,7 +99,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
graphics2D.Clear(theme.BackgroundColor);
|
||||
|
||||
var bounds = imageWidget.Image.GetBounds();
|
||||
bounds.Inflate(-1);
|
||||
graphics2D.Rectangle(bounds, theme.PrimaryAccentColor);
|
||||
|
||||
var pathBounds = vertexStorage.GetBounds();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
public interface IPropertyEditorFactory
|
||||
{
|
||||
GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context);
|
||||
GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context, ref int tabIndex);
|
||||
}
|
||||
|
||||
public class PropertyEditor : IObjectEditor
|
||||
|
|
@ -302,6 +302,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
rows.Clear();
|
||||
|
||||
int tabIndex = 0;
|
||||
|
||||
// Create a field editor for each editable property detected via reflection
|
||||
foreach (var property in GetEditablePropreties(context.Item))
|
||||
{
|
||||
|
|
@ -347,7 +349,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
scope = mainContainer;
|
||||
}
|
||||
|
||||
var editor = CreatePropertyEditor(property, undoBuffer, context, theme);
|
||||
var editor = CreatePropertyEditor(property, undoBuffer, context, theme, ref tabIndex);
|
||||
if (editor != null)
|
||||
{
|
||||
scope.AddChild(editor);
|
||||
|
|
@ -387,7 +389,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return mainContainer;
|
||||
}
|
||||
|
||||
public GuiWidget CreatePropertyEditor(EditableProperty property, UndoBuffer undoBuffer, EditorContext context, ThemeConfig theme)
|
||||
public GuiWidget CreatePropertyEditor(EditableProperty property, UndoBuffer undoBuffer, EditorContext context, ThemeConfig theme, ref int tabIndex)
|
||||
{
|
||||
if (property == null
|
||||
|| context == null)
|
||||
|
|
@ -411,7 +413,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
if (AllowedTypes.ContainsKey(propertyValue.GetType())
|
||||
&& AllowedTypes[propertyValue.GetType()] != null)
|
||||
{
|
||||
rowContainer = AllowedTypes[propertyValue.GetType()].CreateEditor(this, property, context);
|
||||
rowContainer = AllowedTypes[propertyValue.GetType()].CreateEditor(this, property, context, ref tabIndex);
|
||||
}
|
||||
else if (propertyValue is double doubleValue)
|
||||
{
|
||||
|
|
@ -442,7 +444,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else // normal edit row
|
||||
{
|
||||
var field = new DoubleField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.DoubleValue = doubleValue;
|
||||
field.ClearUndoHistory();
|
||||
RegisterValueChanged(property, undoBuffer, context, field, (valueString) => { return double.Parse(valueString); });
|
||||
|
|
@ -479,7 +481,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else if (propertyValue is Color color)
|
||||
{
|
||||
var field = new ColorField(theme, color, null, false);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.ValueChanged += (s, e) =>
|
||||
{
|
||||
property.SetValue(field.Color);
|
||||
|
|
@ -492,7 +494,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else if (propertyValue is Vector2 vector2)
|
||||
{
|
||||
var field = new Vector2Field(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.Vector2 = vector2;
|
||||
field.ClearUndoHistory();
|
||||
|
||||
|
|
@ -512,7 +514,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else if (propertyValue is Vector3 vector3)
|
||||
{
|
||||
var field = new Vector3Field(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.Vector3 = vector3;
|
||||
field.ClearUndoHistory();
|
||||
|
||||
|
|
@ -536,7 +538,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
field.Labels = vectorFieldLabels.Labels;
|
||||
}
|
||||
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.Vector4 = vector4;
|
||||
field.ClearUndoHistory();
|
||||
|
||||
|
|
@ -555,7 +557,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else if (propertyValue is DirectionVector directionVector)
|
||||
{
|
||||
var field = new DirectionVectorField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(directionVector);
|
||||
field.ClearUndoHistory();
|
||||
|
||||
|
|
@ -573,7 +575,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
rowContainer = CreateSettingsColumn(property);
|
||||
|
||||
var field1 = new DirectionVectorField(theme);
|
||||
field1.Initialize(0);
|
||||
field1.Initialize(ref tabIndex);
|
||||
field1.ClearUndoHistory();
|
||||
|
||||
field1.SetValue(new DirectionVector()
|
||||
|
|
@ -587,7 +589,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
// the distance from the center of the part
|
||||
// create a double editor
|
||||
var field2 = new Vector3Field(theme);
|
||||
field2.Initialize(0);
|
||||
field2.Initialize(ref tabIndex);
|
||||
field2.Vector3 = directionAxis.Origin - propertyIObject3D.Children.First().GetAxisAlignedBoundingBox().Center;
|
||||
field2.ClearUndoHistory();
|
||||
|
||||
|
|
@ -745,7 +747,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else if (propertyValue is List<string> stringList)
|
||||
{
|
||||
var field = new SurfacedEditorsField(theme, propertyIObject3D);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.ListValue = stringList;
|
||||
field.ValueChanged += (s, e) =>
|
||||
{
|
||||
|
|
@ -803,7 +805,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
else // normal edit row
|
||||
{
|
||||
var field = new IntField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.IntValue = intValue;
|
||||
field.ClearUndoHistory();
|
||||
|
||||
|
|
@ -834,7 +836,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a bool editor
|
||||
var field = new ToggleboxField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.Checked = boolValue;
|
||||
|
||||
RegisterValueChanged(property, undoBuffer, context,
|
||||
|
|
@ -850,7 +852,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
Name = property.DisplayName + " Field"
|
||||
};
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
if (doubleExpresion.Expression.Contains("="))
|
||||
{
|
||||
field.SetValue(doubleExpresion.Expression, false);
|
||||
|
|
@ -926,7 +928,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
Name = property.DisplayName + " Field"
|
||||
};
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
if (intExpresion.Expression.Contains("="))
|
||||
{
|
||||
field.SetValue(intExpresion.Expression, false);
|
||||
|
|
@ -1001,7 +1003,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a a multi-line string editor
|
||||
var field = new MultilineStringField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(stringOrExpression.Expression, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
@ -1022,7 +1024,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a string editor
|
||||
var field = new TextField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(stringOrExpression.Expression, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
@ -1040,7 +1042,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a string editor
|
||||
var field = new TextField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(dateTime.ToString("MM/dd/yyyy HH:mm"), false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
@ -1057,7 +1059,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a char editor
|
||||
var field = new CharField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(charValue.ToString(), false);
|
||||
field.ClearUndoHistory();
|
||||
field.ValueChanged += (s, e) =>
|
||||
|
|
@ -1099,7 +1101,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
}
|
||||
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
RegisterValueChanged(property, undoBuffer, context,
|
||||
field,
|
||||
(valueString) =>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading;
|
||||
using static MatterHackers.Agg.UI.OnScreenKeyboard;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
public class SelectedChildrenPropertyEditor : IPropertyEditorFactory
|
||||
{
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context)
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context, ref int tabIndex)
|
||||
{
|
||||
if (property.Value is SelectedChildren childSelector)
|
||||
{
|
||||
|
|
@ -60,7 +61,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
UIField field = new ChildrenSelectorListField(property, theme);
|
||||
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
PropertyEditor.RegisterValueChanged(property, undoBuffer, context,
|
||||
field,
|
||||
(valueString) =>
|
||||
|
|
|
|||
|
|
@ -41,12 +41,13 @@ using System.Web;
|
|||
using System.ComponentModel;
|
||||
using MatterHackers.VectorMath;
|
||||
using System.IO;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class StringPropertyEditor : IPropertyEditorFactory
|
||||
{
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context)
|
||||
public GuiWidget CreateEditor(PropertyEditor propertyEditor, EditableProperty property, EditorContext context, ref int tabIndex)
|
||||
{
|
||||
if (property.Value is string stringValue)
|
||||
{
|
||||
|
|
@ -156,7 +157,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a a multi-line string editor
|
||||
var field = new MultilineStringField(theme, property.PropertyInfo.GetCustomAttributes(true).OfType<UpdateOnEveryKeystrokeAttribute>().FirstOrDefault() != null);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(stringValue, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
@ -171,7 +172,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
// create a string editor
|
||||
var field = new TextField(theme);
|
||||
field.Initialize(0);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(stringValue, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
|
|
@ -62,11 +63,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
var propertyEditor = new PropertyEditor(theme, new UndoBuffer());
|
||||
|
||||
int tabIndex = 0;
|
||||
|
||||
var editor = propertyEditor.CreatePropertyEditor(
|
||||
new EditableProperty(propertyInfo, supportGenerator),
|
||||
null,
|
||||
new EditorContext(),
|
||||
theme);
|
||||
theme,
|
||||
ref tabIndex);
|
||||
|
||||
if (editor != null)
|
||||
{
|
||||
|
|
@ -75,7 +79,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in support pillar size
|
||||
var pillarSizeField = new DoubleField(theme);
|
||||
pillarSizeField.Initialize(0);
|
||||
pillarSizeField.Initialize(ref tabIndex);
|
||||
pillarSizeField.DoubleValue = supportGenerator.PillarSize;
|
||||
pillarSizeField.ValueChanged += (s, e) =>
|
||||
{
|
||||
|
|
@ -97,7 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in the angle setting
|
||||
var overHangField = new DoubleField(theme);
|
||||
overHangField.Initialize(0);
|
||||
overHangField.Initialize(ref tabIndex);
|
||||
overHangField.DoubleValue = supportGenerator.MaxOverHangAngle;
|
||||
overHangField.ValueChanged += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
|
|
@ -145,8 +146,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
VAnchor = VAnchor.Stretch,
|
||||
});
|
||||
|
||||
// put in an html edit field
|
||||
htmlField.Initialize(0);
|
||||
int tabIndex = 0;
|
||||
|
||||
// put in an html edit field
|
||||
htmlField.Initialize(ref tabIndex);
|
||||
htmlField.SetValue(startingColor.Html.Substring(1, 6), false);
|
||||
htmlField.ClearUndoHistory();
|
||||
htmlField.ValueChanged += (s, e) =>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static JsonPath.JsonPathContext.ReflectionValueSystem;
|
||||
|
|
@ -182,6 +183,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public void SetActiveItem(ISceneContext sceneContext)
|
||||
{
|
||||
int tabIndex = 0;
|
||||
var selectedItem = sceneContext?.Scene?.SelectedItem;
|
||||
if (this.item == selectedItem)
|
||||
{
|
||||
|
|
@ -296,7 +298,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (!(selectedItem.GetType().GetCustomAttributes(typeof(HideMeterialAndColor), true).FirstOrDefault() is HideMeterialAndColor))
|
||||
{
|
||||
AddMaterialAndColorSelector(sceneContext, selectedItem, undoBuffer);
|
||||
AddMaterialAndColorSelector(sceneContext, selectedItem, undoBuffer, ref tabIndex);
|
||||
}
|
||||
|
||||
var rows = new SafeList<SettingsRow>();
|
||||
|
|
@ -305,7 +307,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (selectedItem is ComponentObject3D componentObject
|
||||
&& componentObject.Finalized)
|
||||
{
|
||||
AddComponentEditor(selectedItem, undoBuffer, rows, componentObject);
|
||||
AddComponentEditor(selectedItem, undoBuffer, rows, componentObject, ref tabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -316,7 +318,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
void AddMaterialAndColorSelector(ISceneContext sceneContext, IObject3D selectedItem, UndoBuffer undoBuffer)
|
||||
void AddMaterialAndColorSelector(ISceneContext sceneContext, IObject3D selectedItem, UndoBuffer undoBuffer, ref int tabIndex)
|
||||
{
|
||||
var firstDetectedColor = selectedItem.VisibleMeshes()?.FirstOrDefault()?.WorldColor();
|
||||
var worldColor = Color.White;
|
||||
|
|
@ -327,7 +329,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in a color edit field
|
||||
var colorField = new ColorField(theme, worldColor, GetNextSelectionColor, true);
|
||||
colorField.Initialize(0);
|
||||
colorField.Initialize(ref tabIndex);
|
||||
colorField.ValueChanged += (s, e) =>
|
||||
{
|
||||
if (selectedItem.Color != colorField.Color)
|
||||
|
|
@ -513,7 +515,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
// put in a material edit field
|
||||
var materialField = new MaterialIndexField(sceneContext.Printer, theme, selectedItem.MaterialIndex);
|
||||
materialField.Initialize(0);
|
||||
materialField.Initialize(ref tabIndex);
|
||||
materialField.ValueChanged += (s, e) =>
|
||||
{
|
||||
if (selectedItem.MaterialIndex != materialField.MaterialIndex)
|
||||
|
|
@ -536,7 +538,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private void AddComponentEditor(IObject3D selectedItem, UndoBuffer undoBuffer, SafeList<SettingsRow> rows, ComponentObject3D componentObject)
|
||||
private void AddComponentEditor(IObject3D selectedItem, UndoBuffer undoBuffer, SafeList<SettingsRow> rows, ComponentObject3D componentObject, ref int tabIndex)
|
||||
{
|
||||
var context = new EditorContext();
|
||||
PropertyEditor.AddUnlockLinkIfRequired(selectedItem, editorPanel, theme);
|
||||
|
|
@ -578,7 +580,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var editableProperty = new EditableProperty(reflectionTarget.PropertyInfo, reflectionTarget.Source);
|
||||
|
||||
var propertyEditor = new PropertyEditor(theme, undoBuffer);
|
||||
var editor = propertyEditor.CreatePropertyEditor(editableProperty, undoBuffer, context, theme);
|
||||
var editor = propertyEditor.CreatePropertyEditor(editableProperty, undoBuffer, context, theme, ref tabIndex);
|
||||
if (editor != null)
|
||||
{
|
||||
editorPanel.AddChild(editor);
|
||||
|
|
@ -612,7 +614,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
Name = cellId + " Field",
|
||||
};
|
||||
field.Initialize(0);
|
||||
int tabIndex = 0;
|
||||
field.Initialize(ref tabIndex);
|
||||
field.SetValue(cellData, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
uiField.HelpText = settingData.HelpText;
|
||||
|
||||
uiField.Name = $"{settingData.PresentationName} Field";
|
||||
uiField.Initialize(tabIndexForItem++);
|
||||
uiField.Initialize(ref tabIndexForItem);
|
||||
|
||||
if (settingData.DataEditType == SliceSettingData.DataEditTypes.WIDE_STRING)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.settingData = settingData;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
base.Initialize(tabIndex);
|
||||
base.Initialize(ref tabIndex);
|
||||
this.textEditWidget.BackgroundColor = Color.Pink;
|
||||
ChangesMultipleOtherSettings = settingData.SetSettingsOnChange.Count > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
textEditWidget = new ThemedTextEditWidget("", theme, pixelWidth: ControlWidth, tabIndex: tabIndex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,14 +46,15 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
checkBoxWidget = new CheckBox("")
|
||||
{
|
||||
VAnchor = VAnchor.Bottom,
|
||||
Name = this.Name,
|
||||
TextColor = theme.TextColor,
|
||||
Checked = this.Value == "1"
|
||||
Checked = this.Value == "1",
|
||||
TabIndex = tabIndex++,
|
||||
};
|
||||
checkBoxWidget.CheckedStateChanged += (s, e) =>
|
||||
{
|
||||
|
|
@ -89,7 +90,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var pixelWidth = this.ControlWidth + 6; // HACK: work around agg-bug where text fields are padding*2 bigger than ControlWidth
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
// Enum keyed on name to friendly name
|
||||
List<(string key, string value)> names = null;
|
||||
|
|
@ -70,9 +70,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
dropDownList = new MHDropDownList("Name".Localize(), theme);
|
||||
dropDownList = new MHDropDownList("Name".Localize(), theme)
|
||||
{
|
||||
TabIndex = tabIndex++,
|
||||
};
|
||||
|
||||
var orderedItems = names.OrderBy(n => n.value);
|
||||
|
||||
var orderedItems = names.OrderBy(n => n.value);
|
||||
|
||||
foreach (var orderItem in orderedItems)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
set => colorWidget.Color = value;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var container = new FlowLayoutWidget();
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public new string Name { get; set; }
|
||||
public static bool ShowPortWizardButton { get; set; } = true;
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
EventHandler unregisterEvents = null;
|
||||
|
||||
|
|
@ -71,11 +71,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
ToolTipText = this.HelpText,
|
||||
Margin = new BorderDouble(),
|
||||
TabIndex = tabIndex,
|
||||
Name = "com_port Field",
|
||||
// Prevent droplist interaction when connected
|
||||
Enabled = canChangeComPort,
|
||||
};
|
||||
TabIndex = tabIndex++,
|
||||
};
|
||||
|
||||
dropdownList.Click += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
dropDownList = new MHDropDownList("Name".Localize(), theme);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.Platform;
|
||||
|
|
@ -69,7 +70,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
(string key, string name) GetKeyName(Enum value)
|
||||
{
|
||||
|
|
@ -117,9 +118,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
tabIndex++;
|
||||
}
|
||||
|
||||
private void EnableReduceWidth(ThemedRadioTextButton enumTab)
|
||||
private void EnableReduceWidth(ThemedRadioTextButton enumTab)
|
||||
{
|
||||
var deviceScale = GuiWidget.DeviceScale;
|
||||
var padingSize = enumTab.Padding.Left * deviceScale;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
// Enum keyed on name to friendly name
|
||||
var enumItems = Enum.GetNames(property.PropertyType).Select(enumName =>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var aligner = new GuiWidget()
|
||||
{
|
||||
|
|
@ -67,7 +67,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
ToolTipText = this.HelpText,
|
||||
SelectAllOnFocus = true,
|
||||
Name = this.Name,
|
||||
});
|
||||
TabIndex = tabIndex++,
|
||||
});
|
||||
|
||||
textEditWidget.ActualTextEditWidget.EditComplete += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
childFields = new List<Vector3Field>();
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
row.AddChild(labelWidget);
|
||||
|
||||
var field = new Vector3Field(theme);
|
||||
field.Initialize(tabIndex++);
|
||||
field.Initialize(ref tabIndex);
|
||||
field.Content.Margin = new BorderDouble(right: 55);
|
||||
field.Content.VAnchor = VAnchor.Center;
|
||||
field.ValueChanged += (s, e) =>
|
||||
|
|
@ -107,7 +107,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
childFields.Add(field);
|
||||
}
|
||||
|
||||
base.Initialize(tabIndex);
|
||||
base.Initialize(ref tabIndex);
|
||||
}
|
||||
|
||||
private static double StripZeroSign(double x)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
// Enum keyed on name to friendly name
|
||||
var enumItems = Enum.GetNames(property.PropertyType).Select(enumName =>
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
base.Initialize(tabIndex);
|
||||
base.Initialize(ref tabIndex);
|
||||
bool canChangeComPort = !printer.Connection.IsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
|
||||
//This setting defaults to Manual
|
||||
var selectedMachine = printer.Settings.GetValue(SettingsKey.selector_ip_address);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return 0;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
dropdownList = new MHDropDownList("None".Localize(), theme, maxHeight: 200 * GuiWidget.DeviceScale)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
this.Content = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
VAnchor = VAnchor.Fit,
|
||||
};
|
||||
|
||||
base.Initialize(tabIndex);
|
||||
base.Initialize(ref tabIndex);
|
||||
}
|
||||
|
||||
public List<string> _list = new List<string>();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.fieldTitle = fieldTitle;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var editButton = new ThemedIconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).GrayToColor(theme.TextColor), theme)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public int MaterialIndex { get; set; }
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var container = new FlowLayoutWidget();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
editWidget = new ThemedTextEditWidget("", theme, pixelWidth: 320, multiLine: true, tabIndex: tabIndex, typeFace: ApplicationController.GetTypeFace(NamedTypeFace.Liberation_Mono))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
numberEdit = new ThemedNumberEdit(0, theme, pixelWidth: ControlWidth, allowDecimals: this.AllowDecimals, allowNegatives: this.AllowNegatives, tabIndex: tabIndex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public new string Name { get; set; }
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
EventHandler unregisterEvents = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
textEditWidget = new ThemedTextEditWidget("", theme, pixelWidth: ControlWidth, tabIndex: tabIndex)
|
||||
{
|
||||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
this.theme = theme;
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
textWidget = new TextWidget("", textColor: theme.TextColor, pointSize: theme.DefaultFontSize)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return newValue;
|
||||
}
|
||||
|
||||
public virtual void Initialize(int tabIndex)
|
||||
public virtual void Initialize(ref int tabIndex)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
base.Initialize(tabIndex);
|
||||
base.Initialize(ref tabIndex);
|
||||
|
||||
textEditWidget.ActualTextEditWidget.InternalTextEditWidget.AllSelected += (s, e) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var container = new FlowLayoutWidget();
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
xEditWidget = new ThemedNumberEdit(currentXValue, theme, singleCharLabel: 'X', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
yEditWidget = new ThemedNumberEdit(currentYValue, theme, 'Y', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
};
|
||||
yEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var container = new FlowLayoutWidget();
|
||||
|
||||
|
|
@ -71,10 +71,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
double.TryParse(xyzStrings[0], out double currentXValue);
|
||||
|
||||
xEditWidget = new ThemedNumberEdit(currentXValue, theme, 'X', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex++)
|
||||
xEditWidget = new ThemedNumberEdit(currentXValue, theme, 'X', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -93,10 +93,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
double.TryParse(xyzStrings[1], out double currentYValue);
|
||||
|
||||
yEditWidget = new ThemedNumberEdit(currentYValue, theme, 'Y', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex++)
|
||||
yEditWidget = new ThemedNumberEdit(currentYValue, theme, 'Y', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -115,10 +115,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
double.TryParse(xyzStrings[2], out double currentZValue);
|
||||
|
||||
zEditWidget = new ThemedNumberEdit(currentZValue, theme, 'Z', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex++)
|
||||
zEditWidget = new ThemedNumberEdit(currentZValue, theme, 'Z', allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(int tabIndex)
|
||||
public override void Initialize(ref int tabIndex)
|
||||
{
|
||||
var container = new FlowLayoutWidget();
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
xEditWidget = new ThemedNumberEdit(currentXValue, theme, Labels[0] /* X */, allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZWEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
yEditWidget = new ThemedNumberEdit(currentYValue, theme, Labels[1] /* Y */, allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZWEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -123,7 +123,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
zEditWidget = new ThemedNumberEdit(currentZValue, theme, Labels[2] /* Z */, allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZWEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
wEditWidget = new ThemedNumberEdit(currentZValue, theme, Labels[3] /* W */, allowNegatives: true, allowDecimals: true, pixelWidth: VectorXYZWEditWidth, tabIndex: tabIndex)
|
||||
{
|
||||
ToolTipText = this.HelpText,
|
||||
TabIndex = tabIndex + 1,
|
||||
TabIndex = tabIndex++,
|
||||
SelectAllOnFocus = true,
|
||||
Margin = theme.ButtonSpacing
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 91d15ff1d8a9d934c309de1279f977ce0537a9c9
|
||||
Subproject commit cce11149641f4190905877c8e680eda3c50c99e0
|
||||
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
|
|
@ -53,8 +54,9 @@ namespace MatterControl.Tests.MatterControl
|
|||
// Store
|
||||
this.field = field;
|
||||
|
||||
// Initialize the field and store the generated content reference
|
||||
field.Initialize(0);
|
||||
int tabIndex = 0;
|
||||
// Initialize the field and store the generated content reference
|
||||
field.Initialize(ref tabIndex);
|
||||
|
||||
GuiWidget widgetUnderTest = field.Content;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue